Using Cauchy's integral theorem to prove a inequality I am trying to solve this question:  
Let $f(z) = c_0 + c_1z + \ldots + c_nz^n$ be a polynomial. If the $c_k$'s are real, show that   $$\int_{-1}^1 f(x)^2 dx \le \pi \int_0^{2\pi} \left | f(e^{i\theta})\right |^2 \frac{d\theta}{2\pi} = \pi\sum_{k=0}^n\left | c_k\right |^2\ .$$
$Hint.$ For the first inequality, apply Cauchy's theorem to the function $f(z)^2$ separately on the top half and the bottom half of the unit disk.
I have taken the top half of the unit disk to be the domain $D$ as given in the hint.
Since $f(z)^2$ is analytic in $D$, by Cauchy's integral theorem, $\int_{\partial D}f(z)dz = 0$.
I can't understand how to proceed from here. Can I break the integral into the sum of the integrals along the semicircle, $|Z| = 1 $ and $Im(Z) \gt 0$, and along the straight line, $-1 \lt Re(Z) \lt 1$ and $Im(Z) = 0$?
 A: The boundary of $D$ has two parts, the line from $-1$ to $1$ and the upper circlar path $\gamma$. So 
$$0 = \int _{\partial D} f^2(z) dz = \int_{-1}^1 f(z)^2 dz + \int_\gamma f^2(z) dz,$$
hence we have
$$\int_{-1}^1 f(z)^2 dz  = - \int_\gamma f^2(z) dz..$$
To calculate the right hand side, we use the parametrization $\gamma(t) = e^{it}$, where $t\in [0,\pi]$. Then 
$$\int_\gamma f^2(z) dz = \int_0^{\pi} f^2(e^{it}) ie^{it} dt.$$
So we have 
$$\left| \int_{-1}^1f^2(x) dx\right| = \left| \int_0^\pi f^2 (e^{it}) i e^{it} dt\right| \le \int_0^\pi |f(e^{it})|^2 dt$$
Similarly, you can use the lower half of the unit disk $\tilde D$. Exactly the same argument gives 
$$\left| \int_{-1}^1f^2(x) dx\right| \le \int_\pi^{2\pi} |f(e^{it})|^2 dt$$
So adding the two inequalities and divide by 2 gives you the first inequality. 
Now use $f(z) = c_0 + c_1 z + \cdots + c_nz^n$ and $|f(e^{it})|^2 = f(e^{it}) \overline{f(e^{it})}$, one can show 
$$\frac 12 \int_0^{2\pi} \left | f(e^{i\theta})\right |^2 d\theta = \pi\sum_{k=0}^n\left | c_k\right |^2 $$  
As all the cross terms $c_i \overline c_j e^{(i-j)t}$, $i\neq j$ integrate to $0$. 
