A variational optimal control problem Steer the system $\dot{x}(t)=u(t)$ from $x(0)$ to $x(1)$ and minimize $$\int_0^1 x^2+u^2 \, \mathrm{d}t$$
The problem i'm having is to find the boundary values because i feel enough information is not given. i got a diff eq $\ddot{\lambda }(t)=\lambda$ but forming hamiltonian and doing other calculations, but how to find say $\lambda_1(0),\lambda_2(0)$ ? i'm confused about it. 
 A: A straightforward calculus of variations approach using a test function $\eta$ with $\eta(0) = \eta(1) = 0$ yields
$$0 = \left.\frac{d}{d\epsilon}\right|_{\epsilon=0}\int_0^1(x+\epsilon\eta)^2 + (\dot{x}+\epsilon\dot{\eta})^2dt = \int_0^12x\eta+2\dot{x}\dot{\eta}dt = \int_0^12x\eta-2\ddot{x}\eta dt$$
where the last equality uses integration by parts and the fact that $\eta(0)=\eta(1) = 0$. Therefore, $\int_0^12\eta(x-\ddot{x})dt = 0$ for any test function $\eta$, and so $\ddot{x} = x$ on the interval [0,1]. Both $e^t$ and $e^{-t}$ are solutions to this differential equation, so the general solution is given by $x(t) = ae^{t}+be^{-t}$ for some constants $a, b$. Our boundary values tell us that $x(0) = a+b$ and that $x(1) = ae+be^{-1}$, so solving this linear system for $a$ and $b$ yields  $a = \frac{ex(1)-x(0)}{e^2-1}, b= \frac{e^2x(0)-ex(1)}{e^2-1}$ and therefore 
$$ x(t) = \frac{x(0)\cdot(e^{2-t}-e^t) + x(1)\cdot(e^{1+t}-e^{1-t})}{e^2-1} $$
is the specific solution for the given boundary values.
