# Differential Equation

1. Feb 8, 2009

### ganondorf29

1. The problem statement, all variables and given/known data
Solve the inital value first order linear differential equation

y'=y+x y(0) = 2

2. Relevant equations

3. The attempt at a solution

y'-y=x

That's as far as I got. I'm not sure how to approach this. I've looked through my notes and book, and I don't have any examples that are similar to this. I looked online and it said something about raising the coefficient of y to e, but I'm not sure what to do after.

2. Feb 8, 2009

### MathematicalPhysicist

You should multiply by an exponential factor.
y'-y=x
exp(-x)y'-exp(-x)y=exp(-x)x
(exp(-x)y)'=exp(-x)x
Usually the exponential factor is of the form:
if y'+f(x)y=g(x)
then the exponential factor is:
u=exp($$\int f(x)dx$$)
Take the integral of xexp(-x) by parts, and then your'e done.

3. Feb 8, 2009

### bsodmike

Hi; I tried using an integration factor, and using the initial value provided (y(0)=2), I arrived at a particular solution of $$y=x-1+3e^{-x}$$.

I just saw loop's reply above. The integration factor I obtained was $$e^x$$.

4. Feb 9, 2009

### HallsofIvy

Staff Emeritus
For the linear equation y'+ f(x)y= g(x), and integrating factor is a function m(x) such that multiplying by it, m(x)y'+ m(x)f(x)y= f(x)g(x), reduces the left side to a single derivative: (m(x)y)'. Since, by the product rule, (m(x)y)'= my'+ m'y= my'+ mfy, we must have m'= m(x)f(x) which is, itself, a separable differential equation: dm/m= f(x)dx so $ln(m)= \int f(x)dx$ and so $m(x)= e^{\int f(x)dx}$. For this particular problem f(x) is the constant -1 so your integrating factor is $e^{-x}$, not $e^x$. Multiplying the equation by $e^{-x}$, we have $e^{-x}y'- e^{-x}y= (e^{-x}y)'= xe^{-x}$. Integrating both sides of that (the left side by parts, as loop quantum gravity said) you get $e^{-x}y= -(x+1)e^{-x}+ C$ or $y= -x- 1+ Ce^x$ and, since y(0)= 2, 2= -1+ C and C= 3.
$y= -x-1+ 3e^x$

Notice that if $y= x- 1+ 3e^{-x}$ then $y'= 1- 3e^{-x}$ while $y+ x= x- 1+ 3e^{-x}+ x= 2x- 1+ 3e^{-x}$ so your y does NOT satisfy the differential equation.

Last edited: Feb 9, 2009
5. Feb 9, 2009

### bsodmike

Thanks for pointing out that mistake Ivy...