# Proving a function is onto and one to one

I’m reading up on how to prove if a function (represented by a formula) is one-to-one or onto, and I’m having some trouble understanding.

To prove if a function is one-to-one, it says that I have to show that for elements $a$ and $b$ in set $A$, if $f(a) = f(b)$, then $a = b$. I understand this to mean that if two elements in a domain map to the the same element in a codomain, then for the function to be one-to-one, they must be the same element because by definition, a one-to-one function has at most one element in the domain mapped to a particular element in the co-domain. Did I understand this correctly?

Then to prove that the function is onto, I’m reading an example that says “let’s prove that $f: \mathbb{R} \rightarrow \mathbb{R}$ defined by $f(x) = 5x+2$ is onto, where $\mathbb{R}$ denotes the real numbers. We let $y$ be a typical element of the codomain and set up the equation $y =f(x)$. then, $y = 5x+2$ and solving for $x$ we get $x ={y-2\over 5}$. Since $y$ is a real number, then ${y-2\over 5}$ is a real number and $f({y-2\over 5})=5({y-2\over 5})+2=y.$

I’m not really seeing how that proves anything, so can anybody explain this to me?

#### Solutions Collecting From Web of "Proving a function is onto and one to one"

Yes, your understanding of a one-to-one function is correct.

A function is onto if and only if for every $y$ in the codomain, there is an $x$ in the domain such that $f(x) = y$.

So in the example you give, $f:\mathbb R \to \mathbb R,\quad f(x) = 5x+2$, the domain and codomain are the same set: $\mathbb R.\;$ Since, for every real number $y\in \mathbb R,\,$ there is an $\,x\in \mathbb R\,$ such that $f(x) = y$, the function is onto. The example you include shows an explicit way to determine which $x$ maps to a particular $y$, by solving for $x$ in terms of $y.$ That way, we can pick any $y$, solve for $f'(y) = x$, and know the value of $x$ which the original function maps to that $y$.

Side note:

Note that $f'(y) = f^{-1}(x)$ when we swap variables. We are guaranteed that every function $f$ that is onto and one-to-one has an inverse $f^{-1}$, a function such that $f(f^{-1}(x)) = f^{-1}(f(x)) = x$.

A function $f:A\rightarrow B$ is one-to-one if whenever $f(x)=f(y)$, where $x,y \in A$, then $x=y$. So, assume that $f(x)=f(y)$ where $x,y \in A$, and from this assumption deduce that $x=y$.

A function $f: A\rightarrow B$ is onto if every element of the codomain $B$ is the image of some element of $A$. Let $y\in B$. We can show that there exists $x\in A$ such that $f(x)=y$. Choose $x=f^{-1}(y)$ and so $f(f^{-1}(y))=y$. So for all $y\in B$, there exists an $x\in A$ such that $f(x)=y$.

You can imagine that a function of X to Y is injective when you can “enter” a copy of X to Y.

$f\colon X\to Y$ is injective if and only if:

• $x\neq y\Rightarrow f(x)\neq f(y)$, or
• If $f(x)=f(y)\Rightarrow x=y$

Intuition says that you can have a replica of $X$ in $Y$, it means for all $x\in X$ there are a $y\in Y$ which $f(x)=y$ and there are not other $x’$ with the same statement, $\therefore$ Y contains a copy of the set X

Note

• It works for $X\to Y$, if we want something similar from $Y\to X$ it is called surjective.
• Is possible that for some $y\in Y, \not{\exists}x\in X$ such $f(x)=y$