# How to show if two polynomials are equal for all substituted real numbers, then all the coefficients are equal

Let $p(x)=c_0+c_1x+\ldots+c_lx^l$ and $q(x)=d_0+d_1x+\ldots+d_mx^m$ be polynomials with real coefficients. Suppose $\forall x\in\mathbb{R}$, $p(x)=q(x)$. Show that $l=m$ and that for all $i=0,\ldots,l$, we have $c_i=d_i$.

Here is what I tried:

First we showed $c_0=d_0$ by substituting $x=0$ into both polynomials, then $c_0=p(0)=q(0)=d_0$. We can then subtract $c_0$ and $d_0$ from both polynomials.

We then substitute $x=1,-1$ into both $p(x),q(x)$, we get:

$p(1)=c_1+c_2+\ldots+c_l$ and $q(1)=d_1+d_2+\ldots+d_m$ and
$p(-1)=-c_1+c_2-c_3+\ldots+c_l$ and $q(-1)=-d_1+d_2-d_3+\ldots+d_m$.

$p(1)+p(-1)=2c_2+2c_4+\ldots$ and $p(1)-p(-1)=2c_1+2c_3+\ldots$, the last term depends on whether $l$ is even or odd.

I am stuck and not sure how to continue, I guess we should probably use induction but not sure how to induction. Can we use induction? Could anyone please give some help?

Thanks.

• Try finding the polynomial $p(x)-q(x)$. – Kenny Lau May 5 '16 at 7:54
• Induction is easy. Putting $x=0$ shows that $c_0=d_0$ but now the polynomials $c_1+c_2x+\dots+c_lx^{l-1}$ and $d_1+d_2x+\dots+d_mx^{m-1}$ must give the same value for all $x$. – almagest May 5 '16 at 8:27
• @almagest, I think you made a mistake? It should be $c_1x$ not just $c_1$. How can you reduce the degree of the polynomial? – user71346 May 5 '16 at 8:44
• Ok, put $f(x)=c_1x+\dots+c_lx^l$ and $g(x)=d_1x+\dots+d_mx^m$. For all $x\ne0$ you have $f(x)=g(x)$ and hence $f(x)/x=g(x)/x$. Both those polynomials are continuous, so taking $x\to0$ you have them also equal at $x=0$ and now you apply your inductive hypothesis. – almagest May 5 '16 at 8:52

Let $f(x)=p(x)-q(x)$. $f(x)$ is also a polynomial with real coefficients.
From the question: $$\forall x\in\mathbb R: f(x)=0$$