<s>[INST] Quick way to determine if a piecewise-defined function is injective/surjective. Let $f(x): \mathbb{R} \to \mathbb{R}$ be the map determined by:
$f(x)=\begin{cases} x &x \ge 2\\
 \frac{x^3}{4} &-1\le x < 2\\
 x &x < -1\end{cases}$
Is there an easy way to determine if this function is injective and surjective?
Injectivity means that $f(x) = f(y)$, hence for both $x>2$ and $x< -1$, $x = y$. Is the same true for $x^3\over4$?
As for surjectivity, I couldn't figure it out.
 [/INST] injectivity:  If $x \geq 2$, then $f(x) = x \geq 2$.  Moreover, if $f(x_1) = f(x_2)$, then $f(x_1) = x_1 = x_2 = f(x_2)$.
If $x < - 1$, then $f(x) = x < -1$.  Moreover, if $f(x_1) = f(x_2)$, then $f(x_1) = x_1 = x_2 = f(x_2)$.
It remains to establish that if $-1 \leq x < 2$, then $-1 \leq x < 2$ and that, if this is the case,  then $f(x_1) = f(x_2) \implies x_1 = x_2$.
We will show that $f$ is strictly increasing on this interval.  Suppose $x_1, x_2 \in [-1, 2)$ and $x_1 > x_2$.  Then 
\begin{align*}
f(x_1) - f(x_2) & = \frac{x_1^3}{4} - \frac{x_2^3}{4}\\
                & = \frac{1}{4}(x_1^3 - x_2^3)\\
                & = \frac{1}{4}(x_1 - x_2)(x_1^2 + x_1x_2 + x_2^2)\\
                & = \frac{1}{4}(x_1 - x_2)\left(x_1^2 + x_1x_2 + \frac{1}{4}x_2^2 + \frac{3}{4}x_2^2\right)\\
                & = \frac{1}{4}(x_1 - x_2)\left[\left(x_1 + \frac{x_2}{2}\right)^2 + \frac{3}{4}x_2^2\right]\\
                & > 0
\end{align*}
Thus, $f$ is strictly increasing on $[-1, 2)$.  Moreover, if $x \in [-1, 2)$, then 
$$f(-1) = \frac{(-1)^3}{4} = -\frac{1}{4} \leq x < \frac{2^3}{4} = 2$$
so, if $x \in [-1, 2)$, then $-1 < f(x) < 2$. 
Consequently, $f$ is injective.   
surjectivity: Since $f: \mathbb{R} \to \mathbb{R}$, for the function to be surjective, we require that every real number be in the range.  We have shown that 
\begin{align*}
x \geq 2 & \implies f(x) \geq 2\\
-1 \leq x < 2 & \implies -\frac{1}{4} \leq x < 2\\
x < -1 & \implies f(x) < -1
\end{align*}
Thus, $f(x) \notin [-1, -1/4)$.  Hence, $f$ is not surjective.  

The results above can be obtained more easily by sketching the function's graph.  Since a horizontal line crosses the graph at most once, the function is injective.  Since the horizontal line $y = -1/2$ does not cross the graph, the function is not surjective. 
</s>