Why is $f(x) = |x|$ not surjective? Can anyone explain to me why the function
$$
f(x)=|x|
$$
is not surjective (onto)?
I think it should be, but my teacher told me it's not.

$f \colon X \to Y$ is said to be onto if for each $y \in Y$, there exists $x \in X$ such that $f(x)=y$.
You have not specified the domain and codomain of the your function.
In fact, it is onto when you consider it as a function from $\mathbb R$ to $[0,\infty)$. 
However, it is not onto when considered as a function from $\mathbb R$ to $\mathbb R$ as there does not exist a pre-image for any $x<0$.
