The problem is:
let $p(x)$ be a polynomial with real Coefficients that is non-negative for all $x$. Prove that for some $k$, there are polynomials $f_1 (x),\cdots f_k (x)$ such that $p(x)=\sum_{i=0}^k (f_i (x))^2$.
I have tried a lot but don't able to make any substantial progress so that I can state it, I will be happy if anyone help how to approach this kind of problem or with any possible solutions. Thanks.
Edit : thanks to those who tried to help with this $i=2$ version but I don't able to convert it into solution so ask for further help or any references.
Since $P$ is positive, all its real roots have an even multiplicity.
So we can write $P = \prod (X-\gamma_i)(X-\overline{\gamma_i}) \prod (X-x_k)^2$, where the $\gamma_i$ are the complex roots, and the $x_k$ the real (eventually equal).
Then if we call $A = \prod (X-\gamma_i)$, we have $\overline{A} = \prod (X-\overline{\gamma_i})$. So that if we note $C = \prod (X-x_k)$, we have $$ P = AB\cdot \overline{A}B$$
Since $B$ is a real polynomial, $B=\overline{B}$.
So $P=AB\cdot\overline{AB}$.
If we note $AB = R+iQ$ with $R$ and $Q$ real polynomials, we have : $$P=R^2 + Q^2$$
So for the exercise, we can notice that $k=1$ or $2$.