Let p(x) = x 51 and q(x) = x 2 – 3x + 2 = (x – 1) (x – 2)
When p(x) is divided by q(x), then by division algorithm there exists Q(x) and R(x) = ax+b such that
x51 = Q(x)(x-1)(x-2) + ax +b where Q(x) is result and ax+b is remainder
For x = 1 you get
1^51 = Q(1)(1-1)(1-2) + a+b then a+b = 1
and
2^51 = Q(2)(2-1)(2-2) + 2a + b then 2a+b = 2^51
Now solve
a+b = 1
2a+b = 2^51
a = 2^(51) - 1
b = 2- 2^(51)
Remainder is x(2^51 - 1) + 2-2^51