Showing $|x|=\sqrt{x^2}, \: \forall x \in \mathbb{R}$

44 Views Asked by At

I will like to show

$|x|=\sqrt{x^{2}}$ for all $x \in \mathbb{R}$

I define $f(x):=\sqrt{x^{2}}$ and $g(x):=|x|$.

For $x \ge 0$ I have $f(x)=\sqrt{x^{2}}=x$

For $x < 0$ I have $f(x)=\sqrt{x^{2}}=-x$

This is exactly what $g(x)$ does. So $f(x)=g(x)$.

Is this a valid proof?

Kind regards,