Problem 147.The numbers 1 and 2 are roots of polynomial P. Prove that P is divisible by (x-1)(x-2).

I have the solution but I don't understand one of the steps.

Solution.P is divisible by (x-1) because 1 is a root of P. Therefore for some polynomial Q. Substituting 2 for x in this equality we find that 2 is a root of Q, so Q is divisible by (x-2), that is for some polynomial R. So

Why is it, that you can just substitute 2 into that? Am I correct in saying it shows that P = Q therefore (x-2) is a root of Q, because it's a root of P? I don't understand the reasoning behind that step. Could someone explain?

A second problem - to which I've no solution - has me stumped.

Problem 154.Assume that (where a and b are some numbers) is divisible by . Find a and b.

Thanks in advance.