I have to minimize the functional
$$J[y] =\int_0^\pi y' ^2 - ky^2 dx$$
subject to $y(0)=y(\pi)=0$. The parameter $k$ is positive. Writing down the Euler-Lagrange equation, I have:
$$y'' +ky =0,$$
which implies $y=A\cos\sqrt{k}x + B\sin\sqrt{k}x $. However, imposing the boundary conditions gives first of all $A=0$, and then $B$ arbitrary, given that $\sqrt{k} \in \mathbb{Z}$, otherwise no solution. Thus $k=m^2$ for $m \in \mathbb{N}$.
Ultimately, the solutions are
$$y_m = B\sin mx$$
Since I want to find the minimal value of the functional, I substitute into the integral:
$$J[y_m]=\int_0^\pi B^2 m^2 \cos (2mx) \ dx = 0.$$
Is this solution correct?