TITLE: Proof of Wirtinger inequality
QUESTION [20 upvotes]: Quoting from Ana Cannas da Silva's book on Symplectic Geometry:
"As an exercise in Fourier series, show the Wirtinger inequality: for $f\in C^1([a,b])$, with $f(a)=f(b)=0$ we have
$$
\int_a^b\Big|\frac{\mathrm{d}f}{\mathrm{d}t}\Big|^2\mathrm{d}t \ge\frac{\pi^2}{(b-a)^2} \int_a^b\left|\ f\right|^2\mathrm{d}t."
$$
I already found a few questions about this topic in the site, but I couldn't actually grasp what's happening here. Also, I would very much like you to show me where I go wrong with my try, which is sketched below.
I know that, for $f\in \mathcal{L}^2([0,2\pi])\supset C^1([0,2\pi])$, I can expand:
$$
f(t)=\sum_{n=-\infty}^{+\infty}c_n e^{int},\ \ \ c_n=\frac{1}{2\pi}\int_0^{2\pi}\mathrm{d}t\ e^{-int}f(t).
$$
Rescaling  $t \to \omega (t - a)$, where $\omega = 2\pi/(b-a)$, we can get a more general form for $f\in C([a,b])$:
$$
f(t)=\sum_{n=-\infty}^{+\infty}c_n e^{in\omega t},\ \ \ c_n=\frac{1}{b-a}\int_a^{b}\mathrm{d}t\ e^{-in\omega t}f(t).
$$
Now, having:
$$
\frac{\mathrm{d}}{\mathrm{d}t}f(t) = \sum_{n=-\infty}^{+\infty}\tilde{c}_ne^{i\omega nt},\ \ \tilde{c}_n=\frac{1}{b-a}\int_a^b\mathrm{d}t\ e^{-i\omega nt}\frac{\mathrm{d}}{\mathrm{d}t}f(t).
$$
Using the fact that $\,f(a)=f(b)=0$ we get:
$$
\tilde{c}_0 = \frac{1}{b-a}\int_a^b\mathrm{d}t \frac{\mathrm{d}}{\mathrm{d}t}
f(t) = \frac{f(b)-f(a)}{b-a} =0 \longrightarrow 
\frac{\mathrm{d}}{\mathrm{d}t}f(t) = 
\sum_{n\in\mathbb Z\setminus\{0\}}\tilde{c}_n e^{i\omega nt}
$$
Now deriving the series expansion of $f$ yields:
$$
\frac{\mathrm{d}}{\mathrm{d}t}f(t) = \frac{\mathrm{d}}{\mathrm{d}t} \sum_{n=-\infty}^{+\infty}c_n e^{in\omega t} = \sum_{n=-\infty}^{+\infty}(in\omega)c_n e^{in\omega t}=\sum_{n\in\mathbb Z\setminus\{0\}}(in\omega)c_n e^{in\omega t}
$$
Comparing the two expressions we establish: $\tilde{c}_n = i\omega n c_n$, for $n\not= 0$. Parseval's Equality reads here for $\mathrm{d}f/\mathrm{d}t$:
$$
\int_a^b\left|\frac{\mathrm{d}f}{\mathrm{d}t}\right|^2\mathrm{d}t=
\sum_{n\in\mathbb Z\setminus\{0\}}  |\tilde{c_n}|^2 = 
\omega^2\sum_{n\in\mathbb Z\setminus\{0\}} n^2 |c_n|^2 \ge
\omega^2\sum_{n\in\mathbb Z\setminus\{0\}}  |c_n|^2 = 
\omega^2 \left(\int_a^b\mathrm{d}t\left|f(t)\right|^2-|c_0|^2\right)
$$
where in the last passage we used Parseval's Equality for $f$: $\int_a^b|f|^2\mathrm{d}t=\sum_{n=-\infty}^{+\infty}|c_n|^2$.
We are now left with finding a suitable way of estimating $|c_0|^2$:
$$
|c_0|^2 = \left|\frac{1}{b-a}\int_a^b\mathrm{d}t\ f(t)\right|^2,
$$ thus
$$
\int_a^b\left|\frac{\mathrm{d}f}{\mathrm{d}t}\right|^2\mathrm{d}t \ge \frac{4\pi^2}{(b-a)^2}\left(\int_a^b\left|f\right|^2\mathrm{d}t - \frac{1}{(b-a)^2}\left|\int_a^bf\mathrm{d}t\right|^2\right).
$$
Which is not exactly what I wanted.
Please lend me a hand!

REPLY [13 votes]: The standard Wirtinger's inequality requires that $\int_a^b f\,dx=0$, which implies that $c_0=0$, and hence the difficulty you are encounter does not exist.
If instead we assume that $f(a)=f(b)=0$, then we exploit this by expanding $f$ in a sine series, i.e., for $a=0$ and $b=\pi$, 
$$
f(x)=\sum_{n=1}^\infty a_n\sin nx,
$$
and hence
$$
\int_0^\pi f^2= \frac{\pi}{2}\sum_{n=1}^\infty a_n^2
\qquad
\text{while}
\qquad
\int_0^\pi (f')^2= \frac{\pi}{2}\sum_{n=1}^\infty n^2a_n^2,
$$
and therefore
$$
\int_0^\pi (f')^2\ge \int_0^\pi f^2,
$$
with best constant $c=1$.
For arbitrary $b>a$,
$$
f(x)=\sum_{n=1}^\infty a_n\sin \left(\frac{n\pi(x-a)}{b-a}\right),
$$
and hence
$$
\int_a^b\!\! f^2= \frac{b-a}{2}\sum_{n=1}^\infty a_n^2
\quad
\text{while}
\quad
\int_a^b\!\! (f')^2= \frac{b-a}{2}\sum_{n=1}^\infty \left(\frac{\pi}{b-a}\right)^2n^2a_n^2,
$$
and hence
$$
\int_a^b\! (f')^2\ge \frac{\pi^2}{(b-a)^2}\int_0^\pi f^2.
$$