# Second Order Diffrential Equation

$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?

-
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. –  user1412 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. –  user1412 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

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.$$
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
@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