Control $$\dot x = -x -u$$ from $x(0)=1$ to $x(2)$ such that $$J= -2x^2(2) + \int_0^2 x+x^2+3xu+u^2 \:dt$$ is minimized.
I'm stuck because I don't know what to do about this term, $-2x^2(2)$. How can I apply the Pontryagin Maximum Principle (PMP)? Is there some way I can get this term under the integral? Also, the value of $x(2)$ is unspecified so can I just set $x(2)=a, \: a\in \mathbb{R}$?
attempt at $-2x^2(2)$ term
$ \displaystyle -2x^2(2)= -tx^2|_0^2=\int_0^2 (-tx^2)'\: dt = \int_0^2 -x^2-2tx\dot x\: dt$.
Then
\begin{align} J&= -2x^2(2) + \int_0^2 x+x^2+3xu+u^2 \:dt \\ &= \int_0^2 -x^2-2tx\dot x\: dt + \int_0^2 x+x^2+3xu+u^2 \:dt \\ &= \int_0^2 -x^2-2tx\dot x + x+x^2+3xu+u^2 \:dt \end{align}
Am I on the right track?