A constant coefficient Higher Order Linear ODE of the form :
$$ y^{(n)} + a_{n-1} y^{(n-1)} + \cdots + a_1 y' + a_0 y = r(x) $$
can be converted to System of ODEs by defining new variables
$$ y_1 = y,\;\; y_2 = y',\;\; \cdots,\;\; y_n = y^{(n-1)} $$
which implies the following \(n-1\) equations
$$ y_1' = y_2,\;\; y_2' = y_3,\;\; \cdots,\;\; y_{n-1}' = y_n $$
Together with original equation
$$ y_n' + a_{n-1} y_n + \cdots + a_1 y_2 + a_0 y_1 = r(x) $$
we get \(n\) equations for \(n\) unknowns.
$$
\begin{bmatrix} y_1(x) \\ y_2(x) \\ \cdots \\ y_n(x) \end{bmatrix}' =
\begin{bmatrix} 0 && 1 && 0 && \cdots && 0
\\ 0 && 0 && 1 && \cdots && 0
\\ \cdots && \cdots && \cdots && \cdots && \cdots
\\ -a_0 && -a_1 && -a_2 && \cdots && -a_{n-1}
\end{bmatrix}
\begin{bmatrix} y_1(x) \\ y_2(x) \\ \cdots \\ y_n(x) \end{bmatrix} +
\begin{bmatrix} 0 \\ 0 \\ \cdots \\ r(x) \end{bmatrix}
$$
Higher order systems can be also converted to first order systems in a similar way.
Example 1
Write the following ODE as a first order system
$$ y'' - y = x $$
solution:
$$ y_1 = y, \;\; y_2 = y' $$
$$ y_1' = y_2, \;\; y_2' = y_1 + x $$
$$
\begin{bmatrix} y_1(x) \\ y_2(x) \end{bmatrix}' =
\begin{bmatrix} 0 && 1
\\ 1 && 0
\end{bmatrix}
\begin{bmatrix} y_1(x) \\ y_2(x) \end{bmatrix} +
\begin{bmatrix} 0 \\ x \end{bmatrix}
$$
Example 2
Write the following ODE as a first order system $$ y^{(3)} + 2y''- y'- 2y = e^x $$
solution:
$$ y_1 = y, \;\; y_2 = y', \;\; y_3 = y'' $$
$$ y_1' = y_2, \;\; y_2' = y_3, \; y_3' = -2 y_3 + y_2 + 2 y_1 + e^x $$
$$
\begin{bmatrix} y_1 \\ y_2 \\ y_3 \end{bmatrix}' =
\begin{bmatrix} 0 && 1 && 0
\\ 0 && 0 && 1
\\ 2 && 1 && -2
\end{bmatrix}
\begin{bmatrix} y_1 \\ y_2 \\ y_3 \end{bmatrix} +
\begin{bmatrix} 0 \\ e^x \end{bmatrix}
$$
Example 3
Write the following second order system as a first order system
$$ x''(t) = x(t) - y(t) + \sin{t} $$
$$ y''(t) = x(t) + y(t) + \cos{t} $$
solution:
Second order system in matrix notation
$$
\begin{bmatrix} x(t) \\ y(t) \end{bmatrix}'' =
\begin{bmatrix} 1 && -1
\\ 1 && 1
\end{bmatrix}
\begin{bmatrix} x(t) \\ y(t) \end{bmatrix} +
\begin{bmatrix} \sin{t} \\ \cos{t} \end{bmatrix}
$$
Defining new variables
$$ u_1 = x,\;\; u_2 = x',\;\; u_3 = 3,\;\; u_4 = y' $$
$$ u_1' = u_2 $$
$$ u_2' = u_1 - u_3 + \sin{t} $$
$$ u_3' = u_4 $$
$$ u_4' = u_1 + u_3 + \cos{t} $$
$$
\begin{bmatrix} u_1 \\ u_2 \\ u_3 \\ u_4 \end{bmatrix}' =
\begin{bmatrix} 0 && 1 && 0 && 0
\\ 1 && 0 && -1 && 0
\\ 0 && 0 && 0 && 1
\\ 1 && 0 && 1 && 0
\end{bmatrix}
\begin{bmatrix} u_1 \\ u_2 \\ u_3 \\ u_4 \end{bmatrix} +
\begin{bmatrix} 0 \\ \sin{t} \\ 0 \\ \cos{t} \end{bmatrix}
$$
Wolfram Notation
DSolve[{
x''[t] == x[t] - y[t] + Sin[t],
y''[t] == x[t] + y[t] + Cos[t]
}, {x[t],y[t]}, t]