Before defining the inverse of a function we need to have the right mental image of function.
Consider the function f(x) = 2x + 1. We know how to evaluate f at 3, f(3) = 2*3 + 1 = 7. In this section it helps to think of f as transforming a 3 into a 7, and f transforms a 5 into an 11, etc.
Now that we think of f as "acting on" numbers and transforming them, we can define the inverse of f as the function that "undoes" what f did. In other words, the inverse of f needs to take 7 back to 3, and take -3 back to -2, etc.
Let g(x) = (x - 1)/2. Then g(7) = 3, g(-3) = -2, and g(11) = 5, so g seems to be undoing what f did, at least for these three values. To prove that g is the inverse of f we must show that this is true for any value of x in the domain of f. In other words, g must take f(x) back to x for all values of x in the domain of f. So, g(f(x)) = x must hold for all x in the domain of f. The way to check this condition is to see that the formula for g(f(x)) simplifies to x.
g(f(x)) = g(2x + 1) = (2x + 1 -1)/2 = 2x/2 = x.
This simplification shows that if we choose any number and let f act it, then applying g to the result recovers our original number. We also need to see that this process works in reverse, or that f also undoes what g does.
f(g(x)) = f((x - 1)/2) = 2(x - 1)/2 + 1 = x - 1 + 1 = x.
Letting f-1 denote the inverse of f, we have just shown that g = f-1. http://dl.uncw.edu/digilib/mathematics/algebra/mat111hb/functions/inverse/inverse.html