# `(x-1)y' + y = x^2 -1` Solve the first-order differential equation Given` (x-1)y'+y=x^2-1`

when the first order linear ordinary differential equation has the form of

`y'+p(x)y=q(x)`

then the general solution is,

`y(x)=((int e^(int p(x) dx) *q(x)) dx +c)/e^(int p(x) dx)`

so,

`(x-1)y'+y=x^2-1`

=> `(x-1)[y' + y/(x-1)] = x^2 -1`

=> `y'+y/(x-1)= ((x+1)(x-1))/(x-1)`

=> `y'+y/(x-1)= (x+1)` --------(1)`

`y'+p(x)y=q(x)---------(2)`

on comparing both we get,

`p(x) = 1/(x-1) and q(x)=(x+1)`

so on solving with the above general solution we get:

y(x)=`((int e^(int p(x) dx) *q(x)) dx +c)/e^(int p(x) dx)`

=`((int e^(int (1/(x-1))dx) *(x+1)) dx +c)/e^(int(1/(x-1)) dx)`

first we shall solve

`e^(int (1/(x-1)) dx)=e^(ln|x-1|) = |x-1|`

When `x-1<=0 ` then `ln(x-1)` is undefined , so

`e^(int(1/(x-1)) dx)=x-1`

so

proceeding further, we get

y(x) =`((int e^(int (1/(x-1))dx) *(x+1)) dx +c)/e^(int(1/(x-1)) dx)`

=`((int (x-1)*(x+1)) dx +c)/(x-1)`

=`((int (x^2-1) ) dx +c)/(x-1)`

= `(x^3/3 -x  +c)/(x-1)`

` y(x)=(x^3/3 -x +c)/(x-1)`

Approved by eNotes Editorial Team