# Calculus of Variations - Function of y and y' only

I have the following problem:

$\int^\pi_0 (4y^2-y'^2)dx$

which satisfies: $y=1$ on $x=0$ and $y'=0$ on $x=\pi$.

I am to show that the solution is $y=cos(2x)$.

Now, I first realised that the integrand is a function of $y$ and $y'$ only, so the usual Euler-Lagrange equation can be written as (where f is the integrand):

$f-y'\dfrac{\partial f}{\partial y'} = c_1$

(follows from $\dfrac{\partial f}{\partial y} - \dfrac{d}{dx} \dfrac{\partial f}{\partial y'} = 0$).

Now, if I substitute the terms in, this gives me:

$\dfrac{dy}{dx} = \sqrt{c_1-4y^2}$

Which, after separation of variables, gives me:

$\dfrac{\sin^{-1}(2y/\sqrt{c_1})}{2} = x + c_2$

Now, solving this with the given initial conditions gives me $y=1$, not $y=cos(2x)$.

Anyone able to point me in the right direction here?

$$y = \frac{\sqrt{c_1}}{2}\sin(2(x + c_2))$$
The two conditions $f(0) = 1$, $f'(\pi) = 0$ imply $$\frac{\sqrt{c_1}}{2}\sin(2c_2) = 1 \ \ \ \ \ \ \ \ \ \ \ \ -- (1)$$ $$\sqrt{c_1}\cos(2\pi + 2c_2) = \sqrt{c_1}\cos(2c_2) = 0 \ \ \ \ -- (2)$$
One solution for $c_2$ from $(2)$ is $c_2 = \pi/4$ and then from $(1)$, $c_1 = 4$. Thus
$$y = \sin(2x + 2c_2) = \sin(2x + \pi/2) = \cos(2x)$$