Function mapping, which is both one to one and onto?

For the function $f(x)= \sqrt x$ which of the following mappings is both one to one and onto?

1. $f : \mathbb{R} \to \mathbb{R}$
2. $f : \mathbb{R} \to \mathbb{R}^+$
3. $f : \mathbb{R}^+ \to \mathbb{R}^+$
4. $f : \mathbb{R}^+ \to \mathbb{R}$

Sorry for the incorrect formatting on this stuff, I'm pretty new to this. I don't think that it is 4, because the square root of a positive real number is a positive real, but I am not sure about the rest. Could someone help with the rest of this? Thanks!

• You should also ask the question of whether or not $f$ is a function in the first place. A few things to notice: $f(-1)$ is undefined, $f(x)\geq 0$ for all non-negative $x$. – JMoravitz Dec 2 '16 at 5:16
• Your reasoning is correct about why it's not 4. To figure out the correct answer, you first need to have a clear understanding of what happens when you take the square root of a number. If that number is positive, you already said what happens. What happens if it's negative or 0? – user52969 Dec 2 '16 at 5:17

$x=\sqrt{x^2}$ and $\sqrt{x^2} = \sqrt{y^2}$ implies $x = y$, and thus $x^2 = y^2$.
It fails to be a function from $\mathbb{R}$ to $\mathbb{R}$ (or a subset thereof) because the $\sqrt{}$ of a real number does not exist (or is imaginary). Moreover it cannot surject to $\mathbb{R}$ because the $\sqrt{}$ is never negative (by definition).