Question at hand is:
Let $y\in\cal C^2([0,\pi])$ satisfying $y(0)=y(\pi)=0$ and $\int_0^\pi y^2(x)dx=1$ extremize the functional $$J(y)=\int_0^\pi\left(y'(x)\right)^2dx$$
It's an MCQ, and from options using initial conditions, I could easily infer that solutions are $y(x)=\pm\sqrt{2\over\pi}\sin x$ (the other two wrong options being $y(x)=\pm\sqrt{2\over\pi}\cos x$.
But Euler-Lagrange (only method I know to find extremals of functionals) leads me to $2y''(x)=0$. What am I missing/how to solve it directly?
Since $C^2(0,\pi)\subset L^2(0,\pi)$, we may assume that $$ y(x) = \sum_{n\geq 1} a_n \sin(nx) \tag{1}$$ holds, with the constraint $\sum_{n\geq 1}a_n^2 = \frac{2}{\pi}$ given by Parseval's theorem. It also gives: $$ \int_{0}^{\pi}y'(x)^2\,dx = \frac{\pi}{2}\sum_{n\geq 1}n^2 a_n^2\color{red}{\geq} \frac{\pi}{2}\sum_{n\geq 1}a_n^2 = 1\tag{2} $$ and equality holds iff $a_n=0$ for every $n\geq 2$, so the only extremal functions are $\color{red}{\pm\sqrt{\frac{2}{\pi}}\sin(x)}$.
This is just an instance of Wirtinger's inequality.