# Convert 2nd order ode to first order ODES

#### RoyalFlush

Hello,
I have the DE:

$$\displaystyle y''(t) + y = 0$$

with IC's:

$$\displaystyle y'(0) = 1$$hs

$$\displaystyle y(0) = 0$$

If I convert this to a system of 1st order ODES is it just:

$$\displaystyle \frac{dy_1}{dt} = y_2, \ \ \ \frac{dy_2}{dt} = -y_1$$

How about if the DE is:

$$\displaystyle y''(t) + y = \sin(2t)$$ and the same IC's.

Thanks

#### AllanCuz

Hello,
I have the DE:

$$\displaystyle y''(t) + y = 0$$

with IC's:

$$\displaystyle y'(0) = 1$$hs

$$\displaystyle y(0) = 0$$

If I convert this to a system of 1st order ODES is it just:

$$\displaystyle \frac{dy_1}{dt} = y_2, \ \ \ \frac{dy_2}{dt} = -y_1$$

How about if the DE is:

$$\displaystyle y''(t) + y = \sin(2t)$$ and the same IC's.

Thanks
The first question is a second order homogenious equation. We find the roots by computing the characteristic equation.

$$\displaystyle \lambda^2 + 1 = 0$$

Clearly this has the imaginary roots $$\displaystyle -i$$ and $$\displaystyle i$$

So,

$$\displaystyle y = c_1 e^{-i x} + c_2 e^{ i x }$$

Compute and sub in initial conditions.

The second question can be computed by method of comparing co-efficients (we can also use variation of paramters but co-efficients is easiast here).

For $$\displaystyle y''(t) + y = \sin(2t)$$ the general solution is the solution from question 1 plus the particular solution.

For the particular solution,

Let $$\displaystyle y = Asin(2t) + Bcos(2t)$$

So,

$$\displaystyle y^{ \prime } = 2Acos(2t) -2Bsin(2t)$$

$$\displaystyle y^{ \prime \prime } = -4Acos(2t) - 4Bcos(2t)$$

Subbing into the equation we get,

$$\displaystyle -4Acos(2t) - 4Bcos(2t) + Asin(2t) + Bcos(2t) = sin(2t)$$

$$\displaystyle cos(2t) [ - 4A - 3B ] + Asin(2t) = sin(2t)$$

$$\displaystyle A = 1$$

$$\displaystyle -4 -3B = 0$$

$$\displaystyle B = - \frac{4}{3}$$

And $$\displaystyle y = sin(2t) - \frac{4}{3}cos(2t)$$

• RoyalFlush

#### Prove It

MHF Helper
The first question is a second order homogenious equation. We find the roots by computing the characteristic equation.

$$\displaystyle \lambda^2 + 1 = 0$$

Clearly this has the imaginary roots $$\displaystyle -i$$ and $$\displaystyle i$$

So,

$$\displaystyle y = c_1 e^{-i x} + c_2 e^{ i x }$$

Compute and sub in initial conditions.
You should really use Euler's Formula to clean this up...

• RoyalFlush

#### AllanCuz

You should really use Euler's Formula to clean this up...
You mean, actually do work? Pshh...

$$\displaystyle y = c_1 e^{ -ix} + c_2 e^{ix}$$

$$\displaystyle = c_1 [ cosx - isinx ] + c_2 [cosx + isinx]$$

$$\displaystyle = [c_1 + c_2]cosx + [ i c_2 - i c_1 ] sinx$$

Let $$\displaystyle A = c_1 + c_2$$ and $$\displaystyle B = i c_2 - i c_2$$

$$\displaystyle y = Acosx + Bsinx$$

This is actually the result of a seperation of variables of a wave equation :O!

• RoyalFlush

#### HallsofIvy

MHF Helper
That's very clever, guys, but it doesn't actually answer the question asked, does it?

Royal Flush, yes, if you let $$\displaystyle y_1= y$$ and $$\displaystyle y_2= \frac{dy}{dt}$$, then we have immediately that $$\displaystyle \frac{dy_1}{dt}= y_2$$ and then $$\displaystyle \frac{d^2y}{dt^2}= \frac{d}{dt}\frac{dy_1}{dt}= \frac{dy_2}{dt}$$ so that $$\displaystyle \frac{d^2y}{dt^2}+ y= \frac{dy_2}{dt}+ y_1= 0$$ so that $$\displaystyle \frac{dy_2}{dt}= -y_1$$

And your initial conditions are $$\displaystyle y_1(0)= 0$$ and $$\displaystyle y_2(0)=1$$.

This can also be written as the "matrix" equation:
$$\displaystyle \frac{d\begin{pmatrix}y_1 \\ y_2\end{pmatrix}}{dt}= \begin{pmatrix}y_2 \\ -y_1\end{pmatrix}= \begin{pmatrix}0 & 1 \\-1 & 0\end{pmatrix}\begin{pmatrix}y_1 \\ y_2\end{pmatrix}$$ subject to the initial condition $$\displaystyle \begin{pmatrix}y_1(0) \\ y_2(0)\end{pmatrix}= \begin{pmatrix}0 \\ 1\end{pmatrix}$$.

In the same way, the equation y"+ y= sin(2t) becomes the pair of equations $$\displaystyle \frac{dy_1}{dt}= y_2$$ and $$\displaystyle \frac{dy_2}{dt}= -y_1+ sin(2t)$$ with the same intial conditions.

That also can be written as a "matrix" equation:
$$\displaystyle \frac{d\begin{pmatrix}y_1 \\ y_2\end{pmatrix}}{dt}=$$$$\displaystyle \begin{pmatrix}0 & 1 \\ -1 & 0\end{pmatrix}\begin{pmatrix}y_1 \\ y_2\end{pmatrix}+ \begin{pmatrix}0 \\ sin(2t)\end{pmatrix}$$
with initial condition $$\displaystyle \begin{pmatrix}y_1(0) \\ y_2(0)\end{pmatrix}= \begin{pmatrix}0 \\ 1\end{pmatrix}$$.

Of course, the eigenvalues of the matrix $$\displaystyle \begin{pmatrix}0 & 1 \\ -1 & 0\end{pmatrix}$$ are i and -i which lead to the complex exponentials (sine and cosine) solutions Prove It and AllenCuz show.

• RoyalFlush

#### AllanCuz

That's very clever, guys, but it doesn't actually answer the question asked, does it?

Royal Flush, yes, if you let $$\displaystyle y_1= y$$ and $$\displaystyle y_2= \frac{dy}{dt}$$, then we have immediately that $$\displaystyle \frac{dy_1}{dt}= y_2$$ and then $$\displaystyle \frac{d^2y}{dt^2}= \frac{d}{dt}\frac{dy_1}{dt}= \frac{dy_2}{dt}$$ so that $$\displaystyle \frac{d^2y}{dt^2}+ y= \frac{dy_2}{dt}+ y_1= 0$$ so that $$\displaystyle \frac{dy_2}{dt}= -y_1$$

And your initial conditions are $$\displaystyle y_1(0)= 0$$ and $$\displaystyle y_2(0)=1$$.

This can also be written as the "matrix" equation:
$$\displaystyle \frac{d\begin{pmatrix}y_1 \\ y_2\end{pmatrix}}{dt}= \begin{pmatrix}y_2 \\ -y_1\end{pmatrix}= \begin{pmatrix}0 & 1 \\-1 & 0\end{pmatrix}\begin{pmatrix}y_1 \\ y_2\end{pmatrix}$$ subject to the initial condition $$\displaystyle \begin{pmatrix}y_1(0) \\ y_2(0)\end{pmatrix}= \begin{pmatrix}0 \\ 1\end{pmatrix}$$.

In the same way, the equation y"+ y= sin(2t) becomes the pair of equations $$\displaystyle \frac{dy_1}{dt}= y_2$$ and $$\displaystyle \frac{dy_2}{dt}= -y_1+ sin(2t)$$ with the same intial conditions.

That also can be written as a "matrix" equation:
$$\displaystyle \frac{d\begin{pmatrix}y_1 \\ y_2\end{pmatrix}}{dt}=$$$$\displaystyle \begin{pmatrix}0 & 1 \\ -1 & 0\end{pmatrix}\begin{pmatrix}y_1 \\ y_2\end{pmatrix}+ \begin{pmatrix}0 \\ sin(2t)\end{pmatrix}$$
with initial condition $$\displaystyle \begin{pmatrix}y_1(0) \\ y_2(0)\end{pmatrix}= \begin{pmatrix}0 \\ 1\end{pmatrix}$$.

Of course, the eigenvalues of the matrix $$\displaystyle \begin{pmatrix}0 & 1 \\ -1 & 0\end{pmatrix}$$ are i and -i which lead to the complex exponentials (sine and cosine) solutions Prove It and AllenCuz show.
He said "if I convert to" which I took to mean he was trying to solve the problem via that method, and it wasn't specifically asked of him.

• RoyalFlush