# 2 ways to solve an ODE, different solutions…

Given the ODE $$y'= \left( \frac{x+2y+1}{2x-6} \right)$$

I have tried two methods to solve this equation. One method is seperate variables: $$(2x-6 )dy = (x+2y+1)dx$$ integrating gives $$2(xy-3y)=x^2+2xy+x+c$$, simplifying we get $$y= -(x^2+x+c)/6$$\

But on the other hand, if I try to solve by using an integrating factor u(x), I get a different solution. The method I used was rewrite in standard linear form, find integrating factor by calculating $u(x) = e^(\int p(x)dx)=1/(3-x)$. In the end I found that the solution was $y=(3-x)(2/(x-3)+1/ log(x-3) + C$

Whats going on?

-
Did you do a sanity check and take the derivative of both answers to see if either is correct? –  tpg2114 Nov 23 '12 at 12:20
@Hempo: You can't use the first method! what is $\int ydx$? –  Dennis Gulko Nov 23 '12 at 12:23
Separation of variables applicable here: $Y(y)\mathrm d\,y=X(x)\mathrm d\,x$. –  FrenzY DT. Nov 23 '12 at 13:05
Ok. The correct reasoning is that y(x) is a function of x, and hence it cannot be seen as a constant if you integrate it –  MSKfdaswplwq Nov 25 '12 at 13:10
Remember that $y$ is a function of $x$, so $\int ydx\neq xy$ and $\int xdy\neq xy$.