# Why does the domain of a function such as sqrt(x-5) /sqrt(x+2) change when rationalizing the denominator?

I was tutoring a student the other day and the above function in the title came up. I initially showed her how to get rid of the radical, and then we proceeded to find the domain of the rationalized function, which came out to (-inf, -2) U [5, inf). Imagine my surprise when we graphed the original function in the title and the domain was only [5, inf) ! I then thought about it a bit and realized it's because even though you're multiplying a function by 1, that doesn't mean the domain should stay the same (a simple case is y = x when multiplied by x/x becomes y = (x^2)/x, which has a hole at x = 0). Still, I'm uncomfortable with the idea and wanted to see if someone more mathy than me could give a good explanation, as I had never stumbled upon this [seemingly obvious?] truth until now.

Note that $\sqrt{-2}/\sqrt{-1}$ does not exist in the reals but that $\sqrt{(-2)/(-1)}=\sqrt2$ does.
Likewise, the domain of $\sqrt{x-5}/\sqrt{x+2}$ is where $x-5\geqslant0$ and $x+2\gt0$ while the domain of $\sqrt{(x-5)/(x+2)}$ is where $(x-5)(x+2)\geqslant0$ and $x+2\ne0$.