Home»Math Guides»Second Order Homogeneous and Particular Solutions to ODES 1
How to find the homogeneous and particular solutions for a second-order ordinary ODE (trig particular solution)
You may see a second-order ODE that has y derivatives on the left-side, and x terms on the right-side of the equation. This means that the solution will have a homogeneous part and a particular part.
Example problem: Find the solution for \(y” + y’ – 6y = 5\cos (x)\)
First consider the homogeneous solution. If you’re not sure how, please review our examples on how to find the homogeneous solution which explain it in further detail.
Assume \(y = {e^{mx}}\) and you will get the following polynomial:
\[{m^2} + m – 6 = 0\]
\[(m – 2)(m + 3) = 0\]
The roots are real, distinct values, of m = 2 and m = -3
So the homogeneous solution is \({y_h} = {c_1}{e^{ – 3x}} + {c_2}{e^{2x}}\)
The solution is actually the sum of the homogeneous and particular solution, \(y = {y_h} + {y_p}\)
When you have a sine or cosine on the right-hand side of the ODE you want to solve, you start by assuming that the solution is made up of cosine AND sine terms, both with constants in front.
Assume the solution is in the form \(y = A\cos (x) + B\sin (x)\)
NOTE: Even if you only have one sine or one cosine on the right-hand side of the ODE, you always need to assume a solution with both of them!
Also, the “frequencies” of the trigonometry terms should match, if you had sin(2x), then the solution form would’ve had Acos(2x)+Bsin(2x).
Be careful because maybe you’ll do a problem set where you’ll never see that, then you do a problem on an examination and boom, you lose all your marks.
Then find its derivatives.
\[y’ = – A\sin (x) + B\cos (x)\]
\[y” = – Acos(x) – Bsin(x)\]
Now you substitute these all into the ODE you wanted to solve.
\[y” + y’ – 6y = 5\cos (x)\]
\[ – A\cos (x) – B\sin (x) – A\sin (x) + B\cos (x) – 6A\cos (x) – 6B\sin (x) = 5\cos (x)\]
Looks awful, BUT the solution is easy, you need to make two equations to solve for the two constants, A and B. You just need to look at only the cosine terms and remove the cosines, then look at only the sine terms and remove the sines.
Considering only the terms with a factor of cos(x), \( – A + B – 6A = 5\)
And doing the same for sin(x) terms, \( – B – A – 6B = 0\)
You can use substitution to solve, I actually like to cast the variables into a matrix.
If your calculator has a matrix capability I encourage you to use it, you can save a lot of time on exams and most scientific calculators, which are non-programming calculators, actually have up to 3×3 or even 4×4 matrix solvers!
Ask your instructor what calculators you’re allowed, but we found the Casio fx-115ESPLUS to be amazing, switch to matrix mode, quickly enter the matrix coefficients, and solve easily instead of wasting 10+ minutes using substitution to solve the linear system of equations!
Anyways, let’s show you how to easily put these two equations into a matrix. First line up the A and B’s on one side, then the constants on another side.
\[\begin{array}{l} – 7A + B = 5\\ – A – 7B = 0\end{array}\]
\[\left( {\begin{array}{*{20}{c}}{ – 7}&1\\{ – 1}&{ – 7}\end{array}} \right)\left( {\begin{array}{*{20}{c}}A\\B\end{array}} \right) = \left( {\begin{array}{*{20}{c}}5\\0\end{array}} \right)\]
Use your calculator function to invert the matrix, or find the matrix yourself, Equaser on YouTube made an amazing video showing how to quickly use the Casio fx115 ES PLUS to find a matrix inversion.
\[\left( {\begin{array}{*{20}{c}}{ – \frac{7}{{50}}}&{ – \frac{1}{{50}}}\\{\frac{1}{{50}}}&{ – \frac{7}{{50}}}\end{array}} \right)\left( {\begin{array}{*{20}{c}}5\\0\end{array}} \right) = \left( {\begin{array}{*{20}{c}}A\\B\end{array}} \right)\]
Then find A and B. Remember the order of multiplying:
\[\left( { – \frac{7}{{50}}} \right)\left( 5 \right) + \left( { – \frac{1}{{50}}} \right)\left( 0 \right) = – \frac{7}{{10}}\]
And repeat for B. You will find, \(A = – \frac{7}{{10}}\) and \(B = \frac{1}{{10}}\).
From the beginning, we said that the solution will be:\(y = {y_h} + {y_p}\), so add these solutions together, to find
\[y = {c_1}{e^{ – 3x}} + {c_2}{e^{2x}} – \frac{7}{{10}}\cos (x) + \frac{1}{{10}}sin(x)\]
Done! If you were given two initial conditions, you could then solve for \({c_1}\) and \({c_2}\).
This trick won’t always work, for example, if the particular solution is contained in the homogeneous solution, you can’t solve for A and B at all! Click here to see such an example!
How to solve a second-order ordinary differential equation using MATLAB and double checking your answer
If you have the program MATLAB, you can easily use its symbolic tools to get the exact solution to the problem, feel free to use our following script and modify it for the problem you’re trying to solve.
It’s extremely handy for double-checking your answers before handing them in for an assignment. You can even make your own problems and solve them if you want extra practice solving second-order ODEs.
%bai-gaming.com/math-guides
syms y(x) x
eqn = diff(y,x,2) + diff(y,x,1) -6*y == 5*cos(x);
S = dsolve(eqn)