Example

The function f: R -> R given by

f(x) = ex

is injective. Namely, if f(x) = f(y), then ex = ey and thus ex - y = 1. This is only possible for x - y = 0, hence x = y. But the function is not surjective, since f(x) > 0 for all x. If we consider f as a function of R to R+, then f is bijective. The inverse function then is the natural logarithm.