The system where is not subject to any constraint, is to be controlled from to where is unspecified in such a way that

is minimized. Find the optimal control.

I have a solution, is there anyone who could check it and see if I have gone wrong somewhere?

Let

Let

Then where

The co-state equation is

By pmp, maximizes as a function of

The optimal trajectory is

and

which has general solution

Using the endpoint conditions

,

Therefore

Then, recalling that

We have

(recalling from above that from above)