Ordinary Differential Equations – Solving Second Order Differential Equation Using Undetermined Coefficients

ordinary differential equations

Problem:

Find the general solution of the following differential equation.
$$ y'' + 2y' + 4y = 13 \cos(4x) $$

Answer:

So the first step is to find the complementary solution, $y_c$.
\begin{align*}
m^2 +2m + 4 &= 0 \\
m &= \dfrac{ -2 \pm \sqrt{ 4 – 4(1)(4)} }{ 2(1)} \\
m &= \dfrac{ -2 \pm \sqrt{ -12 } }{ 2 } \\
m &= -1 \pm \sqrt{3} i \\
\end{align*}

Now we have:
$$ y_c = e^{-x} ( c_1 \sin( \sqrt{ 3 }x ) + c_2 \cos( \sqrt{ 3 } x ) )$$.
Now we need to find $y_p$.
\begin{align*}
y_p &= A \cos(4x) + B \sin(4x) \\
y'_p &= – 4A \sin(4x) + 4B \cos(4x) \\
y''_p &= – 16A \cos(4x) – 16B \sin(4x) \\
\end{align*}

Let $LHS = y'' + 2y' + 4y $. We have:
\begin{align*}
LHS &= – 16A \cos(4x) – 16B \sin(4x) + \\
&2 ( – 4A \sin(4x) + 4B \cos(4x) )
+ 4( A \cos(4x) + B \sin(4x) ) \\
%
LHS &=
– 16A \cos(4x) – 16B \sin(4x) – 8A \sin(4x) + \\
& 8B \cos(4x) + 4A \cos(4x) + 4B \sin(4x) \\
\end{align*}

\begin{align*}
– 16A \cos(4x) – 16B \sin(4x) – 8A \sin(4x) + 8B \cos(4x) + \\
& 4A \cos(4x) + 4B \sin(4x) \\
&= 13 \cos(4x) \\
\end{align*}

\begin{align*}
– 12A \cos(4x) – 16B \sin(4x) – 8A \sin(4x) + 8B \cos(4x)
+ 4B \sin(4x) &= 13 \cos(4x) \\
%
– 12A \cos(4x) – 12B \sin(4x) – 8A \sin(4x) + 8B \cos(4x) &= 13 \cos(4x)
\end{align*}

Now we set up the following system of linear equations:
\begin{align*}
-12A + 8B &= 13 \\
-12B – 8A &= 0 \\
\end{align*}

We rewrite as:
\begin{align*}
-12A + 8B &= 13 \\
2A + 3B &= 0 \\
\end{align*}

Now we solve the system of equations:
\begin{align*}
A &= \left( – \dfrac{ 3 }{2} \right) B \\
-12 \left( \dfrac{-3B}{2} \right) + 8B &= 13 \\
18B + 8B &= 13 \\
B &= 2 \\
A &= -3 \\
\end{align*}

Hence our answer is:
$$ y = e^{-x} ( c_1 \sin( \sqrt{ 3 }x ) + c_2 \cos( \sqrt{ 3 } x ) ) +
+ 48 \cos(4x) – 32 \sin(4x) $$

However, the book's answer is:
$$ y = e^{-x} ( c_1 \sin( \sqrt{ 3 }x ) + c_2 \cos( \sqrt{ 3 } x ) ) +
\left( \dfrac{1}{2}\right) \sin(4x) – \dfrac{3 }{4} – \cos(4x) $$

Where did I go wrong?

Based upon the comments made by user170231 I have updated my answer. However, it is still wrong. Here is the updated answer:

So the first step is to find the complementary solution, $y_c$.
\begin{align*}
m^2 +2m + 4 &= 0 \\
m &= \dfrac{ -2 \pm \sqrt{ 4 – 4(1)(4)} }{ 2(1)} \\
m &= \dfrac{ -2 \pm \sqrt{ -12 } }{ 2 } \\
m &= -1 \pm \sqrt{3} i \\
\end{align*}

Now we have:
$$ y_c = e^{-x} ( c_1 \sin( \sqrt{ 3 }x ) + c_2 \cos( \sqrt{ 3 } x ) )$$.
Now we need to find $y_p$.
\begin{align*}
y_p &= A \cos(4x) + B \sin(4x) \\
y'_p &= – 4A \sin(4x) + 4B \cos(4x) \\
y''_p &= – 16A \cos(4x) – 16B \sin(4x) \\
\end{align*}

Let $LHS = y'' + 2y' + 4y $. We have:
\begin{align*}
LHS &=
– 16A \cos(4x) – 16B \sin(4x) + 2 ( – 4A \sin(4x) + 4B \cos(4x) ) \\
&+ 4( A \cos(4x) + B \sin(4x) ) \\
%
LHS &=
– 16A \cos(4x) – 16B \sin(4x) – 8A \sin(4x) \\
&+ 8B \cos(4x) \\
& + 4A \cos(4x) + 4B \sin(4x) \\
\end{align*}

\begin{align*}
– 16A \cos(4x) – 16B \sin(4x) – 8A \sin(4x) \\
& + 8B \cos(4x) \\
&+ 4A \cos(4x) + 4B \sin(4x) \\
&= 13 \cos(4x) \\
%
– 12A \cos(4x) – 16B \sin(4x) \\
&- 8A \sin(4x) + 8B \cos(4x) \\
+ 4B \sin(4x) &= 13 \cos(4x) \\
\end{align*}

\begin{align*}
– 12A \cos(4x) – 12B \sin(4x) – 8A \sin(4x) \\
&+ 8B \cos(4x) \\
&= 13 \cos(4x)
\end{align*}

Now we set up the following system of linear equations:
\begin{align*}
-12A + 8B &= 13 \\
-12B – 8A &= 0 \\
\end{align*}

We rewrite as:
\begin{align*}
-12A + 8B &= 13 \\
2A + 3B &= 0 \\
\end{align*}

Now we solve the system of equations:
\begin{align*}
A &= \left( – \dfrac{ 3 }{2} \right) B \\
-12 \left( \dfrac{-3B}{2} \right) + 8B &= 13 \\
18B + 8B &= 13 \\
26B &= 13 \\
B &= \dfrac{1}{2} \\
A &= \left( \dfrac{-3}{2}\right) \left( \dfrac{1}{2} \right) \\
A &= – \dfrac{ 3 }{4 }
\end{align*}

Hence our answer is:
$$ y = e^{-x} ( c_1 \sin( \sqrt{ 3 }x ) + c_2 \cos( \sqrt{ 3 } x ) )
– \dfrac{ 3 }{4 } \cos(4x) + \dfrac{1}{2} \sin(4x) $$

However, the book's answer is:
$$ y = e^{-x} ( c_1 \sin( \sqrt{ 3 }x ) + c_2 \cos( \sqrt{ 3 } x ) ) +
\left( \dfrac{1}{2}\right) \sin(4x) – \dfrac{3 }{4} – \cos(4x) $$

Where did I go wrong?

Best Answer

The problem in solving these differential equations is the determination of a particular solution. In this case this can be simple: considering instead

$$ y''+2y'+4y = 13 e^{4 ix} $$

and taking $y_p = c e^{i\alpha x}$ after substitution we have

$$ (\alpha (\alpha -2 i)-4) c e^{i \alpha x}+13 e^{4 i x}=0,\forall x $$

so $\alpha = 4$ resulting in

$$ (3+2 i-3) (4 c+(3+2 i)) e^{4 i x}=0 \Rightarrow c = -\frac 34-\frac i2 $$

and

$$ y_p = -\left(\frac 34+\frac i2\right)\left(\cos(4x)+i\sin(4x)\right) $$

and finally

$$ \mathcal{R}\left[y_p\right] = \frac 12\sin(4x)-\frac 34\cos(4x) $$

Related Question