I've been looking for a proof of Wirtinger's Inequality that does not use Fourier Analysis (I have not learned Fourier Analysis yet). I found a proof online that I don't quite understand. I'll sketch out the details below.
Theorem: Let $f(x):[0,\pi] \to \mathbb{R}$ be a $C^1$ function. If $f(0)=0$ and $f(\pi)=0$, then $\displaystyle\int_0^{\pi} f'(t)^2dt\geq\int_0^{\pi}f(t)^2dt$.
Proof: Consider $g(t)=\displaystyle \frac{f(t)}{\sin(t)}$.
We notice that $g(t)$ is differentiable at the end points by L'Hopital's Rule. So we have $f'(t)=g(t)\cos(t)+g'(t)\sin(t)$.
Thus, $$\int_0^\pi f'(t)^2dt=\int_0^\pi\left[ g(t)^2\cos^2+2g(t)g'(t)\cos(t)\sin(t)+g'(t)^2\sin^2(t)\right]dt$$
Using Integration by parts, we have $$2\int_0^{\pi}g(t)g'(t)\cos(t)\sin(t)dt=-\int_0^\pi g(t)^2\left(\cos(t)^2-\sin(t)^2\right)dt$$
Ergo \begin{align} \int_0^\pi f'(t)^2dt &= \left(g(t)^2+g'(t)^2\right)\sin(t)^2dt\\ &=\int_0^{\pi}f(t)^2dt+\int_0^\pi g'(t)^2\sin^2(t)dt\\ &\geq \int_0^{\pi}f(t)^2dt \end{align}
Equality is only achieved when $f(t)=c\sin(t+d)$ for some constants $c$ and $d$.
There are two parts of this proof I don't get. First, how can we derive that $g(t)$ is differentiable at the endpoints using l'Hopital's Rule, and why is it necessary?
Second, I don't understand the intermediate step using integration by parts. I was only able to get that $$2\int_0^{\pi}g(t)g'(t)\cos(t)\sin(t)dt=g(t)^2\sin(t)\cos(t)\Big|_0^{\pi}-\int_0^\pi g(t)^2\left(\cos(t)^2-\sin(t)^2\right)$$
If anyone could explain this proof for me, or provide another one that does not use Fourier Analysis, I would greatly appreciate it.