TITLE: Proof of an integral inequality of polynomials
QUESTION [8 upvotes]: Let $f$ be a polynomial with degree $n$, also
$$\int_{0}^1 f(x)x^kdx=0,k=1,2, \cdots ,n$$
Prove that 
$$\int_0^1 f^2(x)dx=(n+1)^2\left(\int_0^1 f(x) dx\right)^2$$
My first step is to subtract zero from the left of the equation. 
$$\begin{aligned}
\int_0^1 f^2(x)dx&=\int_0^1 f^2(x)dx-\sum_{k=1}^n\int_0^1 a_k x^k f(x)dx\\
&=\int_0^1 f(x)\left(f(x)-\sum_{k=1}^n a_k x^k\right)dx\\
&=a_0 \int_0^1f(x)dx
\end{aligned}$$
Then 
$$a_0=(n+1)^2\left(\int_0^1 f(x) dx\right)\quad\text{or}\quad \int_0^1 f(x) dx=0$$
I doubt that this is not true because the integral of an arbitrary polynomial is a constant only related to $a_0$. But this is possible. Could you show a better idea and give a proof? Thanks.

REPLY [5 votes]: I definitely don't have a pretty/elegant proof, but here's a proof nonetheless.
Write $f(x)=a_nx^n+\dots+a_1x+a_0$. We have
$$
f^2(x)=f(x)\sum_{k=0}^na_kx^k=\sum_{k=0}^n a_kf(x)x^k,
$$
so,
$$
\int_0^1 f^2(x)dx=a_0\int_0^1 f(x)dx.
$$
Hence, it suffices to show that $a_0=(n+1)^2\int_0^1 f(x)dx$. First note that $\int_0^1 f(x)x^\ell dx=\sum_{k=0}^n{a_k\over k+\ell+1}$. By assumption, we know that $\sum_{k=0}^n{a_k\over k+\ell+1}=0$ for all $\ell\in\{1,\dots,n\}$ and we want to show that $a_0=(n+1)^2\sum_{k=0}^n{a_k\over k+1}$.
Consider the $(n+1)\times(n+1)$ matrix $H$ defined by $H_{i,j}={1\over i+j-1}$; this is known as the Hilbert matrix. Notice that
$$
\left[\begin{matrix}
\sum_{k=0}^n{a_k\over k+1}\\
\sum_{k=0}^n{a_k\over k+2}\\
\vdots\\
\sum_{k=0}^n{a_k\over k+n+1}
\end{matrix}
\right]=H\left[\begin{matrix}
a_0\\
a_1\\
\vdots\\
a_n
\end{matrix}\right].
$$
Now, it's known that 
$$
(H^{-1})_{i,j}=(-1)^{i+j}(i+j-1){n+i\choose n+1-j}{n+j\choose n+1-i}{i+j-2\choose i-1}^2
$$
(see the wikipedia page https://en.wikipedia.org/wiki/Hilbert_matrix). Thus, by assumption,
$$
\left[\begin{matrix}
a_0\\
a_1\\
\vdots\\
a_n
\end{matrix}\right]
=H^{-1}\left[\begin{matrix}
\sum_{k=0}^n{a_k\over k+1}\\
0\\
\vdots\\
0
\end{matrix}\right],
$$
and by looking at the first row of this equation, we find
$$
a_0=(H^{-1})_{1,1}\sum_{k=0}^n{a_k\over k+1}=(n+1)^2\sum_{k=0}^n{a_k\over k+1}.
$$
I'd be interested in seeing a nicer proof if anyone has one!