# general solution of the differential equation $\frac{dy}{dx} = \frac{-k}{x}{(y-4)}{(y-2)}$

I'm trying to find the general solution of the differential equation $$\frac{dy}{dx} = \frac{-k}{x}{(y-4)}{(y-2)}$$

I assumed I could separate variables then write the RHS (functions of y as a partial fraction) however this did not give me the right answer.

The answer is y = $2 \frac{2x^{2k}-c}{x^{2k}-c}$. Those anyone know how to get to this answer?

• What did separating variables give you as a solution? Are you sure int isn't the solution you cite in disguise? – vonbrand Feb 27 '13 at 15:58
• Hint: $\frac{y-4}{y-2}=1-\frac{2}{y-2}$ – L. F. Feb 27 '13 at 16:02
• @vonbrand, it gave me ln $\frac{y-2}{y-4}$ = ln $\frac{C}{x^{2k}}$ – Ricky Rozay Feb 27 '13 at 16:12
• @L.F. How would you separate $\frac{y-2}{y-4}$ (assuming my integration above is correct). Is it 1+ $\frac{y-2}{2}$ ? – Ricky Rozay Feb 27 '13 at 16:16
• @RickyRozay $\frac{y-2}{y-4}=1+\frac{2}{y-4}$ – L. F. Feb 27 '13 at 16:20

## 2 Answers

$$\frac{dy}{dx} = \frac{-k}{x}{(y-4)}{(y-2)}$$ $$\frac{dy}{(y-4)(y-2)} = -k\frac{dx}{x}$$ $$\int \frac{dy}{(y-4)(y-2)} = \int -k\frac{dx}{x}$$ $$\frac{1}{2} (-\log(2-y)+\log(4-y))+C_1 =-k \log x+C_2$$

Let $C_2-C_1=C_3$, we get $$\frac{1}{2} (-\log(2-y)+\log(4-y)) =-k \log x+C_3$$ or $$y=\frac{2 (e^{2C_3}-2 x^{2k})}{e^{2C_3}-x^{2k}}$$ and setting $C=e^{2C_3}$ we get $$y=2 \frac{2x^{2k}-C}{x^{2k}-C}$$

The explicit expression of the solution depends heavily on the initial point $(x_0,y_0)$. Note that $y(x)\equiv 2$ and $y(x)\equiv4$ are "special" solutions of the given ODE, and that no other solution can "cross" these.

So let's assume $x_0>0$, $\ y_0>4$.

Separating variables we get $$\left({1\over y-4}-{1\over y-2}\right)dy=-{2k\over x}dx\ .$$ It follows that in a suitable window with center $(x_0,y_0)$ the solution $x\mapsto y=y(x)$ satisfies $$\int_{y_0}^y\left({1\over y'-4}-{1\over y'-2}\right)\ dy'=-2k\int_{x_0}^x{1\over x'}\ dx'$$ or $$\log{y-4\over y_0-4}-\log{y-2\over y_0-2}=-2k\log{x\over x_0}\ .$$ Rearranging terms we see that $$\log{y-4\over y-2}=-2k\log{x\over x_0}+\log{y_0-4\over y_0-2}\ .$$ Now solve for $y$.