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?