A function f is one-one (injective) if different inputs always give different outputs, and onto(surjective) if every element of the codomain actually gets hit by something. A function that's both is called bijective. Bijective is exactly the condition a function needs to be invertible: to have a genuine inverse function that undoes it.
Worked example: checking one-one and onto
Let f:N→N be defined by f(n)=2n+1 if n is odd, and f(n)=2n if n is even. Is f one-one, onto, both, or neither?
Solution: Check a couple of small inputs: f(1)=21+1=1 and f(2)=22=1. Two different inputs, 1 and 2, give the same output, so f is not one-one. But for any target m∈N, the even input n=2m gives f(2m)=m, so every output is reachable, and fis onto.
Worked example: finding an inverse
f:N→R is defined by f(x)=4x2+12x+15. Show f:N→S (where S is the range of f) is invertible, and find the inverse.
Solution: Complete the square first:
y=4x2+12x+15=4(x+23)2+6
Since x∈N means x+23>0, this squaring step is reversible: each y comes from exactly one x, so f is invertible on its range. Solving for x:
y−6=4(x+23)2⇒x+23=2y−6⇒x=2y−6−3
So f−1(y)=2y−6−3.
Worked example: a reflection is an inverse
f(x)=(x+1)2 for x≥−1. If g(x) is the reflection of f(x) in the line y=x, find g(x).
Solution: Reflecting a graph in y=x is exactly what taking the inverse function does, so g=f−1. Setting y=(x+1)2 and solving for x (taking the non-negative root since x+1≥0):
x+1=y⇒x=y−1⇒g(x)=x−1
Continue learning
Composing two functions is the natural next skill once you can talk about a function's inverse, and the same reflexive/symmetric building blocks apply to relations more generally.