Let's perform the synthetic division
color(white)(aaaa)3color(white)(aaaaa)|color(white)(aaaa)1color(white)(aaaaaa)31color(white)(aaaaaa)-13color(white)(aaaaa)2
color(white)(aaaaaaaaaaaa)_________
color(white)(aaaa)color(white)(aaaaaaa)|color(white)(aaaa)color(white)(aaaaaaa)3color(white)(aaaaaaa)102color(white)(aaaa)267
color(white)(aaaaaaaaaaaa)________
color(white)(aaaa)color(white)(aaaaaaa)|color(white)(aaaa)1color(white)(aaaaaa)34color(white)(aaaaaaa)89color(white)(aaaa)color(red)(269)
The remainder is =269 and the quotient is =n^2+34n+89
(n^3+31n^2-13n+2)/(n-3)=n^2+34n+89+269/(n-3)
N.B The numerator and denominator were divided by the common factor 2