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.
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.
It depends on your definition of $f$. Consider $f : \mathbb R \to \mathbb R$ where $x \mapsto |x|$, this is certainly not surjective because every negative value $(-\infty, 0)$ is not mapped to by $f$.
Whereas one could define $f : \mathbb R \to [0, \infty)$, which would be surjective, but not injective.
$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$.
hint
Assume $f $ is considered as function defined from $\mathbb R $ to $\mathbb R $.
$$\forall x\in\mathbb R \;\; f (x)=|x|\ge 0$$
$$\implies f (\mathbb R)\subset [0,+\infty)$$ $$\implies f (\mathbb R)\ne \mathbb R $$
$\implies \; f $ is not surjective.