Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

$y'' - 4y' + 5y = 25x - 3e^2x$

Where $y(0)=0$ and $y'(0)=0$

This is what I have done so far:-

$r^2 - r + 5 = 0$ $\sqrt{b^2-4ac} < 0$ ...... I get $2\pm i$

Thus $y(x)=e^2x(A\cos x + D\sin x)$

How do I find $A$ and $D$? Substitute $y(0)=0$ into the equation?

What about the right hand side equation? This is what I did for that... $g = 25x-3e^2x$ $g' = 25-6e^2x$ $g'' = -12e^2x$

Then I sub the values, giving me

$-12e^2x - 4(25-6e^2x) + 5(25x-3e^2x) = 25x - 3e^2x$

which will give me $x = 1$

Am I doing any of this right?

share|cite|improve this question
The y(x) that you found is the solution to the homogeneous equation. Because when you put x=0 into the right hand side, you get 0, so you know that y'(0)=0, y''(0)=0. So yes, you can substitute to find A,D. Now, you need to find 1 particular solution of the equation, ie: find g(x), such that g''-4g'+5g=right hand side. The solution of the above equation will be y+g(x). In the above equation, is this $e^{2x}$ or $e^2 *x $?? From "what about..." is wrong to me. – Long Mai May 16 '12 at 9:39
@David: I think you applied a wrong characteristic equation above. If your equation was as you wrote, you would have a char. equation $r^2-4r+5=0$ associated with the homogeneous equation. – Babak S. May 16 '12 at 9:40
Yes, as Sorouh said, the char.equation is wrong also. – Long Mai May 16 '12 at 9:42
@David: you should put $y(x)=e^{2x}$($A$cos($x$)+$D$sin($x$)) into your original equation, so you can find the requried constants. – Babak S. May 16 '12 at 9:47
up vote 2 down vote accepted

Solving an imhomogenous ODE is done in two steps.

  1. Determine the general solution to the corresponding homogenous ODE.
  2. Find a particular solution to the inhomogenous ODE.

It looks like youve done the first part correctly, but for completeness I'll repeat it here. Consider $$ y'' - 4y' + 5y = 0.$$ This is a linear ODE, so we know that our solutions are going to be exponentials. Substitute $y = \exp[rx]$ into the equation and find that: $$ r^2 - 4r + 5 = 0.$$ We solve using the quadratic formula and find that $r = 2 \pm i$. Since $r$ is complex, the solution is a combination of exponential growth and oscillation: $$ y(x) = Ae^{2x}\cos(x) + Be^{2x}\sin(x).$$ This is the general solution. Up to this point your answer is good. It's only in the second step that you've gone a little off track. There are a couple of ways to find particular solutions; I like the method of undetermined coefficients (this is the technical term for making an educated guess). If we look at the inhomogenous equation $$ y'' - 4y' + 5y = 25x - 3e^{2x}$$ we notice that the right hand side is the sum of a polynomial and an exponential. Our educated guess is that the particular solution will also be the sum of a polynomial and an exponential, $$y_{p} = Ce^{2x} + Dx + E.$$ Now we substitute this into the inhomogenous expression and solve for $C$, $D$ and $E$. $$ 4Ce^{2x} -4(2Ce^{2x} + D) + 5(Ce^{2x} + Dx +E) = 25x - 3e^{2x},$$ $$5Dx +(5E - 4D) + (4C - 8C + 5C)e^{2x} = 25x -0 - 3e^{2x},$$ comparing the coefficients of the $x$ terms shows that $D = 5$, comparing the constants shows that $E = 4$ and comparing the coefficients in front of the exponential shows that $C = -3$. The solution we want is just the sum of the general and particular solutions, $$ y = Ae^{2x}\cos(x) + Be^{2x}\sin(x) -3e^{2x} +5x +4.$$ To calculate the values of $A$ and $B$ you use the given initial values, $y(0) = 0$ and $y'(0)=0$. $$ y(0) = A -3 + 4 \Rightarrow A = -1.$$ $$ y'(0) = 2B - 6 + 5 \Rightarrow B = \frac{1}{2}.$$ Substitute these back into the expression for the solution to get the final answer. $$ y = -e^{2x}\cos(x) + \frac{1}{2}e^{2x}\sin(x) -3e^{2x} +5x +4.$$

share|cite|improve this answer
What would happen if the RHS of the equation was for example $25x-3e^{2x}$cos($x$)? I think you should put some points in your complete answer before you mentioned"... Since $r$ is complex..." – Babak S. May 16 '12 at 13:45
@BabakSorouh, you're right, there are some special cases that we should consider and a more complete answer would address them. If I have time tomorrow I may edit in some additional detail and perhaps even solve for the particular solution using variation of parameters. – in_wolframAlpha_we_trust May 16 '12 at 13:55
@in_wolfram_we_trust Thanks for the help, I was a little confused for the second part but i'm pretty sure I get it more now. Just asking, what if the RHS is different for example if given 4e^-3x - 5cos(5x) - 3sin(5x). How to figure out the Yp? Or even cos4x - 8e^3x for the RHS – David May 17 '12 at 1:35
@David, as long as the RHS is 'simple' then you can determine $y_{p}$ using the method of undetermined coefficients. So if the right hand side is $4e^{-3x} - 5\cos(5x) -3\sin(5x)$, the sum of an exponential and some trig functions, I'd assume that $y_{p} = Ae^{-3x} + B\cos(5x) +C\sin(5x)$, also the sum of an exponential and some trig functions. Substitute in and solve for the constants. If the RHS is more complicated, or the functions in the RHS are the same as the solution to the homogenous ODE then you have to use a different approach, e.g. variation of parameters. – in_wolframAlpha_we_trust May 17 '12 at 6:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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