x^51=p_(49)(x)(x^2-3x+2)+r(x)
Here p_(49)(x) represents a polynomial of degree 49 and r(x) is the division remainder. The remainder degree is always lower than the divisor. So p_49(x) is the quotient, (x^2-3x+2) is the divisor, and r(x) the remainder. Note that
degree[p_49(x)] = 49
degree[(x^2-3x+2)] = 2
degree[r(x)] = 1
then
degree[p_(49)(x)(x^2-3x+2)] = 51
but (x^2-3x+2)=(x-1)(x-2) and
the general 1 degree polynomial representing r(x) is ax+b so
x^51=p_(49)(x)(x-1)(x-2)+ax+b The constants a,b are obtained because we know two conditions to be obeyed.
x=1->1^51=a+b and
x=2->2^51=2a+b
Solving for a, b we get
r(x) = (2^51-1)x+2-2^51