The motion of a harmonic ocilator $x(t)$ is described by the differential equation
$$\frac{d^2x}{dt^2}=-\frac{k}{m}x-\frac{c}{m}\frac{dx}{dt}$$
Write the differential equation as a first order ode on the form $\frac{d}{dt}\mathbf{y}(t)=\mathbf{f}(\mathbf{y}).$
I'm confused by the notation $\frac{d}{dt}\mathbf{y}(t)=\mathbf{f}(\mathbf{y}).$ The function $\mathbf{f},$ is it the same as a transofmrationmatrix, say $A$ so that the form is equivalent to $\mathbf{y}'=A\mathbf{y}?$ If this is ineed the case, then here is my try:
Let $\mathbf y=(y_1,y_2)^T$. Then we have that
$$\frac{d}{dt}\begin{bmatrix}y_1 \\ y_2\end{bmatrix}=\begin{bmatrix}0 & 1 \\ -\frac{k}{m} & -\frac{c}{m}\end{bmatrix}\begin{bmatrix}y_1 \\ y_2\end{bmatrix}.$$
The exam solutions just say
$$\frac{d}{dt}\begin{bmatrix}x \\ v \end{bmatrix}=\begin{bmatrix}v \\ -\frac{k}{m}x-\frac{c}{m}v\end{bmatrix}.$$
Questions:
- What are they doing?
- Is my answer wrong?
- What is a good step-by-step algorithm to do this?
Your solution is equivalent to the second one. If you rename your variables $y_1=x$ and $y_2=v$ and carry out the matrix vector multiplication you arrive at their solution, i.e. $$\frac{d}{dt}\begin{bmatrix}x \\ v\end{bmatrix}=\begin{bmatrix}0 & 1 \\ -\frac{k}{m} & -\frac{c}{m}\end{bmatrix}\begin{bmatrix}x \\ v\end{bmatrix} = \begin{bmatrix}0 & v \\ -\frac{k}{m} x & -\frac{c}{m} v\end{bmatrix}.$$
A general difference is, that there exists always a first order equation of the form $\frac{d\mathbf{y}}{dt}(t)=\mathbf{f}(\mathbf{y}(t))$, but maybe not a linear one.
For example the nonlinear second order ode $$ \frac{d^2}{dt^2} x = x^2,$$ can be reduced to a nonlinear first order system using $\mathbf{y} = \begin{bmatrix}x\\v\end{bmatrix}$, $$ \frac{d}{dt} \begin{bmatrix}x\\v\end{bmatrix} = \frac{d \mathbf{y}}{dt}(t) = \mathbf{f}(\mathbf{y}(t)) = \begin{bmatrix}v\\x^2\end{bmatrix}.$$
But since $\mathbf{f}$ is nonlinear, there is no matrix $A$ independent of $x,v$ which allows a reduction to a linear first order ode of the form $\frac{d \mathbf{y}}{dt}(t) = A \cdot \mathbf{y}(t).$
The general formula for higher order differential equations can be found on wikipedia (Reduction to first order) The idea is the same: Shift the last $n-1$ on entry towards the top and replace the last line of $\mathbf{f}$ by the original right hand side.