Solving a system of ordinary differential equations with complex roots I need help solving the differential equation 
$$x' = \left(\begin{matrix} 
0 & -1 \\
1 & 0 
\end{matrix}\right)x$$
with initial state $x(0) = \left(\begin{matrix} z \\ 0 \end{matrix}\right)$. Here, $x' = \frac{dx}{ds}$. The teacher got the following solution $$x = \left(\begin{matrix} \cos(s) && -\sin(s) \\ \sin(s) && \cos(s) \end{matrix}\right)\left(\begin{matrix} z \\ 0 \end{matrix}\right)$$But I have no idea how he got this. Could somebody please explain it to me?
 A: \begin{equation}x' = \left(\begin{matrix} 
0 & -1 \\
1 & 0 
\end{matrix}\right)x
\end{equation}
which can be written as $$\dfrac{dx}{ds}=Px$$where $~P=\left(\begin{matrix} 
0 & -1 \\
1 & 0 
\end{matrix}\right)~$ and $~x=\left(\begin{matrix} 
x_1 \\
x_2 
\end{matrix}\right)~$ .
Consider the solution of the differential equation is of the form $~x=\bar \alpha ~e^{\lambda~s}~$where $~\bar \alpha~$ is the eigen-vector corresponding to the eigen-value $~\lambda~$.
For non trivial solution $$\begin{vmatrix}
-\lambda & -1 \\
1 & -\lambda
\end{vmatrix}=0$$
$$\implies \lambda^2+1=0$$
$$\implies \lambda=\pm~ i$$
Now we have to find the eigen-vector corresponding to $~\lambda=\pm ~i~$.
For $~\lambda=i~$, $$Px=ix\implies \left(\begin{matrix} 
0 & -1 \\
1 & 0 
\end{matrix}\right)\left(\begin{matrix} 
x_1 \\
x_2 
\end{matrix}\right)=i~\left(\begin{matrix} 
x_1 \\
x_2 
\end{matrix}\right)\implies i~x_1=-x_2$$
So $~\bar\alpha^{(1)}=\left(\begin{matrix} 
1 \\
-i 
\end{matrix}\right)~$
For $~\lambda=-i~$, $$Px=-ix\implies \left(\begin{matrix} 
0 & -1 \\
1 & 0 
\end{matrix}\right)\left(\begin{matrix} 
x_1 \\
x_2 
\end{matrix}\right)=-i~\left(\begin{matrix} 
x_1 \\
x_2 
\end{matrix}\right)\implies i~x_1=x_2$$
So $~\bar\alpha^{(2)}=\left(\begin{matrix} 
1 \\
i 
\end{matrix}\right)~$
So the general solution is $$x=A~\bar\alpha^{(1)}~e^{i~s}+B~\bar\alpha^{(2)}~e^{-i~s}$$where $~A,~B~$are constants.
So $$ x=A~\left(\begin{matrix} 
1 \\
-i 
\end{matrix}\right)~e^{i~s}+B~\left(\begin{matrix} 
1 \\
i 
\end{matrix}\right)~e^{-i~s}$$
$$\implies x=A~\left(\begin{matrix} 
1 \\
-i 
\end{matrix}\right)~(\cos s + i~\sin s)+B~\left(\begin{matrix} 
1 \\
i 
\end{matrix}\right)~(\cos s - i~\sin s)$$
$$\implies x=\left(\begin{matrix} 
(A+B)~\cos s + i~(A-B)~ \sin s \\
i~(B-A)~\cos s + (A+B)~\sin s 
\end{matrix}\right)$$
Given that at $~s=0~$, $~x(0) = \left(\begin{matrix} z \\ 0 \end{matrix}\right)~$.
So $$\left(\begin{matrix} z \\ 0 \end{matrix}\right)=\left(\begin{matrix} A+B \\ i(B-A) \end{matrix}\right)$$
$$\implies A+B=z\quad\text{and}\quad i(B-A)=0$$
$$\implies A=B=\dfrac z2$$
So $$x=\left(\begin{matrix} 
z~\cos s  \\
z~\sin s 
\end{matrix}\right)=\left(\begin{matrix} \cos(s) && -\sin(s) \\ \sin(s) && \cos(s) \end{matrix}\right)\left(\begin{matrix} z \\ 0 \end{matrix}\right)$$
A: Other people had given answers that use standard technique. Here I will try to give an answer that make intuitive sense. Strangely enough, I see nobody had mentioned this, but $\left(\begin{matrix}0 & -1\\1 & 0\end{matrix}\right)$ is a rotation matrix by $\frac{\pi}{2}$
Let $r(x)=||x||=\sqrt{x_{1}^{2}+x_{2}^{2}}$ which is the distance from the origin.
Then $\frac{dr}{ds}=\frac{\partial\sqrt{x_{1}^{2}+x_{2}^{2}}}{\partial x_{1}}x_{1}^{\prime}+\frac{\partial\sqrt{x_{1}^{2}+x_{2}^{2}}}{\partial x_{2}}x_{2}^{\prime}=\frac{x_{1}}{r(x)}x_{1}^{\prime}+\frac{x_{2}}{r(x)}x_{2}^{\prime}=\frac{x_{1}}{r(x)}(-x_{2})+\frac{x_{2}}{r(x)}x_{1}=0$. Hence $r(x)$ is actually constant.
Intuitively, if your velocity vector is always orthogonal to the position vector, then you always stay on the circle around the origin. In particular $x(s)$ is always nonzero, so $x^{\prime}(s)$ is also always nonzero since it's a rotation from $x(s)$.
Now that we know $x$ is always on the circle, we can perform circular parameterization to find the argument of $x$. Let $x(s)=\left(\begin{matrix} \cos(\theta(s)) & -\sin(\theta(s))\\\sin(\theta(s)) & \cos(\theta(s))\end{matrix}\right)\left(\begin{matrix}z\\0\end{matrix}\right)$ where $\theta(s)$ can depend on $s$ and the initial condition is $\theta(0)=0$. This is a continuous parameterization of the circle in term of angle, the matrix is a rotation matrix for angle $\theta(s)$.
Then $x^{\prime}(s)=\theta^{\prime}(s)\left(\begin{matrix}-\sin(\theta(s)) & -\cos(\theta(s))\\\cos(\theta(s)) & -\sin(\theta(s))\end{matrix}\right)\left(\begin{matrix}z\\0\end{matrix}\right)=\theta^{\prime}(s)\left(\begin{matrix}0 & -1\\1 & 0\end{matrix}\right)\left(\begin{matrix} \cos(\theta(s)) & -\sin(\theta(s))\\\sin(\theta(s)) & \cos(\theta(s))\end{matrix}\right)\left(\begin{matrix}z\\0\end{matrix}\right)=\theta^{\prime}(s)x^{\prime}(s)$.
Since $x^{\prime}(s)$ is always nonzero, we get $\theta^{\prime}(s)=1$ for all $s$. Hence we have the ODE $\theta^{\prime}(s)=1$ with initial condition $\theta(0)=0$.
Intuitively, if you go around a circle such that your velocity is always pointing along the same direction with constant speed, then you can count your rotation angle instead and it should be a linear change.
Solving that ODE give $\theta(s)=s$. Plug back in to get $x$.
A: We can solve this problem and explain why
$x = \left(\begin{matrix} \cos s && -\sin s \\ \sin s && \cos s \end{matrix}\right)\left(\begin{matrix} z \\ 0 \end{matrix}\right) \tag 1$
quite quickly and simply without resorting to eigen-decompositions of the matrix $J$ as follows:
we are given the simple time-invariant linear ordinary differential equation
$x^\prime = \dfrac{dx}{ds} = Jx, \; J = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}; \tag 2$
and we know the geeral solution to this is
$x(s) = e^{Js}x(0) \tag 3$
for any $x(0)$; indeed, differentiating (3) yields
$x^\prime(s) = Je^{Js}x(0) = Jx(s) \tag 4$
with 
$x(0) = e^{J(0)}x(0) = e^0 x(0) = Ix(0) = x(0); \tag 5$
we may easily compute the explicit form of the matrix $e^{Js}$ when we observe that
$J^2 = -I, \tag 6$
$J^3 = J^2J = -IJ = -J, \tag 7$
$J^4 = J^3J = -JJ = -J^2 = -(-I) = I; \tag 8$
by virtue of (8) we may generalize (6)-(8) to
$J^{4n} = (J^4)^n = I^n = I, \tag 9$
$J^{4n + 1} = J^{4n}J = IJ = J, \tag{10}$
$J^{4n + 2} = J^{4n}J^2 = I(-I) = -I, \tag{11}$
$J^{4n + 3} = J^{4n}J^3 = I(-J) = -J; \tag{12}$
the reader will observe that this pattern of the powers of $J$ has an exact parallel in the powers of the complex number $i \in \Bbb C$:
$i^{4n} = (i^4)^n = 1^n = 1, \tag{13}$
$i^{4n + 1} = i^{4n}i = 1i = i, \tag{14}$
$i^{4n + 2} = i^{4n} i^2 = 1(-1) = -1; \tag{15}$
$i^{4n + 3} = i^{4n} i^3 = 1(-1) = -i; \tag{15}$
therefore when we seek to evaluate
$e^{Js} = \displaystyle \sum_0^\infty \dfrac{J^n s^n}{n!}, \tag{16}$
we may base our calculations on those needed to establish the well-known Euler's formula,
$e^{is} = \cos s + i\sin s, \tag{16.5}$
and thus we may break (16) into two sums, those containing only the $4n + 1$-st and $4n + 3$-rd powers of $J$, each term of which has $J$ as a factor, and those containing only the $4n$-th and $4n + 2$-nd powers of $J$, in which $J$ does not explicitly appear, thusly:
$e^{Js} = \displaystyle \sum_0^\infty \dfrac{J^n s^n}{n!} = \sum_0^\infty \dfrac{J^{2n} s^{2n}}{(2n)!} + \sum_0^\infty \dfrac{J^{2n + 1} s^{2n + 1}}{(2n + 1)!}$
$= \displaystyle \sum_0^\infty \dfrac{J^{2n} s^{2n}}{(2n)!} + J\sum_0^\infty \dfrac{J^{2n} s^{2n + 1}}{(2n + 1)!}$
$=  \displaystyle \sum_0^\infty \dfrac{(-1)^n s^{2n}}{(2n)!}I + J\sum_0^\infty \dfrac{(-1)^n s^{2n + 1}}{(2n + 1)!} = (\cos s)I + (\sin s)J; \tag{17}$
with $J$ as in (2) this reduces to
$e^{Js} = \begin{bmatrix} \cos s & - \sin s \\ \sin s & \cos s \end{bmatrix}; \tag{18}$
therefore according to (3) the solution with
$x(0) = \begin{pmatrix} z \\ 0 \end{pmatrix} \tag{19}$
is
$e^{Js}x(0) = \begin{bmatrix} \cos s & - \sin s \\ \sin s & \cos s \end{bmatrix}\begin{pmatrix} z \\ 0 \end{pmatrix} = \begin{pmatrix} z \cos s \\ z \sin s \end{pmatrix}.  \tag{20}$
Solving a system of ordinary differential equations with complex roots
