2.7.7.1 second order linear constant coeff

\[\begin {aligned} y^{\prime \prime }+4 y^{\prime }-y&=\sin \left (t \right ) \end {aligned}\]

Entering second order linear constant coefficient ode solverThis is second order non-homogeneous ODE. In standard form the ODE is

\[ A y''(t) + B y'(t) + C y(t) = f(t) \]

Where \(A=1, B=4, C=-1, f(t)=\sin \left (t \right )\). Let the solution be

\[ y = y_h + y_p \]

Where \(y_h\) is the solution to the homogeneous ODE

\begin{align*} A y''(t) + B y'(t) + C y(t) &= 0 \end{align*}

And \(y_p\) is a particular solution to the non-homogeneous ODE

\begin{align*} A y''(t) + B y'(t) + C y(t) &= f(t) \end{align*}

Where \(y_h\) is the solution to

\begin{align*} y^{\prime \prime }+4 y^{\prime }-y = 0 \end{align*}

This is second order with constant coefficients homogeneous ODE. In standard form the ODE is

\[ A y''(t) + B y'(t) + C y(t) = 0 \]

Where in the above \(A=1, B=4, C=-1\). Let the solution be \(y=e^{\lambda t}\). Substituting this into the ODE gives

\[ \lambda ^{2} {\mathrm e}^{\lambda t}+4 \lambda \,{\mathrm e}^{\lambda t}-{\mathrm e}^{\lambda t} = 0 \tag {1} \]

Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda t}\) gives

\[ \lambda ^{2}+4 \lambda -1 = 0 \tag {2} \]

Equation (2) is the characteristic equation of the ODE. Its roots determine the general solution form. Using the quadratic formula the roots are

\[ \lambda _{1,2} = \frac {-B}{2 A} \pm \frac {1}{2 A} \sqrt {B^2 - 4 A C} \]

Substituting \(A=1, B=4, C=-1\) into the above gives

\begin{align*} \lambda _{1,2} &= \frac {-4}{(2) \left (1\right )} \pm \frac {1}{(2) \left (1\right )} \sqrt {4^2 - (4) \left (1\right )\left (-1\right )}\\ &= -2 \pm \sqrt {5} \end{align*}

Hence

\begin{gather*} \begin {aligned} \lambda _1 &= -2 + \sqrt {5}\\ \lambda _2 &= -2 - \sqrt {5} \end {aligned} \end{gather*}

Which simplifies to

\begin{gather*} \begin {aligned} \lambda _1 &= -2+\sqrt {5}\\ \lambda _2 &= -2-\sqrt {5} \end {aligned} \end{gather*}

Since the roots are distinct, the solution is

\begin{gather*} \begin {aligned} y &= c_1 e^{\lambda _1 t} + c_2 e^{\lambda _2 t}\\ y &= c_1 e^{\left (-2+\sqrt {5}\right )t} +c_2 e^{\left (-2-\sqrt {5}\right )t} \end {aligned} \end{gather*}

Or

\begin{align*} y &=c_1 \,{\mathrm e}^{\left (-2+\sqrt {5}\right ) t}+c_2 \,{\mathrm e}^{\left (-2-\sqrt {5}\right ) t} \end{align*}

Therefore the homogeneous solution \(y_h\) is

\begin{align*} y_h &= c_1 \,{\mathrm e}^{\left (-2+\sqrt {5}\right ) t}+c_2 \,{\mathrm e}^{\left (-2-\sqrt {5}\right ) t} \end{align*}

The particular solution is found using the method of undetermined coefficients. Looking at the RHS of the ode, which is

\[ \sin \left (t \right ) \]

Shows that the corresponding undetermined set of the basis functions (UC_set) for the trial solution is

\[ [\{\cos \left (t \right ), \sin \left (t \right )\}] \]

While the set of the basis functions for the homogeneous solution found earlier is

\[ \left \{{\mathrm e}^{\left (-2-\sqrt {5}\right ) t}, {\mathrm e}^{\left (-2+\sqrt {5}\right ) t}\right \} \]

Since there is no duplication between the basis function in the UC_set and the basis functions of the homogeneous solution, the trial solution is a linear combination of all the basis in the UC_set.

\begin{align*} y_p &= A_{1} \cos \left (t \right )+A_{2} \sin \left (t \right ) \end{align*}

The unknowns \(\{A_{1}, A_{2}\}\) are found by substituting the above trial solution \(y_p\) into the ODE and comparing coefficients. Substituting the trial solution into the ODE and simplifying gives

\begin{align*} -2 A_{1} \cos \left (t \right )-2 A_{2} \sin \left (t \right )-4 A_{1} \sin \left (t \right )+4 A_{2} \cos \left (t \right ) = \sin \left (t \right ) \end{align*}

Solving for the unknowns by comparing coefficients results in

\[ \left [A_{1} = -{\frac {1}{5}}, A_{2} = -{\frac {1}{10}}\right ] \]

Substituting the above back in the above trial solution \(y_p\), gives the particular solution

\begin{align*} y_p &= -\frac {\cos \left (t \right )}{5}-\frac {\sin \left (t \right )}{10} \end{align*}

Therefore the general solution is

\begin{gather*} \begin {aligned} y &= y_h + y_p \\ &= \left (c_1 \,{\mathrm e}^{\left (-2+\sqrt {5}\right ) t}+c_2 \,{\mathrm e}^{\left (-2-\sqrt {5}\right ) t}\right ) + \left (-\frac {\cos \left (t \right )}{5}-\frac {\sin \left (t \right )}{10}\right ) \end {aligned} \end{gather*}
Phase plot