I am new to differential equations, to solve $y'+2y=3e^t$ I used the method of variation of constant and I get $y=e^t+Ce^{-2t}$ but when I use another method I get a different answer (I don't know the name of this method)

$(y'+2y=3e^t)*I(t) \Rightarrow Iy'+2yI=3Ie^t$

$(Iy)'=I'y+Iy'=Iy'+2yI \Rightarrow I'y=2yI \Rightarrow I'=2I$

$I=Ce^2t \Rightarrow \int(Iy)'=\int 3Ie^t \Rightarrow ye^{2t}=e^{3t} \Rightarrow y=e^t$

$y=e^t+Ce^{2t} ≠ y=e^t+Ce^{-2t}$

-

The method you are trying to use here is called the integrationg factor method: http://en.wikipedia.org/wiki/Integrating_factor

In this case, the integrating factor can be $$I(t)=\exp\left( \int_0^t2ds\right)=e^{2t}.$$ You got this right.

Then multiply the ode by $I(t)$: $$e^{2t}y'+2e^{2t}y=3e^{3t}\quad\Leftrightarrow\quad (e^{2t}y)'=3e^{3t}.$$ Now integrate and don't forget the integration constant: $$e^{2t}y(t)=e^{3t}+C \quad\mbox{hence}\quad y(t)=e^t+Ce^{-2t}.$$

Alternative: the method of undetermined coefficients.

Given the rhs, we know we can look for a particular solution of the form $$y_p(t)=Ce^t.$$

Plugging this into the ode, we find that for $C=1$, we do get a solution: $$y_p(t)=e^t.$$

Then add the general solution of the homogeneous equation $y_h(t)=Ae^{-2t}$ to get $$y(t)=Ae^{-2t}+e^t$$ the general solution of the ode.

-
@julianfernandez Then you should have made your comment below the OP's post... not below my answer. –  1015 Feb 19 '13 at 5:14
@julien After I substituted into the original equation for positive one I mean, the equation didn't satisfy , so it means positive one doesn't work? Am I correct –  Hooman Feb 19 '13 at 5:15
@Hooman No matter what method you use, the general solution of your ode is $y(t)=e^t+Ce^{-2t}$. Anything different doesn't work. –  1015 Feb 19 '13 at 5:17
Thanks perfect solution –  Hooman Feb 19 '13 at 5:20
@Hooman You're welcome. I'm glad if I could help. –  1015 Feb 19 '13 at 5:21

You essentially had it. It's correct that $I$ (the integrating factor, a slightly different but essentially equivalent method) is equal to $Ce^{2t}$. The arbitrary constant would just get cancelled (since it can be moved out of the derivative and exists on both sides), so we can ignore it. We then have

$$(ye^{2t})'=3e^{3t}$$

$$ye^{2t}=e^{3t}+C$$

Don't forget the constant of integration! This is the arbitrary constant you care about that will show up in the final solution. Just isolate for $y$:

$$y=e^{t}+Ce^{-2t}$$

Forgetting constants of integration is a common pitfall when solving ODEs. If something bizarre like this shows up again, in my experience "did I forget the constant?" is one of the first things you should be asking yourself.

-
Thanks Man,perfect solution –  Hooman Feb 19 '13 at 5:21