Entering second order linear constant coefficient ode solverThis is second order non-homogeneous ODE. In standard form the ODE is
Where \(A=1, B=0, C=1, f(t)=\cos \left (t \right )\). Let the solution be
Where \(x_h\) is the solution to the homogeneous ODE
And \(x_p\) is a particular solution to the non-homogeneous ODE
Where \(x_h\) is the solution to
This is second order with constant coefficients homogeneous ODE. In standard form the ODE is
Where in the above \(A=1, B=0, C=1\). Let the solution be \(x=e^{\lambda t}\). Substituting this into the ODE gives
Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda t}\) gives
Equation (2) is the characteristic equation of the ODE. Its roots determine the general solution form. Using the quadratic formula the roots are
Substituting \(A=1, B=0, C=1\) into the above gives
Hence
Which simplifies to
Since the roots are complex conjugate of each others, then let the roots be
Where \(\alpha =0\) and \(\beta =1\). Therefore the final solution using Euler relation can be written as
Which becomes
Or
Therefore the homogeneous solution \(x_h\) is
The particular solution is found using the method of undetermined coefficients. Looking at the RHS of the ode, which is
Shows that the corresponding undetermined set of the basis functions (UC_set) for the trial solution is
While the set of the basis functions for the homogeneous solution found earlier is
Since \(\cos \left (t \right )\) is duplicated in the UC_set, then this basis is multiplied by extra \(t\). The UC_set becomes
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.
The unknowns \(\{A_{1}, A_{2}\}\) 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
Solving for the unknowns by comparing coefficients results in
Substituting the above back in the above trial solution \(x_p\), gives the particular solution
Therefore the general solution is
Applying the initial conditions \([x \left (0\right ) = 0, x^{\prime }\left (0\right ) = 1]\), the solution becomes
| | |
| \(x = \frac {\left (t +2\right ) \sin \left (t \right )}{2}\) | Direction field |