Two objects with mass \(m\) are connected with springs (constant \(k\)) as shown.
The equation of motion for the masses
$$ k(x_2 - x_1) - k x_1 = m \ddot{x}_1 $$
$$ - k x_2 - k(x_2 - x_1) = m \ddot{x}_2 $$
as a second order system
$$ \vec{x} = \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} \to m \ddot{\vec{x}} =
B \vec{x} = \begin{bmatrix} -2k && k \\ k && -2k \end{bmatrix} \vec{x} $$
It can be also written as a first order system using the definition
$$ \vec{y} = \begin{bmatrix} x_1 \\ \dot{x}_1 \\ x_2 \\ \dot{x}_2 \end{bmatrix} \to \dot{\vec{y}}(t) = A \vec{y}(t)$$ where
$$ A = \begin{bmatrix}
0 && 1 && 0 && 0 \\
-2k/m && 0 && k/m && 0 \\
0 && 0 && 0 && 1 \\
k/m && 0 && -2k/m && 0
\end{bmatrix} $$
Example 1
Assuming \(m=k\), find the solution with initial conditions
$$ x_1(0) = 1,\;\; x_1'(0) = 0,\;\; x_2(0) = -1,\;\; x_2'(0) = 0 $$
solution:
$$ A = \begin{bmatrix}
0 && 1 && 0 && 0 \\
-2 && 0 && 1 && 0 \\
0 && 0 && 0 && 1 \\
1 && 0 &&-2 && 0
\end{bmatrix} $$
Assuming \( \vec{y}(x) = \vec{ζ} e^{λx}\) we get the eigenvalue problem
$$ |A - I λ| = \begin{vmatrix}
-λ && 1 && 0 && 0 \\
-2 && -λ && 1 && 0 \\
0 && 0 && -λ && 1 \\
1 && 0 &&-2 && -λ
\end{vmatrix} = $$
$$-λ
\begin{vmatrix}
-λ && 1 && 0 \\
0 && -λ && 1 \\
0 &&-2 && -λ
\end{vmatrix} -
\begin{vmatrix}
-2 && 1 && 0 \\
0 &&-λ && 1 \\
1 &&-2 &&-λ
\end{vmatrix}=
$$
$$ λ^2
\begin{vmatrix}
-λ && 1 \\
-2 && -λ
\end{vmatrix}- \left(
-2 \begin{vmatrix}
-λ && 1 \\
-2 &&-λ
\end{vmatrix} - \begin{vmatrix}
0 && 1 \\
1 &&-λ
\end{vmatrix}
\right) =
$$
$$ λ^2(λ^2+2) - \left(-2(λ^2+2) + 1\right) = (λ^2+2)^2 - 1 = 0$$
$$ (λ^2+2)^2 = 1 \to λ^2 = -2 \pm 1 \to λ_{1,2} = \pm i, \;\; λ_{3,4} = \pm \sqrt{3}i $$
Eigenvector for \(λ_1 = i\)
$$\begin{vmatrix}
-i && 1 && 0 && 0 \\
-2 && -i && 1 && 0 \\
0 && 0 && -i && 1 \\
1 && 0 &&-2 && -i
\end{vmatrix} \vec{ζ_1} = 0 \to \vec{ζ_1} = \begin{bmatrix} 1 \\ i \\ 1 \\ i \end{bmatrix} $$
Eigenvector for \(λ_2 = -i\)
$$\begin{vmatrix}
i && 1 && 0 && 0 \\
-2 && i && 1 && 0 \\
0 && 0 && i && 1 \\
1 && 0 &&-2 && i
\end{vmatrix} \vec{ζ_2} = 0 \to \vec{ζ_2} = \begin{bmatrix} 1 \\ -i \\ 1 \\ -i \end{bmatrix} $$
Eigenvector for \(λ_3 = \sqrt{3}i\)
$$\begin{vmatrix}
-\sqrt{3}i && 1 && 0 && 0 \\
-2 && -\sqrt{3}i && 1 && 0 \\
0 && 0 && -\sqrt{3}i && 1 \\
1 && 0 &&-2 && -\sqrt{3}i
\end{vmatrix} \vec{ζ_3} = 0 \to \vec{ζ_3} = \begin{bmatrix} 1 \\ \sqrt{3}i \\ -1 \\ -\sqrt{3}i \end{bmatrix} $$
Eigenvector for \(λ_4 = -\sqrt{3}i\)
$$\begin{vmatrix}
\sqrt{3}i && 1 && 0 && 0 \\
-2 && \sqrt{3}i && 1 && 0 \\
0 && 0 && \sqrt{3}i && 1 \\
1 && 0 &&-2 && \sqrt{3}i
\end{vmatrix} \vec{ζ_4} = 0 \to \vec{ζ_4} = \begin{bmatrix} 1 \\ -\sqrt{3}i \\ -1 \\ \sqrt{3}i \end{bmatrix} $$
$$ \vec{y}(t) =
c_1 \begin{bmatrix} 1 \\ i \\ 1 \\ i \end{bmatrix} e^{it} +
c_2 \begin{bmatrix} 1 \\ -i \\ 1 \\ -i \end{bmatrix} e^{-it} +
c_3 \begin{bmatrix} 1 \\ \sqrt{3}i \\ -1 \\ -\sqrt{3}i \end{bmatrix} e^{\sqrt{3}it} +
c_4 \begin{bmatrix} 1 \\ -\sqrt{3}i \\ -1 \\ \sqrt{3}i \end{bmatrix} e^{-\sqrt{3}it}
$$
$$ \vec{y}(0) =
c_1 \begin{bmatrix} 1 \\ i \\ 1 \\ i \end{bmatrix} +
c_2 \begin{bmatrix} 1 \\ -i \\ 1 \\ -i \end{bmatrix} +
c_3 \begin{bmatrix} 1 \\ \sqrt{3}i \\ -1 \\ -\sqrt{3}i \end{bmatrix} +
c_4 \begin{bmatrix} 1 \\ -\sqrt{3}i \\ -1 \\ \sqrt{3}i \end{bmatrix} =
\begin{bmatrix} 1 \\ 0 \\ -1 \\ 0 \end{bmatrix}
$$
Solving the linear system
$$ \begin{bmatrix} c_1 \\ c_2 \\ c_3 \\ c_4 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 1/2 \\ 1/2 \end{bmatrix} $$
$$ \vec{y}(t) =
\frac{1}{2} \begin{bmatrix} 1 \\ \sqrt{3}i \\ -1 \\ -\sqrt{3}i \end{bmatrix} e^{\sqrt{3}it} +
\frac{1}{2} \begin{bmatrix} 1 \\ -\sqrt{3}i \\ -1 \\ \sqrt{3}i \end{bmatrix} e^{-\sqrt{3}it} =
\begin{bmatrix} \cos{\sqrt{3}t} \\ -\sqrt{3}\sin{\sqrt{3}t} \\ -\cos{\sqrt{3}t} \\ \sqrt{3}\sin{\sqrt{3}t} \end{bmatrix}
$$
$$ x_1(t) = \cos{\sqrt{3}t}, \;\;\; x_2(t) = -\cos{\sqrt{3}t} $$