Q:

Differential equation of a mass on a spring

I have the following differential equation which is motivated by the dynamics of a mass on a spring:
\begin{equation}
my'' - ky = 0
\end{equation}
I split this into a system of equations by letting $x_1=y$  and $x_2=y'$
\begin{equation}
x' = \begin{pmatrix} 0&1\\\dfrac{k}{m}& 0\end{pmatrix}x
\end{equation}
Find an Eigenvalue:
\begin{align}
\det(A-\lambda I) =& 0 \\
\det\begin{pmatrix} -\lambda&1\\\dfrac{k}{m}&-\lambda\end{pmatrix} =& 0 \\
\lambda^2 - \dfrac{k}{m} =& 0 \\
\lambda = \pm\sqrt{\dfrac{k}{m}}
\end{align}
Find the matching eigenvector:
\begin{align}
(A-\lambda I)x =& 0 \\
\begin{pmatrix} -\sqrt{\frac{k}{m}}&1\\\dfrac{k}{m}&-\sqrt{\frac{k}{m}}\end{pmatrix}x =& 0
\end{align}
This matrix is similar to:
\begin{equation}
\begin{pmatrix}-\sqrt{\frac{k}{m}}&1\\0&0\end{pmatrix}x = 0
\end{equation}
$x_2$ is free so let $x_2$ = 1. We have:
\begin{align}
-\sqrt{\frac{k}{m}}x_1 + 1 =& 0 \\
x_1 =& \dfrac{1}{\sqrt{\dfrac{k}{m}}}
\end{align}
So the corresponding eigenvector is 
$\begin{pmatrix}\dfrac{1}{\sqrt{\dfrac{k}{m}}}\\1\end{pmatrix}$.
Any solution to the vector differential equation $x'=Ax$ is $x = e^{\lambda t}x_0$ where $\lambda$ is an eigenvalue and $x_0$ is the corresponding eigenvector.
Our solution is then 
\begin{equation}
e^{\sqrt{\frac{k}{m}} t}\begin{pmatrix}\dfrac{1}{\sqrt{\dfrac{k}{m}}}\\1\end{pmatrix}
\end{equation}
I am just using technique I learned in a differential equations book. This doesn't make sense from a physics stand point where solutions should be periodic and thus would have solutions in terms of sines and cosine. Perhaps I did not setup the system correctly, because if I got imaginary eigenvalues then I could have had sines and cosine in my solution.
I want to know what I did wrong, let me know what you think.

A:

If we have $$mt^2+k=0, ~~m>0,k>0$$ instead so $t=\pm\sqrt{\frac{k}{m}}i$ which lead us to have $$y_c(x)=C_1\exp\left(\sqrt{\frac{k}{m}}ix\right)+C_2\exp\left(-\sqrt{\frac{k}{m}}ix\right)$$ Now Euler's formula $e^{it}=\cos(t)+i\sin(t)$ can help us to convert the resulted solution to the following tolerable form: $$y_c(x)=C_1\cos\left(\sqrt{\frac{k}{m}}~x\right)+C_2\sin\left(\sqrt{\frac{k}{m}}~x\right)$$ 

