# Prove that $p \in \mathbb{R}[x]$ can be represented as a sum of squares of polynomials from $\mathbb{R}[x]$

$$p \in \mathbb{R}[x]$$ and $$\forall x\in\mathbb{R} \ \ p(x) > 0$$. Prove that $$p = \sum_{k=1}^{n}p^2_k, \ \ p_k \in \mathbb{R}[x]$$. I have noticed that $$\deg(p)$$ must be even, because $$p(x)$$ doesn't intersect $$\{x=0\}$$.

How can I proceed with the proof?

Wlog we can assume that $p$ is monic and let $\deg(p)=2m$. As already noted the roots of $p$ come in conjugate pairs. Choose representatives $z_1, \ldots, z_m$ in each pair. Let $$q(x)=(x-z_1)(x-z_2)\dotsc (x-z_m)\\ \overline{q}(x)=(x-\overline{z}_1)(x-\overline{z}_2)\dotsc (x-\overline{z}_m).$$ Then $p=q\,\overline{q}$. Let $q=a+\textrm{i}\, b$ with $a,b\in \mathbb{R}[x]$. Then $p=(a+\textrm{i}\, b)(a-\textrm{i}\, b)=a^2+b^2$.

Without induction or using an identity, we're looking for two polynomials $A$ and $B$ in $\mathbb R[X]$, such that $P=(A+iB)(A-iB)$.

• First, notice that the class of polynomials that can be rewritten as $A^2+B^2=(A+iB)(A-iB)$ is closed under multiplication (use the complex form $(A+iB)(A-iB)$)

• Then, rewrite $P$ as a product of irreducible polynomials in $\mathbb R[X]$, that is $$P=\prod_{i=1}^s(X-\alpha_i)^{\omega_i}\prod_{k=0}^t(X^2+2a_kX+b_k)^{\theta_k}$$ where $a_k^2-b_k <0$ and the $\alpha_i$ are distinct.

• From the sign assumption on $P$ and the continuity of the polynomial, you can deduce that $\omega_i$ are even.

• Also note that $X^2+2a_kX+b_k=(X^2+a_k)^2+\left(\sqrt{b_k-a_k^2}\right)^2$

• We have rewritten $P$ as a product of polynomials of the form $A^2+B^2$, we're done.

You can also study two related problems:

• A complex polynomial $P$ can be rewritten as $A^2+B^2$ where $A,B$ are complex polynomials.

• Replace $\mathbb R$ by $\mathbb Q$ in your original statement, and it stops working.

• thank you for inspiring comment Jun 10, 2014 at 6:37

Outline: The roots of our polynomial are non-real, and come in complex conjugate pairs. It follows that our polynomial has shape a constant times a product of positive quadratics. Here we have used the Fundamental Theorem of Algebra.

A positive quadratic can be written in the form $(ax+b)^2+c^2$. (Complete the square in the usual way.)

Finally, a product of two sums of two squares is a sum of two squares. This uses the Brahmagupta Identity $$(P^2+Q^2)(R^2+S^2)=(PR+QS)^2+(PS-QR)^2.$$ So a product of an arbitrary number of sums of two squares is a sum of two squares.

We have proved that a polynomial in one variable which is always positive is a sum of two squares.

Remark: We only used a special case of the Brahmagupta Identity. This special case is sometimes (wrongly) attributed to Fibonacci. Diophantus already had used the procedure in his Arithmetica.

• brilliant answer! Jun 7, 2014 at 7:19
• Please note that the answer by WimC is a more compact (and therefore better) answer than mine. Jun 7, 2014 at 7:40

Here's another inductive proof that avoids complex numbers. If $p$ is constant then it is itself a square. Otherwise let $p$ attain a minimum $\alpha^2$ at $x_0$. Then $p-\alpha^2$ is non-negative with a root at $x_0$. This root must therefore have an even order so $$0\leq p(x)-\alpha^2=(x-x_0)^{2 d}q(x)$$ for some $d\geq 1$ and $q\in \mathbb{R}[x]$. Since $q\geq 0$ and $\deg(q)<\deg(p)$ we conclude by induction that $q$ is a sum of squares $$q=q_1^2+\ldots+q_m^2.$$ Then $$p = \alpha^2+\left((x-x_0)^dq_1\right)^2+\ldots+\left((x-x_0)^dq_m\right)^2$$ is itself a sum of squares.

Induct on $\deg p$. We assume $p\ge 0$. See if $p$ has all real roots with even multiplicities, since $p\ge 0$. Rest of its roots are complex. Now this is trivial since product of two polynomial which can be written as sum of squares, is another polynomial which can be written as sum of squares. See $p$ is products of various polynomials of the form $(x-\alpha)^2$ and $(x-\alpha-i\beta)(x-\alpha+i\beta)=(x-\alpha)^2+\beta^2$ thus $p$ itself is sum of squares of polynomials. Thus done. Note our assumption proves a stronger claim. And the leading term is also positive which can be assigned to some of the factors and the claim is still true.