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

I'm try to solve this differential equation: $y'=x-1+xy-y$

After rearranging it I can see that is a linear differential equation: $$y' + (1-x)y = x-1$$

So the integrating factor is $l(x) = e^{\int(1-x) dx} = e^{(1-x)x}$

That leaves me with an integral that I can't solve... I tried to solve it in Wolfram but the result is nothing I ever done before in the classes so I'm wondering if I made some mistake...

This is the integral: $$ye^{(1-x)x} = \int (x-1)e^{(1-x)x} dx$$

share|cite|improve this question
up vote 5 down vote accepted

The integrating factor is $e^{\int(1-x)dx}=e^{x-\frac{x^2}{2}}$

Thus: $$e^{x-\frac{x^2}{2}}y'+y(1-x)e^{x-\frac{x^2}{2}}=(x-1)e^{x-\frac{x^2}{2}}$$ $$\frac{d}{dx}[e^{x-\frac{x^2}{2}}y]=(x-1)e^{x-\frac{x^2}{2}}$$ Hence: $$e^{x-\frac{x^2}{2}}y=\int(x-1)e^{x-\frac{x^2}{2}}dx=C-e^{x-\frac{x^2}{2}}......$$

Another way to solve this is:

$$y'+(1-x)y=x-1$$ $$y'=(x-1)(y+1)$$ $$(y+1)'=(x-1)(y+1)$$ $$\frac{(y+1)'}{y+1}=(x-1)$$ $$\frac{d}{dx}[\log(y+1)]=(x-1)........$$

share|cite|improve this answer
Thanks. Can't believe that mistake I made in the integrating factor! – Tiago Costa Jan 21 '13 at 15:14

A much easier way without an integrating factor:




$\frac{dy}{(1+y)} = (x-1)dx$

$ln|1+y| = x^2/2 -x + C$

And you can do the rest

share|cite|improve this answer

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.