# Thread: Extremal - Is my solution correct?

1. ## Extremal - Is my solution correct?

Hi,
This is my first post here, and I was wondering if someone could see something wrong with my answer to the following question.

Find the extremal for $\displaystyle \ \int_0^T (\dot{x}^2 + 2x \dot{x}) \ dt$ when $x(0) = 1$ and $T = 2$ i.e. $x(2)$ free)

My Solution (sorry, it goes for a while )

Let $\displaystyle \ f(t, x, \dot{x}) = \dot{x}^2 + 2x \dot{x}$ . Then the Euler-Lagrange equation is $\displaystyle \ \frac{\partial f}{\partial x} - \frac{d}{dx} \Big( \frac{\partial f}{\partial \dot{x}} \Big) = 0$

which implies $\displaystyle \ 2 \dot{x} - \frac{d}{dx} \Big( 2 \dot{x} + 2x \Big) = 0$

$\displaystyle \ \therefore \ 2 \dot{x} - \ddot{x} + 2 \dot{x} = 0$

$\displaystyle \ \therefore \ 2 \ddot{x} - 4 \dot{x} = 0$ which has general solution $x = A + Be^{2t}$.

Now using the endpoint conditions $x(0) = 1 = A + B \ \Rightarrow \ B = 1 - A$

Transversality Condition $\Rightarrow$

$\displaystyle \frac{\partial f}{\partial \dot{x}} (T) = 0 \ \Rightarrow \frac{\partial f}{\partial \dot{x}} (2) = 0$

$\displaystyle \therefore \ 2 \dot{x} (2) + 2x(2) = 0$

Recall that $x = A + Be^{2t}$ so $\dot{x} = At + \frac{1}{2} Be^{2t}$

$\displaystyle \ 2A + Be^2 + 2A + 2Be^2 = 0$

$\displaystyle 4A + 3Be^2 = 0$

Sub in $\displaystyle B = 1 - A$

$\displaystyle 4A + 3(1-A)e^2 = 0$

$\displaystyle 4A + 3e^2 - 3Ae^2 = 0$

$\displaystyle A(4 - 3e^2) = -3e^2$

$\displaystyle \therefore \ A = \frac{-3e^2}{4 - 3e^2}$

Now $B = 1 - A$ so $\displaystyle B = \frac{-4}{-4 + 3e^2}$

Therefore the extremal is

$\displaystyle x = -3\,{\frac {{{\rm e}^{2}}}{4-3\,{{\rm e}^{2}}}}-4\,{\frac {{{\rm e}^{2
\,t}}}{-4+3\,{{\rm e}^{2}}}}
$

$\displaystyle = {\frac {3\,{{\rm e}^{2}}-4\,{{\rm e}^{2\,t}}}{-4+3\,{{\rm e}^{2}}}}$

Have I done this correctly?
Thank-you

2. Originally Posted by OliviaB
Let $\displaystyle \ f(t, x, \dot{x}) = \dot{x}^2 + 2x \dot{x}$ . Then the Euler-Lagrange equation is $\displaystyle \ \frac{\partial f}{\partial x} - \frac{d}{dx} \Big( \frac{\partial f}{\partial \dot{x}} \Big) = 0$ Should be d/dt, not d/dx.

which implies $\displaystyle \ 2 \dot{x} - \frac{d}{dx} \Big( 2 \dot{x} + 2x \Big) = 0$

$\displaystyle \ \therefore \ 2 \dot{x} - \ddot{x} + 2 \dot{x} = 0$ Middle coefficient is –2, not –1 (corrected in following line).

$\displaystyle \ \therefore \ 2 \ddot{x} - 4 \dot{x} = 0$ which has general solution $x = A + Be^{2t}$.

Now using the endpoint conditions $x(0) = 1 = A + B \ \Rightarrow \ B = 1 - A$

Transversality Condition $\Rightarrow$

$\displaystyle \frac{\partial f}{\partial \dot{x}} (T) = 0 \ \Rightarrow \frac{\partial f}{\partial \dot{x}} (2) = 0$

$\displaystyle \therefore \ 2 \dot{x} (2) + 2x(2) = 0$

Recall that $x = A + Be^{2t}$ so $\dot{x} = At + \frac{1}{2} Be^{2t}$ You should be differentiating x, not integrating it !
From that point on, the calculation will need amending. But the method looks correct.

3. Originally Posted by OliviaB
Hi,

. Then the Euler-Lagrange equation is $\displaystyle \ \frac{\partial f}{\partial x} - \frac{d}{dt} \Big( \frac{\partial f}{\partial \dot{x}} \Big) = 0$ Should be d/dt, not d/dx.
Thanks - typo

Recall that $x = A + Be^{2t}$ so $\dot{x} = At + \frac{1}{2} Be^{2t}$ -You should be differentiating x, not integrating it !
Ahh, thank-you.

So here is what I have now:

Recall that $x = A + Be^{2t}$ so $\dot{x} = 2B e^{2t}$

$\displaystyle 4Be^4 + 2A + 2Be^4 = 0$

$\displaystyle \therefore \ 2A + 6Be^4 = 0$

Sub in $\displaystyle B = 1$

$\displaystyle 4A + 6(1-A)e^4 = 0$

$\displaystyle 4A + 6e^4 - 6Ae^4 = 0$

$\displaystyle A(4 - 6e^4) = -6e^4$

$\displaystyle \therefore \ A = \frac{-6e^4}{4 - 6e^4}$

Now $B = 1 - A$ so $\displaystyle \ \frac{-2}{-2 + 3e^4}$

So the extremal is

$\displaystyle x = -6\,{\frac {{{\rm e}^{4}}}{4-6\,{{\rm e}^{4}}}}+2\,{\frac {{{\rm e}^{2
\,t}}}{-2+3\,{{\rm e}^{4}}}}
$

or $\displaystyle x = {\frac {3\,{{\rm e}^{4}}+2\,{{\rm e}^{2\,t}}}{-2+3\,{{\rm e}^{4}}}}$

4. Originally Posted by OliviaB
$\displaystyle \therefore \ 2A + 6Be^4 = 0$

Sub in $\displaystyle B = 1$ – A (corrected in next line)

$\displaystyle 4A + 6(1-A)e^4 = 0$ Should be 2A, not 4A. Better still, divide through by 2 and use the equation A + 3(1–A)e^4 = 0.
I think the moral here is that you should always check your work carefully before submitting it.

5. Sorry, this equation gives
$\displaystyle \ 2 \dot{x} - \frac{d}{dt} \Big( 2 \dot{x} + 2x \Big) = 0$

$2x'-2x''-2x'=0$

$x''=0$

6. Originally Posted by Opalg
I think the moral here is that you should always check your work carefully before submitting it.
Originally Posted by zzzoak
Sorry, this equation gives
$\displaystyle \ 2 \dot{x} - \frac{d}{dt} \Big( 2 \dot{x} + 2x \Big) = 0$

$2x'-2x''-2x'=0$

$x''=0$
That makes two if us who don't check things carefully enough.

7. Originally Posted by Opalg
I think the moral here is that you should always check your work carefully before submitting it.
Yes, I agree.

Now with $\ddot{x} = 0$

we have the general solution $x = At + B$

Applying endpoint conditions

$x(0) = 1 = B = 1$

After applying the transversality condition and seeing that $x = At + B$ so $\dot{x} = A$ we have

$2A + 4A + 2B = 0$

$6A + 2B = 0$

Sub in $B = 1$ and we get $A = \frac{-1}{3}$

so the extremal is $x = \frac{-t}{3} + 1$