I have
$$ \left| \frac{f(x)}{\sqrt{g(x)}} \right| \leq 1 \quad\quad (1)$$ for $x>0$, and $f(x)$ for some values of $x$ is positive and for some is negative. Now, when I use the identity $\left|y\right|=\sqrt{y^2}$ in $(1)$, I obtain $$ \frac{f(x)^2}{g (x)}\leq 1 \quad\quad (2).$$ But when I square both sides of $(1)$ directly, I obtain $$ \left|\frac{f(x)^2}{g (x)}\right|\leq 1 \quad\quad (3).$$
But the results of $(2)$ and $(3)$ are not the same. I will be grateful if someone explains where I am going wrong?