# What are the different ways to prove a function is onto

you take $f(x)$ and isolate $x$?

For instance $f(x) = x^2 = \sqrt{y} = x$

Set A = all rational numbers

Set B = all rational numbers

The function is not onto because $\sqrt{y}$ is an irrational number.

Is this the only way to prove that a function is onto?

What are the different techniques?

-
The example you have written is confusing. What is $y$? Did you really mean to write $x^2 = \sqrt y$? – Brad Nov 3 '12 at 23:09
I think you are confusing how the find the inverse of a function, i.e. $f^{-1}$ (if one exists), and what it means to say a function $f: A \to B$ is "onto" – amWhy Nov 3 '12 at 23:35

Let $f: \mathbb{R} \to \mathbb{R}$ be the function defined by $f(x) = x^2$ (as in your example, such that $A = B =$ the set of real numbers $\mathbb{R}$).

The reason why, in this case, $f(x)$ is not onto $\mathbb{R}$ is because there exists (infinitely many) values in $\mathbb{R}$ (specifically all negative real numbers) for which there IS NO $x \in \mathbb{R}$ such that $f(x)=x^2 < 0$. For example, consider the real number $-4$; is there any real number $x$ such that $f(x)= x^2 = -4$?

No.

So $f(x) = x^2$ is not onto $\mathbb{R}$. (It also is not one-to-one).

Can you think of other examples of functions that are not onto?

Here's another example: let $g: \mathbb{N} \to \mathbb{N}$ with $g(x) = 2x$.

So the domain of g is all natural numbers: $\{1, 2, 3, 4, ...\}$. But the range (or rather image) of $g$ is only those numbers in $\mathbb{N}$ that are even: $\{2, 4, 6, 8, ...\}$. So for any odd number in $\mathbb{N}$, say 3, e.g. has an $x \in \mathbb{N}$ such that $g(x) = 2x = 3$.

Note that a function may not be onto one particular range, but can be onto another particular range. In the first example, above, if we let $\mathbb{R^*}$ denote the set of all non-negative real numbers, then $f: \mathbb{R} \to \mathbb{R^*}$, with $f(x) = x^2$, then $f(x)$ is onto $\mathbb{R^*}$. Can you see why? And in the second example, if we define $g: \mathbb{Q} \to \mathbb{Q}$, then $g(x) = 2x$ is indeed onto $\mathbb{Q}$.

-
+1 I think if you made the OP a picture, the words would make more senses. :) – Babak S. Aug 3 '13 at 9:09

Typically, given a function $f: A \rightarrow B$, you take an arbitrary element $b \in B$ and then try to find $a \in A$ such that $f(a) = b$.

Of course, this is basically just appealing to the definition of "onto". Specific functions might suggest other techniques, e.g., graphing.

Trying to imagine a sort of $f^{-1}$ (even when it's not actually a function) can certainly be helpful. For example, if you have $f: \mathbb{Q} \rightarrow \mathbb{Q}$ defined by $f(x) = x^2$, then we can think of $f^{-1}$ as being somewhat like taking a square root, as you did. You might then think about $\sqrt{2}$ as irrational, and realize that there is no rational number $p/q$ for which $f(p/q) = \sqrt{2}$. Thus, $f$ is not onto.

There are a few other techniques that might come up sporadically (e.g., the composition of appropriate onto functions is onto), but the best way to learn how to prove functions are onto is simply by doing lots of problems.

-

As a minor but important point, it is necessary to provide a specific $a\in \mathbb{Q}$ so that $\sqrt{a}\notin \mathbb{Q}$. So, to say that for arbitrary $x\in \mathbb{Q}$, $\sqrt{x} \notin \mathbb{Q}$ is not true. Take $\frac{4}{9}$, for example. Provide a specific $a$ or at least show that one such $a$ exists. For instance, take $a=2\in \mathbb{Q}$. Otherwise, proving by the definition and providing an $a\in \mathbb{Q}$ for every $b\in \mathbb{Q}$ so that $a=\sqrt{b}$ as the other answer suggests.

-