Basically you need to find the common factor from the first 2 terms and the last 2 terms in x3+ 3x2+3x+9. So you would get x2(x+3)+3(x+3) so, this can be simplfied to (x2+3)(x+3). Then we bring back the expression in the denominator which should look like this (x2+3)(x+3)/x+3. here we can cancel x+3 so you are left with x2+3. Hope this helps.