2.3.2.2 second order linear constant coeff

\[\begin {aligned} x^{\prime \prime }-x&={\mathrm e}^{t}\\ x \left (0\right ) &= 0\\ x^{\prime }\left (0\right ) &= 1\\ \end {aligned}\]

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

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

Where \(A=1, B=0, C=-1, f(t)={\mathrm e}^{t}\). Let the solution be

\[ x = x_h + x_p \]

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

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

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

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

Where \(x_h\) is the solution to

\begin{align*} x^{\prime \prime }-x = 0 \end{align*}

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

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

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

\[ \lambda ^{2} {\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}-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=0, C=-1\) into the above gives

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

Hence

\begin{gather*} \begin {aligned} \lambda _1 &= + 1\\ \lambda _2 &= - 1 \end {aligned} \end{gather*}

Which simplifies to

\begin{gather*} \begin {aligned} \lambda _1 &= 1\\ \lambda _2 &= -1 \end {aligned} \end{gather*}

Since the roots are distinct, the solution is

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

Or

\begin{align*} x &=c_1 \,{\mathrm e}^{t}+c_2 \,{\mathrm e}^{-t} \end{align*}

Therefore the homogeneous solution \(x_h\) is

\begin{align*} x_h &= c_1 \,{\mathrm e}^{t}+c_2 \,{\mathrm e}^{-t} \end{align*}

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

\[ {\mathrm e}^{t} \]

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

\[ [\{{\mathrm e}^{t}\}] \]

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

\[ \{{\mathrm e}^{t}, {\mathrm e}^{-t}\} \]

Since \({\mathrm e}^{t}\) is duplicated in the UC_set, then this basis is multiplied by extra \(t\). The UC_set becomes

\[ [\{t \,{\mathrm e}^{t}\}] \]

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

\begin{align*} x_p &= A_{1} t \,{\mathrm e}^{t} \end{align*}

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

\begin{align*} 2 A_{1} {\mathrm e}^{t} = {\mathrm e}^{t} \end{align*}

Solving for the unknowns by comparing coefficients results in

\[ \left [A_{1} = {\frac {1}{2}}\right ] \]

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

\begin{align*} x_p &= \frac {t \,{\mathrm e}^{t}}{2} \end{align*}

Therefore the general solution is

\begin{gather*} \begin {aligned} x &= x_h + x_p \\ &= \left (c_1 \,{\mathrm e}^{t}+c_2 \,{\mathrm e}^{-t}\right ) + \left (\frac {t \,{\mathrm e}^{t}}{2}\right ) \end {aligned} \end{gather*}

Applying the initial conditions \([x \left (0\right ) = 0, x^{\prime }\left (0\right ) = 1]\), the solution becomes

\begin{align*} x &= -\frac {{\mathrm e}^{-t}}{4}+\frac {{\mathrm e}^{t} \left (t +\frac {1}{2}\right )}{2} \\ \end{align*}
\(x = -\frac {{\mathrm e}^{-t}}{4}+\frac {{\mathrm e}^{t} \left (t +\frac {1}{2}\right )}{2}\) Direction field