Solve DE: $$y'' + 2y' + 5y = x + 4$$

I have the correct general solution $$y(x) = c_1\,e^{-x}\cos(2x) + c_2\,e^{-x}\sin(2x)\ .$$

So I take my 'guess' , take a couple of derivatives, and plug in for the equation $$2A +5(Ax + B) = x + 4$$

But at this point I'm stuck on solving for the constants. I attempted in several times but I'm just getting a jumbled mess. I realize that this is probably simple algebra I'm struggling with here

  • $\begingroup$ Do you have some initial conditions? $\endgroup$ – Emilio Novati Feb 27 '15 at 21:05
  • $\begingroup$ What is your guess? $\endgroup$ – Git Gud Feb 27 '15 at 21:08

You need your equation to hold for all $x$, right? Then the parts that depend on $x$ must be equal ($5Ax = x$) and the parts that do not depend on $x$ must be equal; thus $A$ and $B$ must satisfy

$$ 5A = 1 \\ 2A + 5B = 4. $$

Can you solve for $A$ and $B$ from here?


The ansatz for $y_p = A x + B$ put in the DE gives $2A + 5(Ax + B) = x + 4$ where you compare coefficients for $x^k$, here $x^1=x$ and $x^0=1$, on both sides of the expanded equation. Finally $y = y_h + y_p$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.