I am trying to show that $\int_0^\pi(y')^2dx$ with $y(0) = 0$, $y(\pi) = 0$ has infinitely many extremals subject to the constraint $\int_0^\pi y^2 dx = \pi/2$.
I know that the first-order necessary condition for constrained optimality is that if $y$ is an extremum, then it should satisfy Euler–Lagrange for $\lambda_0^*(y')^2 + \lambda^* y^2$, where $\lambda_0^*$ and $\lambda^*$ are both nonzero constants.
Letting $z = y'$ temporarily, we need $y$ to satisfy $N(y, z) = \lambda_0^* z^2 + \lambda^* y^2$. Using the Beltrami identity, this gets us $N_z(y, z) \cdot z - N(y, z) = c$; since $N_z(y, z) = 2\lambda_0^* z$, the Euler-Lagrange equation becomes $2 \lambda_0^* z^2 - \lambda_0^* z^2 - \lambda^* y^2 = 0$, which is $\lambda_0^* z^2 - \lambda^* y^2 = 0$.
So we are faced with the differential equation $\lambda_0^* (y'(x))^2 = \lambda^* (y(x))^2$, whose solutions all seem to be of the form $y(x) = c_1 \cdot e^{\pm \sqrt{\frac{\lambda^*}{\lambda_0^*}} \cdot x}$.
However, this is clearly wrong—if $y(0) = 0$, then $c_1 = 0$, so $y(x) = 0$, but then $\int_0^\pi y^2 = 0 \neq \pi/2$.
Could I have a hint as to what went wrong in my solution?
The correct Lagrangian functional should always take the form
$$L = \text{objective} - \vec{\lambda}\cdot \text{constraints}$$
where a constraint functional (or functionals) will always take the form $g(x,y,y') = 0$. In this case the appropriate Lagrangian would be
$$L = \int_0^{\pi}(y')^2-\lambda\left(y^2-\frac{1}{2}\right)\:dx$$
Then we can either derive or use the Euler-Lagrange equations directly
$$\frac{d}{dx}\frac{\partial L}{\partial y'} - \frac{\partial L}{\partial y} = 2y''+2\lambda y = 0$$
Taking into account the $y(0)=0$ boundary condition, the solution will always be
$$y(x) = A\sinh(x\sqrt{\lambda})$$
However, the $y(\pi)=0$ boundary condition can only be met when $\lambda<0$. In other words there are infinite extrema when the Lagrange multiplier is
$$\lambda = -n^2 \hspace{20 pt}n\in\Bbb{Z}^+$$
with $A=\pm i$, or written more normally as
$$y(x) = \pm\sin(n x)$$