Find the general solution to the ODE $x\frac{dy}{dx}=y-\frac{1}{y}$ I have been working through an ODE finding the general solution and following the modulus through the equation has left me with four general solutions, as shown below. Online ODE solvers, however, have only calculated the two (positive and negative), on the right hand side of the page. Am I incorrect with my use of the modulus operator after I integrated each side then?
$$\begin{align*}x\frac{dy}{dx}&=y-\frac{1}{y}\quad\quad(-1<y<1)\\
\int\frac{1}{y-\frac{1}{y}}\ dy&=\int\frac{1}{x}\ dx\\
\int\frac{y}{y^2-1}\ dy&=\int\frac{1}{x}\ dx\\
\frac{1}{2}\ln{|y^2-1|}&=\ln{|x|}+c\\
\sqrt{|y^2-1|}&=A|x|\ \text{, where $A=e^c$}\\
|y^2-1|&=A^2x^2\\
\implies y^2-1&=A^2x^2&1-y^2&=A^2x^2\\
y^2&=A^2x^2+1&y^2&=1-A^2x^2\\
\\
\therefore y&=\pm\sqrt{Kx^2+1}&y&=\pm\sqrt{1-Kx^2}\ \text{, where $K=A^2$}\\
\end{align*}$$
Thanks :)
 A: If $-1<y<1$ then $|y^2-1|=1-y^2$.
Another approach: Write the equation as
$$\dfrac{x\ dy-y\ dx}{x^2}=\dfrac{-1}{x^2y}\ dx$$
or
$$\left(\dfrac{y}{x}\right)d\left(\dfrac{y}{x}\right)=\dfrac{-1}{x^3}\ dx$$
and
$$\left(\dfrac{y}{x}\right)^2=\dfrac{1}{x^2}+C$$
A: Another approach is this. Rewrite the DE as
$$
\frac{yy'}{y^2-1}=\frac 1x
$$
Which is the same as
$$
\frac 12 \frac{d}{dx}\ln(y^2-1)=\frac 1x
$$
Upon integration, one gets
$$
\ln\dfrac{y^2(x)-1}{y^2(x_0)-1}=2\ln\frac{x}{x_0}
$$
Hence, one obtains
$$
y^2(x)=1+[y^2(x_0)-1]\left(\frac{x}{x_0}\right)^2
$$
A: Your solutions are $\pm\sqrt{1\pm Kx^2}$, where $K$ is positive. But this does not differ from $\pm\sqrt{1+Kx^2}$ where $K$ is unconstrained.

From
$$\frac12\log|y^2-1|=\log|x|+C$$ you draw
$$\log|y^2-1|=\log(e^Cx^2)$$ and
$$|y^2-1|=e^Cx.$$
Then
$$y^2=1\pm e^Cx^2$$ which you can very well rewrite as
$$y^2=1+Dx^2.$$
A: The equation in question is $$xy'(x)=y(x)-\frac1{y(x)},$$ and you are looking for functions $y:\mathbb{R}\setminus\{0\}\rightarrow\mathbb{R}$ which satisfy the above equation and the inequality $-1\lt{y(x)}\lt1,$ as well as the implicit $y(x)\neq0.$ Given these restrictions, we have that $$\frac{y(x)}{y(x)^2-1}y'(x)=\frac1{x},$$ which implies $$\ln[1-y(x)^2]=2\ln(-x)+C_-,\,x\lt0$$ $$\ln[1-y(x)^2]=2\ln(x)+C_+,\,x\gt0.$$ This is equivalent to $$1-y(x)^2=\begin{cases}e^{C_-}x^2&x\lt0\\e^{C_+}x^2&x\gt0\end{cases}$$ which is equivalent to $$y(x)^2=\begin{cases}1-A_-x^2&x\lt0\\1-A_+x^2&x\gt0\end{cases}$$ where $A_-=e^{C_-}$ and $A_+=e^{C_+},$ thus $A_-,A_+\gt0.$ However, further restrictions are needed. The latest equation implies that $\forall{x\lt0},$ $0\leq1-A_-x^2$ and $1-A_-x^2\lt1,$ which is equivalent to  $A_-x^2\leq1$ and $A_-x^2\gt0,$ but while the latter is trivial, because $A_-\gt0$ and $x^2\geq0,$ we also have that $\forall{x\lt0},\,A_-x^2\leq1,$ which is impossible, becuase this implies $A_-=0,$ due to the Archimedean property of real numbers. A similar case occurs with $A_+.$ Therefore, there is no such a function satisfying the equation everywhere. Instead, we should consider searching for functions $y:(a,0)\cup(0,b)\rightarrow\mathbb{R}$ satisfying the conditions. Thus, $$y(x)^2=\begin{cases}1-A_-x^2&a\lt{x}\lt0\\1-A_+x^2&0\lt{x}\lt{b}\end{cases},$$ so $\forall{a\lt{x}\lt0},$ $0\leq1-A_-x^2$ and $1-A_-x^2\lt1,$ hence $A_-x^2\leq1$ and $A_-x\gt0,$ with the latter being trivial, and the former being equivalent to $x^2\leq\frac1{A_-}.$ Since we know that $a\lt{x}\lt0,$ we have that $a=\frac1{\sqrt{A_-}},$ so $A_-=\frac1{a^2}.$ The analysis for $A_+$ is completely analogous, and results in $A_+=\frac1{b^2}.$
Therefore, if we look for functions $y:(a,0)\cup(0,b)\rightarrow\mathbb{R}$ satisfying the differential equation and the restrictions, then $y$ must also satisfy $$y(x)^2=\begin{cases}1-\frac{x^2}{a^2}&x\in(a,0)\\1-\frac{x^2}{b^2}&x\in(0,b)\end{cases}.$$
This results in two solutions. However, four solutions could result if $y$ was not constrained by the inequality.
