Solution verification for finding an extremal under constraints Find the extremal of $\int_0^1 \left[\dot{x}^2 + 2x\dot{x} + 2x\right] dt$ with $x(0)=0$, and $x(1)=\frac12$ subject to the constraint $\int_0^1 12tx dt=24$
Could anyone verify the anwer to this?
I have obtained $x=-\frac{9t^3}{16}+\frac{t^2}{2}+\frac{9t}{16}$
Thank you.
 A: Define the functionals
$$F(t,x,\dot{x})= \dot{x}^2 + 2x\dot{x} + 2x,\\G(t,x,\dot{x})= xt$$
An extremal satisfies the (constrained) Euler-Lagrange equation
$$F_x - \frac{d}{dt}F_{\dot{x}} + \lambda\left(G_x - \frac{d}{dt}G_{\dot{x}}\right)=0.$$
This reduces to 
$$x''= 1 +\frac{\lambda}{2}t,$$
with general solution
$$x = C_1 + C_2t + \frac1{2}t^2 + \frac{\lambda}{12}t^3.$$
Applying the boundary conditions
$$x = \frac{\lambda}{12}(t^3-t) + \frac1{2}t^2$$
Applying the constraint
$$2 = \int_0^1 t\left[\frac{\lambda}{12}(t^3-t) + \frac1{2}t^2\right]dt=\frac{\lambda}{12}\left(\frac1{5}-\frac1{3}\right)+ \frac1{8}$$
and 
$$\frac{\lambda}{12} = \frac{-225}{16}.$$
The extremal is 
$$x = -\frac{225}{16}(t^3-t) + \frac1{2}t^2$$
A: $$L = \dot{x}^2+2x\dot{x}+2x + 12tx\lambda$$
$$\frac{\partial L}{\partial x} - \frac{d}{dt}\left[\frac{\partial L}{\partial \dot{x}}\right]=0$$
$$2\dot{x}+2+12t\lambda-\frac{d}{dt}\left[2\dot{x}+2x\right]=0$$
$$2\dot{x}+2+12t\lambda-2\ddot{x} -2\dot{x}=0$$
$$\ddot{x}=1 + 6t\lambda$$
$$\dot{x}=t+3t^2\lambda +C$$
$$x=\frac{t^2}{2}+t^3\lambda + Ct+D$$
$$0=D$$
$$\frac12=\frac12+\lambda+C$$
$$\lambda=-C$$
$$\int_0^1 12tx dt=24$$
$$\int_0^1 12t(\frac{t^2}{2}+t^3\lambda + Ct)dt=24$$
$$\int_0^1\frac{12t^3}{2}+12t^4\lambda + 12Ct^2dt=12$$
$$\left[\frac{3t^4}{2}+\frac{12t^5\lambda}{5} + 4Ct^3\right]_0^1=24$$
$$\frac32+\frac{12\lambda}{5}+4C=24$$
$$\frac32+\frac{12}5\lambda - 4\lambda = 24$$
$$\frac{-8\lambda}{5}=22.5$$
$$\lambda = -\frac{225}{16}$$
$$C=\frac{225}{16}$$
$$x=\frac{t^2}{2}-\frac{225t^3}{16} +\frac{225t}{16}$$
