# Solve the differential equation `(dy)/(dx) + xy = xy^2` for `y` in terms of `x` given `y=3` when `x=0`

*print*Print*list*Cite

### 1 Answer

We have the differential equation `(dy)/(dx) +xy = xy^2`

and that `y=3` when `x=0`

Rearranging the differential equation we get

`(dy)/(dx) = x(y^2-y)`

`implies` `(1/(y^2-y))(dy)/(dx) =x` (terms on the left are terms in `y` and `(dy)/(dx)`, terms on the right are terms in `x`)

Now, integrate both sides with respect to `x` giving

`int (1/(y(y-1))) (dy)/(dx) dx = int x dx`

`implies` `int(1/(y(y-1))) dy = x^2/2 + c` (where `c` is a constant)

`implies int -1/y dy + int1/(y-1) dy = x^2/2 + c`

`implies` `-ln(y) + ln(y-1) = x^2/2 + k` (where `k`is a constant)

`implies` `ln((y-1)/y) = x^2/2+k`

`implies` `(y-1)/y = e^(x^2/2)e^k`

Now, we have that `y=3` when `x=0`

Substituting these values in we get

`2/3 = e^0e^k = e^k`

Therefore `(y-1)/y = 2/3e^(x^2/2)`

`implies` `y = (2/3e^(x^2/2))y +1`

`implies` `y(1-2/3e^(x^2/2)) = 1`

`implies` `y = 1/(1-2/3e^(x^2/2))` **solution**