Q:

Proof: Two polynomials $P(x)$ and $Q(x)$ attain same value for every $x \in \mathbb R$ if and only if coefficients $p_i = q_i$ are equal for every $i$

Proof: Two polynomials $P(x)$ and $Q(x)$ attain same value for every $x \in \mathbb R$ if and only if coefficients $p_i = q_i$ are equal for every $i$
I've been thinking how to prove this. I know we can write both polynomials as a product of irreducible polynomials corresponding to roots, however this only prove that the values attained by the polynomials are equal for every $x \in \mathbb R$ not that the coefficients are equal.
Also we could let $x = 0$ to conclude $p_0 = q_0$. However we may not cancel $x$ by division on both sides ? Then we cannot continue the procedure, since division by zero is undefined.
Could someone give me a hint ?

A:

Besides the standard proof considering the roots of $P-Q$ (which works for polynomials over any infinite integral domain) there is another approach that works for polynomials over the real (or complex) numbers specifically. If the polynomial functions associated to $P$ and $Q$ are equal, then so must their derivative functions, to any order, be. Now the $n$-th derivative of $P$ evaluated at $x=0$ gives you $n!$ times the coefficient of $x^n$ in$~P$. From this you can conclude that all coefficients of $P$ and $Q$ coincide. 

