Home»Math Guides»Second Order Homogeneous and Particular Solutions to ODES 2
How to find the homogeneous and particular solutions for a second-order ordinary ODE, but with an exponential particular solution that has a “repeated term”
You’ve learned how to solve a second-order ODE that has both a homogeneous and particular solution, but there are exceptions, such as when the particular solution has a term that’s in the homogeneous solution, then you can’t assume the particular solution correctly, the equations won’t work out and you won’t be able to solve for A, B, etc.
For this reason you should always start by first finding the homogeneous solution, then find the particular solution, then add them up.
Please see our following example.
Example problem: Find the solution of \(y” – y’ + \frac{y}{4} = 3 + {e^{\frac{x}{2}}}\)
First consider only the left-hand side of the ODE so that we can find the homogeneous solution.
Let \(y = {e^{mx}}\), find its derivatives, and substitute into the ODE to get the polynomial:
\[{m^2} – m + \frac{1}{4} = 0\]
\[{(2m – 1)^2} = 0\]
There are two real repeated roots, m = 1/2, review here how to make a homogeneous solution for repeated roots if you’re not sure.
The homogeneous solution is then:
\[{y_h} = {c_1}{e^{\frac{x}{2}}} + x{c_2}{e^{\frac{x}{2}}}\]
Here’s the trick, we need to assume a solution form for the particular solution. But, I will tell you right now, if your solution form has the same terms in it as the homogeneous solution above, you will not be able to solve for the constants and the math will not work out.
Normally here, you need to assume \({y_p} = A + B{e^{\frac{x}{2}}}\). You need an A for the constant 3 term, then a B with \({e^{\frac{x}{2}}}\) for the \({e^{\frac{x}{2}}}\) term.
BUT, \({e^{\frac{x}{2}}}\) is already in \({y_h}\) and if you actually did that, the math wouldn’t work out and you wouldn’t be able to solve for B.
The trick is to just multiply the part that wouldn’t work by x.
But there’s another problem, if you multiplied to get \(Bx{e^{\frac{x}{2}}}\), that’s still no good because \({y_h}\) actually has \(x{e^{\frac{x}{2}}}\) in it. So multiply by x once more and it works out. Only multiply by x when necessary, don’t overdo it or the math won’t work out!
So, the correct form of the particular solution is \({y_p} = A + B{x^2}{e^{\frac{x}{2}}}\)
Find the derivatives.
\[y’ = \frac{1}{2}B{x^2}{e^{\frac{x}{2}}} + 2Bx{e^{\frac{x}{2}}}\]
\[y” = \frac{1}{4}B{x^2}{e^{\frac{x}{2}}} + 2Bx{e^{\frac{x}{2}}} + 2B{e^{\frac{x}{2}}}\]
Substitute these into the original question.
\[\frac{1}{4}B{x^2}{e^{\frac{x}{2}}} + 2Bx{e^{\frac{x}{2}}} + 2B{e^{\frac{x}{2}}} – 2Bx{e^{\frac{x}{2}}} – \frac{1}{2}B{x^2}{e^{\frac{x}{2}}} + \frac{1}{4}A + \frac{1}{4}B{x^2}{e^{\frac{x}{2}}} = 3 + {e^{\frac{x}{2}}}\]
Looks awful, but you can just equate same powers on both sides. So 1/4A = 3, or A = 12. Really easy! Then 2B = 1, or B = 1/2
So the final solution is the homogeneous solution and particular solution summed up:
\[y = {c_1}{e^{\frac{x}{2}}} + x{c_2}{e^{\frac{x}{2}}} + \frac{{{x^2}}}{2}{e^{\frac{x}{2}}} + 12\]
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) +y/4 == 3+exp(x/2);
S = dsolve(eqn)
Click here to try a harder second-order ODE involving hyperbolic functions!