Basic example of system controllability Ok so I'm having a tough time understanding an example in my book, there is a great deal of hand-waving and I'm having a hard time following. I'd like to see the example worked out if possible, with some explanation.
$ i) $ Given the harmonic oscillator system ( $ \Sigma $ ), where
$ \dot{\bar{x}}_1 = x_2 $
$ \dot{x}_2 = -x_1 + u $
does there exist a control $ u $ that can transfer the system from $ \begin{bmatrix} x_1(0) \\ x_2(0) \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix} $ to the origin $ \begin{bmatrix} 0 \\ 0 \end{bmatrix} $ in $ 2\pi $ units of time? If yes, find $ u $, otherwise explain why not.
$ ii) $ Does there exist a feedback control law
$ u = \begin{cases} u_1 \space \space \space  0 \leq t \leq 2\pi  \\ u_2 \space \space \space {2\pi/3} \leq t \leq 4\pi/3  \\ u_3 \space \space \space 4\pi/3 \leq t \leq 2\pi \end{cases} $
so that $ \Sigma $ can be steered from $ \begin{bmatrix} 1 \\ 0 \end{bmatrix} $ to the state $ \begin{bmatrix} 0 \\ 0 \end{bmatrix} $?
If yes, find $u_1, u_2, and \space  u_3 $, otherwise explain why not.
 A: First part of i) Rewrite the system in terms of matrices:
$$
x' = Ax + Bu
$$
$$A = \left(\begin{array}{cc} 0 & 1 \\ -1 & 0\end{array}\right), B = \left(\begin{array}{cc} 0 \\ 1\end{array}\right).$$
Controllability tests:
PBH Form the matrix $(sI - A \,\,\, B)$ and check that it has rank $2$ for all $s$. 
$$
(sI - A \,\,\, B) = \left(\begin{array}{cccc} s & -1 & 0\\ 1 & s & 1\end{array}\right)
$$
Further, you only have to check the case $s = $eigenvalue, since $sI - A$ is invertible (i.e. of rank $2$) for any other $s$. In this case, the eigenvalues are $i,-i$. Can you convince yourself that $(sI - A \,\,\, B)$ is rank $2$?
Gramian mx We want to see if the Gramian matrix has full rank:
$$
W_c = \int_0^{2\pi} \exp(At)BB^T\exp(A^Tt)\,dt
$$
Next, find the fundamental solution $\exp(At)$ of this system
$$
\exp(At) = \left(\begin{array}{cc} \cos(t) & \sin(t) \\ -\sin(t) & \cos(t)\end{array}\right)
$$
and observe $\exp(A^Tt) = \left(\exp(At)\right)^T$. Do all the matrix multiplication on the inside of the integral, and you should get
$$
\int_0^{2\pi} \left(\begin{array}{cc} \sin^2(t) & \sin(t)\cos(t) \\ \sin(t)\cos(t) & \cos^2(t) \end{array}\right) \,dt = \left(\begin{array}{cc} \pi & 0 \\ 0 & \pi\end{array}\right)
$$
which has full rank.
For the next part, I solved directly. The solution is
$$
x(t) = \exp(At)x^0 + \int_0^t \exp(-As)Bu(s)\,ds \\
=\left(\begin{array}{c} \cos(t) \\ -\sin(t)\end{array}\right) +  \int_0^{t} \left(\begin{array}{c} -\sin(s)u(s) \\ -\cos(s)u(s)\end{array}\right)\,ds
$$
To have $x(2\pi) = (0,0)^T$,
$$
\left(\begin{array}{c} 1 \\ 0\end{array}\right) =  \int_0^{2\pi} \left(\begin{array}{c} \sin(s)u(s) \\ \cos(s)u(s)\end{array}\right)\,ds \quad \quad (*)
$$
A $u$ that works is $u(t) = \dfrac{1}{\pi}\sin(t)$ (this occurred to me b/c of orthogonality of sine and cosine; there are other choices, I'm sure).
For the final part, you need to see if there's a piecewise constant $u$ that works in $(*)$ above. So one equation the constants will have to satisfy is
$$
1 = u_1 \int_0^{2\pi/3}\sin(s)\,ds + u_2 \int_{2\pi/3}^{4\pi/3} \sin(s)\,ds + u_3 \int_{4\pi/3}^{2\pi} \sin(s)\,ds
$$
and similarly
$$
0 = u_1 \int_0^{2\pi/3}\cos(s)\,ds + u_2 \int_{2\pi/3}^{4\pi/3} \cos(s)\,ds + u_3 \int_{4\pi/3}^{2\pi} \cos(s)\,ds
$$
Evaluate the definite integrals, then solve for the coefficients.
