Euler lagrange equation solving Find the Euler-Lagrange equation for the functional
$$I(y) = \int_0^1(py\,'\,^2-qy^2)\mathrm dx$$
subject to the constraint
$$\int_0^1ry^2 = 1.$$
Answer: $\frac{d}{dx}(py') + (q-\lambda r)y = 0$.
Can anyone answer this question? I tried but the answer does not come correct.

First, stick the constraint into the objective using a Lagrange multiplier $\lambda$:
$$\min_{y,\lambda} \int_0^1 (py'^2-qy^2)\,dx + \lambda\left(\int_0^1 ry^2dx-1\right).$$
Now take variations with respect to $y$. You get
$$0 = \int_0^1 2py'\delta y' -2qy\delta y +2\lambda r y \delta y\, dx = \int_0^1 2py'\delta y'\,dx + \int_0^1 2y(-q+r\lambda)\,dx.$$
You now integrate the first term by parts:
$$0 = 2p(y'(1)\delta y(1)-y'(0)\delta y(0)) + \int_0^1 \left(-2(py')' + 2y(r\lambda - q)\right)\,dx$$
and assuming appropriate boundary conditions on $y$ (such as fixed endpoints) you recover your expected solution.
