<s>[INST] Solving differential equation $x'=\frac{x+2t}{x-t}$ I am trying to solve the following differential equation:
$$x'=\frac{x+2t}{x-t}$$
with initial value condition: $x(1)=2$
This is what I have so far:
Substitution: $u=\frac{x}{t}$
$$\implies u't+u=\frac{2t+tu}{-t+tu}$$
Separation of variables:
$$\implies \frac{u'(u-1)}{-u^2+2u+2}=\frac{1}{t}$$
Integrate both sides:
$$\implies \int \frac{u'(u-1)}{-u^2+2u+2} dt=\int \frac{1}{t} dt \iff -\frac{1}{2}\ln(-u^2+2u+2)=\ln(t)+C$$
Solve for "$u$":
$$\implies u=1 \pm\sqrt{\frac{-1+3e^{2C}t^2}{e^{2C}t^2}}$$
Resubstitution: $u=\frac{x}{t}$
$$\implies x=t \pm t\sqrt{\frac{-1+3e^{2C}t^2}{e^{2C}t^2}}$$
Solving for "$C$" using $x(1)=2$:
$$x(1)=2=1\pm 1\sqrt{\frac{-1+3e^{2C}1^2}{e^{2C}1^2}} \implies C=-\frac{\ln(2)}{2}$$
Substituting "$C$" into the solution:
$$x=t \pm t\sqrt{\frac{-1+\frac{3}{2}t^2}{\frac{1}{2}t^2}}=t \pm t\sqrt{3t^2-2}$$
Plugging "$x$" into the differential equation:
$$1 \pm (\sqrt{3t^2-2}+\frac{6t^2}{\sqrt{3t^2-2}}) \not = \frac{3t \pm t\sqrt{3t^2-2}}{\pm t\sqrt{3t^2-2}}$$
Where did I go wrong?
 [/INST] it must be $$\frac{u-1}{-u^2+2u+2}du=\frac{dt}{t}$$
we get
$$-\frac{1}{2}\ln|-u^2+2u+2|=\ln|t|+C$$
</s>