This problem is from my Gelfand's Algebra book.

Problem 164. Prove that a polynomial of degree not exceeding 2 is defined uniquely by three of its values.

This means that if $\displaystyle P(x)$ and $\displaystyle Q(x)$ are polynomials of degree not exceeding 2 and $\displaystyle P(x_1)=Q(x_1),P(x_2)=Q(x_2),P(x_3)=Q(x_3)$ for three different numbers $\displaystyle x_1,x_2,\text{ and } x_3,$ then the polynomials $\displaystyle P(x)$ and $\displaystyle Q(x)$ are equal.

I'm not very good at proofs, so I have questions. If I show that if $\displaystyle P(x_1)=Q(x_1),P(x_2)=Q(x_2),P(x_3)=Q(x_3)$ is true and $\displaystyle P(x)$ and $\displaystyle Q(x)$ are polynomials of degree not exceeding 2, then $\displaystyle P(x)$ and $\displaystyle Q(x)$ are equal, will it prove that a polynomial of degree not exceeding 2 is defined uniquely by three of its values?

Is this the way to go?

Let $\displaystyle V(x)=P(x)-Q(x)$, After that $\displaystyle V(x_1)=V(x_2)=V(x_3)=0$, because $\displaystyle P(x_1)=Q(x_1),P(x_2)=Q(x_2),P(x_3)=Q(x_3)$, so $\displaystyle x_1,x_2,x_3$ are roots of $\displaystyle V(x)$ which can't have more than two roots. Here I'm confused, I shouldn't have assumed that $\displaystyle P(x_1)=Q(x_1),P(x_2)=Q(x_2),P(x_3)=Q(x_3)$ was true, right?