I've been working on proving that this is a onto function:
$f$ : $\mathbb R$ $\to$ $\mathbb R^{\geq0}$ is defined by $f(x)=|x|$
My proof so far: Let $y\in\mathbb R$.
Rough work: $|x|=y \Rightarrow \sqrt {x^2}=y \Rightarrow n^2=y^2 \Rightarrow \pm x=\pm y$
Suppose $f(\pm y)=|\pm y|=y$.
I know that this function is definitely onto given the co-domain of $\mathbb R^{\geq0}$, but I feel like my proof is flawed. Am I supposed to individually account for the $-x$ and the $+x$ from $\pm x=\pm y$ when trying to solve $f(x) = y$?
Thanks!
In order to show that the function is onto (surjective) it is enough to argue that for each $y$ in the codomain there is at least one $x$ in the domain that maps to it.
You seem to be trying to find all of the $x$ such that $f(x)=y$, which is more work than you need to do and creates a rather large detour.
You could just say:
(Even this is more verbose than it really needs to be, but in exercises at this elementary level it is good to be explicit about the details, to show that you know what you're doing).