## Piecewise functions are continuous via composition

Let
$
f(x) = \left\{
\begin{array}{ll}
x^2 & : x \geq 0\\
x & : x < 0
\end{array}\right.
$

Suppose you want to show f is a continuous function for all x.

Since function f is continuous at a if
$
f(a) = \lim_{x->a} f(x)
$

and a function is continuous on its domain if the above holds for all x in the domain, one could say:

$\lim_{x -> 0} f(x) = 0$
$a \geq 0: f(a) = a^2 = \lim_{x -> a} x^2$
$a < 0: f(a) = a = \lim_{x -> a} x$

Therefore the function f is continuous.

My professor scratched his head for moment before agreeing it made sense, so I'm guessing there's a more conventional form for expressing this idea.
What is it, I can't wait for my next class.