# Homework Help: Solve Y'=x-y

1. Jan 12, 2006

### Jameson

y'= x-y

I'm in Calc II and my teacher said that this isn't separable. I know this can be solved though. Does this involve an integrating factor? Any help and I'll try to finish it. This isn't for homework though.

2. Jan 12, 2006

### TD

You can solve the homogenous DE y'+y = 0, find a particular solution of the complete DE and add those.

3. Jan 12, 2006

### HallsofIvy

That's not separable but it is a linear equation and there is a simple formula for the integrating factor of a linear equation. For this equation, which could be written as y'+ y= x, an integrating factor would be a function p(x) such that p(x)y'+ p(x)y= (p(x)y)'= p(x)x.
(p(x)y)', by the product rule, is equal to p(x)y'+ p'(x)y. If that is equal to p(x)y'+ p(x)y, then p(x)y'+ p'(x)y= p(x)y'+ p(x)y which gives you a simple de for p(x).

4. Jan 12, 2006

### Jameson

Hmm.. that makes sense. How do I go about finding p(x) though?

5. Jan 12, 2006

### d_leet

Well if you have a linnear differential equation of the form
y' + q(x)y = r(x)
you want to find the integrating factor p(x) such that
p(x)y' + p(x)q(x)y = p(x)r(x) and p(x)y' + p(x)q(x)y is integrable.
If you look at that expression it looks a lot like teh product rule doesn't it
$$\frac d {dx}$$ [p(x)y] = p(x)y' + p'(x)y
well if we want p(x)y' + p(x)q(x)y to be integrable as a product we know that
p'(x) = p(x)q(x) must be true so you can solve this differential equation which is seperable so you should be able to find a general equation for the integrating factor p(x)

6. Jan 13, 2006

### HallsofIvy

I just told you that:
From p(x)y'+ p'(x)y= p(x)y'+ p(x)y, subtract p(x)y' from both sides to get
p'(x)y= p(x)y. Divide both sides by y (which, presumably, is not identically 0) to get p'(x)= p(x). That equation should be simple.

7. Mar 29, 2006

### Jameson

Ok, so since this post I've done some work of basic D.E. and can do this problem now. Thanks to the above posters for their help. I'm going to restate some things that are said above just for my own sake.

We have y+y'=x. Now I want to find an integrating factor p(x) such that d\dx(p(x)y)=p(x)+p(x)y'. Solving this out yields that p(x)=p'(x), so obviously this integrating factor is $e^x$.

Multiplying through by the integrating factor shows that:
$$\frac{d}{dx}\left((e^x)y\right)=xe^x$$

So integrating by parts gives that:$$(e^x)y=xe^x-e^x+C$$

Thus $$y=x-1+\frac{C}{e^x}$$ and I confirm this with the original D.E.

Look good?