Given a polynomial of degree $2n$ over $\mathbb{Q}$, how to represent it as a linear combination (with rational coefficients) of squares of polynomials of degree at most $n$ over $\mathbb{Q}$ such that the number of polynomials is minimal?


In particular, when it is possible to represent a given polynomial of degree $2n$ as a linear combination of two squares of polynomials of degree at most $n$?



Minimal representation of a polynomial as a linear combination of squares
Ok, here's how to write a polynomial $f$ of degree $2n$ as a linear combination of three squares. We can assume $f$ is monic, since everything can be scaled at the end. Now, complete squares, starting from the top degree term. So we can write $f = g^2 + h$, where $g$ is monic of degree $n$, and $h$ has degree at most $n-1$. Then write $h = \frac{1}{4}(h+1)^2 - \frac{1}{4}(h-1)^2$ to finish it off. Three squares is optimal: a little bit of work shows that $x^4 + x + 1$ cannot be written as a linear combination of two squares (the same holds for a generic quartic polynomial). I guess this doesn't fully answer your second question of how to characterize linear combinations of two squares of degree $n$.


