Equality between functions?

Given are real functions as follows:
$f_{1}(x)=x, \; f_{2}(x)=\frac{x^2}{x}, \; f_{3}(x)=\sqrt{x^2}, \; f_{4}(x)=\left (\sqrt{x} \right )^2$
Are there any equal among them?

I checked the domains and codomains of the given functions, so I got:
$f_{1}: \; \mathbb{R} \rightarrow \mathbb{R}$
$f_{2}: \; \mathbb{R}\setminus\left \{ 0 \right \} \rightarrow \mathbb{R}$
$f_{3}: \; \mathbb{R} \rightarrow \mathbb{R}_{0}^{+}$
$f_{4}: \; \mathbb{R}_{0}^{+} \rightarrow \mathbb{R}_{0}^{+}$

So I concluded solely by looking at the domains and codomains that there are no equal ones amongst given functions.

But is there some further thing we need and/or CAN check to see if functions are equal?
For example, if I take another pair of functions, let it be:
$$g(x)=\frac{\left | \sin{x} \right |}{\sqrt{1-\cos^{2}x}},\;\;h(x)=\frac{\left | \cos{x} \right |}{\sqrt{1-\sin^{2}x}}$$

According to my calculations $D_{g}=D_{h}$ (which may be wrong, indeed), but the thing is, I can't come up with a way to find $K_{g}$ and $K_{h}$.

• Both functions are constant if defined: $$g(x)=\frac{\left | \sin{x} \right |}{\left | \sin{x} \right |}=1,\;\;h(x)=\frac{\left | \cos{x} \right |}{\left | \cos{x} \right |}=1$$ But $g$ is not defined for multiples of $\pi$ but $h$ is not defined for odd multiples of $\pi/2$ – gammatester Jun 24 '15 at 14:09

Note also that $\sqrt {x^2}=|x|$ .
• Yes I'm pretty sure about that part, but the second part of the question is what confuses me, comparing $g(x)$ and $h(x)$ it is. – tyr Jun 24 '15 at 14:18