Example 5
\begin{align*} \frac {dy}{dx} & =\frac {y^{2}-x^{2}-2xy}{y^{2}-x^{2}+2xy}\\ y\left ( 1\right ) & =-1 \end{align*}

At \(x=1,y=-1\) then \(f\left ( x,y\right ) =\frac {y^{2}-x^{2}-2xy}{y^{2}-x^{2}+2xy}\) is defined. And \(f_{y}\) is also defined at \(x=1,y=-1\). Hence a unique solution exist.

Let \(y=ux\) or \(u=\frac {y}{x}\), hence \(\frac {dy}{dx}=x\frac {du}{dx}+u\) and the above ode becomes

\begin{align*} x\frac {du}{dx}+u & =\frac {u^{2}x^{2}-x^{2}-2ux^{2}}{u^{2}x^{2}-x^{2}+2ux^{2}}\\ x\frac {du}{dx}+u & =\frac {u^{2}-1-2u}{u^{2}-1+2u}\\ x\frac {du}{dx} & =\frac {u^{2}-1-2u}{u^{2}-1+2u}-u\\ & =\frac {u^{2}-1-2u-u\left ( u^{2}-1+2u\right ) }{u^{2}-1+2u}\\ & =-\frac {u^{3}+u^{2}+u+1}{u^{2}-1+2u}\end{align*}

This is separable.

\[ \frac {du}{dx}\left ( \frac {u^{2}+2u-1}{u^{3}+u^{2}+u+1}\right ) =\frac {-1}{x}\]

Integrating gives

\begin{align*} \int \frac {u^{2}+2u-1}{u^{3}+u^{2}+u+1}du & =-\int \frac {1}{x}dx\\ -\ln \left ( 1+u\right ) +\ln \left ( 1+u^{2}\right ) & =-\ln x+c_{1}\end{align*}

Replacing \(u=\frac {y}{x}\) gives

\[ -\ln \left ( 1+\frac {y}{x}\right ) +\ln \left ( 1+\frac {y^{2}}{x^{2}}\right ) =-\ln x+c \]

Applying exponential to each side gives

\begin{align} \left ( 1+\frac {y}{x}\right ) ^{-1}\left ( 1+\frac {y^{2}}{x^{2}}\right ) & =c_{1}\frac {1}{x}\nonumber \\ \left ( \frac {x}{x+y}\right ) \left ( \frac {x^{2}+y^{2}}{x^{2}}\right ) & =c_{1}\frac {1}{x}\nonumber \\ \left ( \frac {x^{2}}{x+y}\right ) \left ( \frac {x^{2}+y^{2}}{x^{2}}\right ) & =c_{1}\nonumber \\ x^{2}+y^{2} & =c_{1}\left ( x+y\right ) \nonumber \\ c_{1} & =\frac {x^{2}+y^{2}}{x+y} \tag {1}\label {1}\end{align}

Applying IC \(y\left ( 1\right ) =-1\) to the above does not work to solve for \(c_{1}\) due to \(\frac {1}{0}\) which means \(c_{1}=\infty \). In this case we have to solve explicitly for \(y\) and then take the limit as \(c_{1}\rightarrow \infty \). Solving for \(y\) from (1) gives gives

\begin{align*} y_{1} & =\frac {1}{2}c_{1}+\frac {1}{2}\sqrt {c_{1}^{2}+4xc_{1}-4x^{2}}\\ y_{2} & =\frac {1}{2}c_{1}-\frac {1}{2}\sqrt {c_{1}^{2}+4xc_{1}-4x^{2}}\end{align*}

Taking limit \(\lim _{c_{1}\rightarrow \infty }y_{1}\) does not give finite solution. But \(\lim _{c_{1}\rightarrow \infty }y_{2}=-x\) Hence the solution is

\[ y=-x \]