2.3.1.2 second order linear constant coeff

\[\begin {aligned} x^{\prime \prime }-x&=t^{2}\\ 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)=t^{2}\). 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

\[ t^{2} \]

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

\[ [\{1, t, t^{2}\}] \]

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

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

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*} x_p &= A_{3} t^{2}+A_{2} t +A_{1} \end{align*}

The unknowns \(\{A_{1}, A_{2}, A_{3}\}\) 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*} -A_{3} t^{2}-A_{2} t -A_{1}+2 A_{3} = t^{2} \end{align*}

Solving for the unknowns by comparing coefficients results in

\[ [A_{1} = -2, A_{2} = 0, A_{3} = -1] \]

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

\begin{align*} x_p &= -t^{2}-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 (-t^{2}-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 &= -t^{2}-2+\frac {3 \,{\mathrm e}^{t}}{2}+\frac {{\mathrm e}^{-t}}{2} \\ \end{align*}
\(x = -t^{2}-2+\frac {3 \,{\mathrm e}^{t}}{2}+\frac {{\mathrm e}^{-t}}{2}\) Direction field