Functions and Inverse Functions
Functions and Inverse Functions
1 Functions
Function
Definition 1.1 Let X and Y be sets. A function, f , is a rule which assigns to each x ∈ X
exactly one element y ∈ Y , denoted f (x). The element f (x) ∈ Y is called the value of f at x.
We read the symbols “f (x)” as “eff of ex”. Definition 1.1 may be represented diagrammatically
as shown in Figure 1.1.
f Y
z
X f (x)
Figure 1.1
Mapping
We sometimes use the word mapping instead of function and say f maps X into Y . This is
written as f : X → Y . If we let y = f (x) then we also write f : x → y.
Domain, Co-domain
The set X, where the function “starts” is called the domain of f and the set Y , where it
“finishes” is the co-domain of f .
Example 1.1
Example 1.2
√
Let X = R and Y = R. Suppose g(x) = ± x.
Then g is NOT a function. This is because in Definition 1.1 we have insisted that to each
element of X there corresponds exactly one element of Y . This is not so here, since both 2
and −2 correspond to 4.
Example 1.3
Notice the difference between the last two examples. It does not matter if two elements in
the domain get mapped to the same member of the co-domain. What one cannot have is one
element in the domain corresponding to more than one in the co-domain.
1
Vertical Line Test
Graphically, the critical thing in deciding whether f is a function, is that any vertical line cuts
the graph of f at most once. This is sometimes known as the vertical line test. Thus the
two graphs shown in Figure 1.2 represent functions
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
.. ..
. ..
.
Figure 1.2
On the other hand, the graph in Figure 1.3 is not that of a function, since corresponding to the
value x = x0 there are two y-values – y1 and y2 .
..
..
..
..
..
.
y2 ....................
...
..
..
..
..
..
y1 .....................
..
.
x0
Figure 1.3
Example 1.4
Range
Definition 1.2 Suppose f : X → Y . Then the range of f is the set {f (x) | x ∈ X}.
Example 1.5
2
x - f - f (x)
Figure 1.4
This way of looking at a function has the merit of emphasizing that the function is the rule
which produces the results; the function is not the results themselves. Thus f is the function,
not f (x), which is an element of the range.
Example 1.6
Solution
Example 1.7
3
If g(x) = , find g(2), g(5), g(2r) and g(1/x).
x+1
Solution
We have
3 3 1 3 3 3x
g(2) = = 1, g(5) = = ; g(2r) = , g(1/x) = = .
2+1 5+1 2 2r + 1 1/x + 1 1+x
Composition
Now suppose f : X → Y and g : Y → Z. If we start with an element x ∈ X, we can find
f (x) ∈ Y . Since g has domain Y , and f (x) lies in Y we can find g(f (x)) ∈ Z. This process is
illustrated in Figure 1.5.
Z
X Y
f : g
f (x)
x g(f (x))
z
:
g◦f
Figure 1.5
Notice that to each element x ∈ X there corresponds a unique element g(f (x)) ∈ Z. Thus we
have a new function mapping X to Z, called the composition of g with f , denoted g ◦ f or
sometimes simply gf . This is generated by first performing f , then g.
The order is crucial; g ◦ f means first do f , then g. This happens in everyday life as well.
If g is the operation “take off your clothes” and f is “have a shower”, then doing g first and
then f will have a very different effect from doing f first and then g!
3
Example 1.8
Suppose f : x → x2 + 3 and g : x → 2x + 1. Find f (2), f (3), g(f (2)), g(f (3)), f (g(2)),
f (g(3)) and in general find f (g(x)) and g(f (x)).
Solution
and
g(f (3)) = 2.12 + 1 = 25.
On the other hand,
f (g(2)) = f (5) = 52 + 3 = 28,
while
f (g(3)) = 72 + 3 = 52.
Note that g(f (2)) 6= f (g(2)) and g(f (3)) 6= f (g(3)). In general
while
g(f (x)) = g(x2 + 3) + 1 = 2x2 + 7.
Inverse Function
Definition 1.3 Suppose f : A → B. Then, provided it exists, the inverse of f is the function
f −1 : B → A such that if f : x → y, then f −1 : y → x.
The phrase “provided it exists” is necessary, as we shall see in a little while. We can illustrate
the idea of f −1 as in Figure 1.6.
f
-
y
A x
B
¾
f −1
Figure 1.6
1
Please note that the notation f −1 (x) DOES NOT MEAN .
f (x)
Now let us consider two examples to see how the definition works.
4
Example 1.9
f −1 : 5 → 1, f −1 : 10 → 2, f −1 : 15 → 3 and f −1 : 1 → 0.2.
Example 1.10
g −1 : 4 → 1, g −1 : 5 → 2 and g −1 : −4 → −7.
Unfortunately, things can go wrong in two ways, which is why we needed the phrase “pro-
vided it exists” in Definition 1.3. To illustrate the first problem consider the following.
Example 1.11
Let f (x) = x2 . Then f (2) = 4 and f (−2) = 4. Should we then say f −1 (4) = 2 or
f −1 (4) = −2 or perhaps f −1 (4) = ±2?
.. 4
.........................
.. ...
.. ..
..
... ..
.. ..
.. ..
.. ..
−2 2
Figure 1.7
The problem is that because two different values of x have the same value of y, then each
value of y does not have a unique corresponding value of x. This means that f −1 is no
longer a function.
One-to-one Function
Definition 1.4 Let f : A → B. Then f is one-to-one if whenever x1 6= x2 then f (x1 ) 6=
f (x2 ).
5
f (x2 ) ............................
..
f (x1 ) = f (x2 ) ............................. ..
f (x1 ) ........ ..
.. .. ..
... ... ... ...
. . . .
x1 x2 x1 x2
Not one-to-one One-to-one
Figure 1.8
Example 1.12
Suppose g : R → R is given by
g(x) = 2x .
Then g(1) = 2, so g −1 (2) = 1, g(3) = 8, so g −1 (8) = 3, but what is g −1 (−2)? We have no
value for g −1 (−2) because there is no value of x such that g(x) = −2. To put it another
way, the range of g is not all of R (Figure 1.9).
8 ....................
..
..
..
..
..
..
..
..
..
..
..
2 ............ ..
.. ..
.. ..
.. ..
1 2
...........................................
−2
Figure 1.9
Onto Function
Definition 1.5 Let f : A → B. Then f is onto if for each y ∈ B there corresponds at least
one point x ∈ A such that f : x → y.
6
Example 1.13
f (x) = x2 + 1
Figure 1.10
Geometrically speaking, given f : R → R, then f is onto if each horizontal line cuts the
graph of f at least once (Figure 1.11).
.................................
Onto Not onto
Figure 1.11
Example 1.14
Solution
We have
f (2) = 8; f (3) = 11; f −1 (f (2)) = f −1 (8) = 2;
and since f (1/3) = 3, it follows that f −1 (3) = 1/3.
(a) f −1 (f (x)) = x
(b) f (f −1 (y)) = y
(c) (f −1 )−1 = f .
7
Proof. (i) Suppose f (x) = y. Then
f −1 (y) = x.
Hence
f −1 (f (x)) = f −1 (y) = x.
(ii) and (iii) are similar.
Example 1.15
Solution
Example 1.16
2
Suppose g(x) = . Find g −1 (x).
x+1
Solution
2
y=
x+1
so
2
x= − 1.
y
Thus
2
g −1 (y) = x = −1
y
and so
2
g −1 (x) = − 1.
x
Example 1.17
2
Let f (x) = 2x − 3 and g(x) = . Find (f ◦ g)(x), g −1 (f −1 (x)) and (f ◦ g)−1 (x).
x+1
8
Solution
³ 2 ´ 4
(f ◦ g)(x) = f = − 3.
x+1 x+1
Also using the previous two examples
³x + 3´ 4
g −1 (f −1 (x)) = g −1 = − 1.
2 x+3
−1
Now to find (f ◦ g) (x). Let
y = (f ◦ g)(x),
i.e.
(f ◦ g)−1 (y) = x.
We have shown that
4
y = (f ◦ g)(x) = − 3.
x+1
Solving for x gives
4
x= − 1 = (f ◦ g)−1 (y).
y+3
Thus
4
(f ◦ g)−1 (y) = − 1,
y+3
or equivalently
4
(f ◦ g)−1 (x) = − 1.
x+3
Notice that in this case we obtained
(f ◦ g)−1 (x) = g −1 (f −1 (x)).
This was no coincidence. If we think of g as the operation “put on your socks” and f as “put
on your shoes”, them f ◦ g is “put on your socks and shoes” (in that order). Now g −1 will be
“take off your socks”, while f −1 is “take off your shoes”. Then (f ◦ g)−1 is “take off your shoes
and socks”. This is achieved by first taking off your shoes, f −1 , and then your socks, g −1 , i.e.
(f ◦ g)−1 = g −1 ◦ f −1 .
The above argument is, of course, nothing like a proof, which we shall now give.
9
The heavy curves represent f, g and f ◦ g, light ones represent f −1 , g −1 and g −1 ◦ f −1 .
−1
(f ◦ g)
¾
¾
g −1 ¾
f −1
x y z
- -
g f
-
f ◦g
Figure 1.12
Example 1.18
1
Suppose f (x) = 2x + 5, g(x) = . Find f −1 (x), g −1 (x), (g −1 ◦ f −1 )(x), (f ◦ g)−1 (x),
1+x
f −1 (f (x)).
Solution
y = 2x + 5.
Then
y−5
x= = f −1 (y),
2
and so
x−5
f −1 (x) = .
2
In the same way,
1
g −1 (x) = − 1.
x
Now ³x − 5´ 2
(g −1 ◦ f −1 )(x) = g −1 = − 1.
2 x−5
By Theorem 1.8
2
(f ◦ g)−1 (x) = (g −1 ◦ f −1 )(x) = − 1.
x−5
Finally f −1 (f (x)) = x by Theorem 1.7(a).
10
y = 2x .
...y = x
(1, 2) .....
...
.....
...
.....
.
...
..... (2, 1)
....
... x = 2y
.....
..
...
...
Figure 1.13
Thus the graph of f −1 is just the graph of f reflected about the line y = x. As another
illustration, the graphs of f (x) = x3 and f −1 (x) = x1/3 are shown in Figure 1.14.
y = x3
y=x
y = x1/3
Figure 1.14
Finally, it is important to note that even if f is not one-to-one and onto, one can still talk
meaningfully about f −1 after some adjustments.
For example suppose f (x) = x2 . If we consider f as a mapping from R to R then f is not
onto since, for example, there does not exist a number x ∈ R such that f (x) = −1. However,
if we consider f as a mapping from R to R+ = {x ∈ R | x ≥ 0}, then f is onto. Thus by
restricting the co-domain of f we can always adjust matters so that f is onto.
Unfortunately f is still not one-to-one. However, if we now regard f as a mapping from R+
to R+ – that is we delete half of the domain – then it becomes one-to-one.
√
Having done this, f −1 exists and indeed f −1 (x) = x (see Figure 1.15).
f (x) = x2 f (x) = x2
1
............................. 1 ...............
.. .. ..
.. .. ..
.. .. ..
..
..
..
.. ...
. . ..
−1 1 1
Figure 1.15
11
2 Power and Logarithmic Functions
We now wish to consider functions of the form
f (x) = ax
x −2 −1 0 1 2 3
3x 1/9 1/3 1 3 9 27
2x 1/4 1/2 1 2 4 8
1x 1 1 1 1 1 1
2−x = (1/2)x 4 2 1 1/2 1/4 1/8
3x
2−x 2x
1x
Figure 2.1
Note that (1/2)x = (2−1 )x = 2−x . It is now easy to see what the graph of ax or a−x will
look like for any a > 1. Note that ax > 0 for all x.
Now suppose
f (x) = y = ax .
Then f : R → (0, ∞), and if we regard f as mapping onto (0, ∞) then it is both one-to-one and
onto. Hence f −1 : (0, ∞) → R exists and f −1 (y) = x.
Logarithms
We shall write this inverse function as
f −1 (y) = loga x.
The expression f −1 (y) is called the logarithm of y to the base a, or simply the log of y to
base a. Note that since the range of f is (0, ∞) the domain of f −1 is also (0, ∞). Thus loga y
is defined only for y > 0.
For example, we know that 8 = 23 . Substituting into (1), it follows that 3 = log2 8.
Similarly, since 1/100000 = 10−5 , then log10 (1/100000) = −5. Finally, since 21/2 ≈ 1.414, then
log2 1.414 ≈ 1/2.
12
Now we know that 1 = a0 for any a 6= 0. Then by (1)
Let us now try to plot the graph of f (x) = log2 x. By the remarks after (1) we know that
log2 x is only defined for x > 0. Now we have the following table of values.
1 8
Figure 2.2
Note that when x = 0, the y-axis is a vertical asymptote. The graph is rising as we move to
the right, but more and more slowly. The shape is identical to the graph of 2x differing only
in that it has been reflected in the line y = x. This is a consequence of the fact that 2x is the
inverse function of log2 x (see Section 1).
y = 2x y=x
y = log2 x
Figure 2.3
13
(c) loga y b = b loga y.
y = ab and z = ac ,
so
yz = ab .ac = ab+c .
Again by (1)
b + c = loga (yz),
and so
loga y + loga z = loga (yz).
(b) is similar.
(c) Let loga y = x. Then by (1) y = ax , so
y b = abx .
Hence by (1)
bx = loga y b ,
and so
b loga y = loga y b ,
as required.
Now recall that if f (x) = ax then f −1 (x) = loga x. From the general theory of inverse
functions we know that f (f −1 (x)) = x and f −1 (f (x)) = x. This leads us to the general
properties
x = by and a = bz .
Hence
ay = bzy = byz = (by )z = xz .
Taking logs to base a of both sides we find
y = z loga x,
and so
y logb x
loga x = = ,
z logb a
as required.
14
1
Corollary 2.3 If a, x > 1 then loga x = .
logx a
Proof. Let b = x in Theorem 2.2. The result then follows using (3).
Theorem 2.2 is useful in finding logs to other bases. Suppose for example, we wish to find
log5 9. By Theorem 2.2
log10 9 0.9542
log5 9 = = = 1.3651
log10 5 0.6990
(using a calculator).
Example 2.1
Solution
Example 2.2
Solution
(a) We have
log10 2x = log10 100,
so
x log10 2 = 2,
i.e.
2
x= (= 6.6439).
log10 2
(b)
3x−1 = 142,
so
(x − 1) log10 3 = log10 142.
Thus
log10 142 2.1523
x=1+ =1+ (= 1.66096).
log10 3 0.4771
Note that in the above two calculations we could have used logarithms to any base. In fact
part (a) is expressed most elegantly in terms of logarithms to base 2, where we have
or
x = log2 100/ log2 2 = log2 100.
Unfortunately most calculators will not give values of logarithms to any other bases than
10 and another number e, which we shall meet in a while.
15
Example 2.3
A bank gives an interest rate of 12% per annum. How long will it take to double one’s
investment?
Solution
Let P be the initial investment. After x years this will amount to P (1.12)x . We want the
amount to be 2P , so which leads to
2P = P (1.12)x .
This yields
2 = (1.12)x ,
hence
log10 2 = x log10 1.12,
so
log10 2 0.30103
x= = = 6.116 years.
log10 1.12 0.04922
(It is worth noting that the time to double one’s money is independent of the money invested.)
Example 2.4
The amount of radioactivity given off by a substance decreases by 5% every hour. After
how long will it be 1% of its original value?
Solution
Let the original value be R. After x hours the amount will be R(0.95)x . We wish to solve
the equation
R/100 = R(0.95)x .
Then
1
log10 = x log10 0.95,
100
so
2
x=− = 89.78 hours.
log10 0.95
16
y
1
y = sin x
−π −π/2 3π/2
x
π/2 π 2π
−1
Figure 3.1
The relevant part of the graph is boldly marked in Figure 3.1. Deleting all the irrelevant parts
we obtain the graph shown in Figure 3.2.
1
−π/2
π/2
−1
Figure 3.2
The choice of the interval [−π/2, π/2] is dictated by the fact that on this interval the range
of f is still [−1, 1], i.e. no values on the y-axis are left out. We could equally well choose
[47π/2, 49π/2] but that would be perverse. Now we see that if we regard f as a function
mapping [−π/2, π/2] to [−1, 1], it is both one-to-one and onto. It will then have an inverse.
Thus
f : [−π/2, π/2] → [−1, 1] (5)
that is
domain(f ) = [−π/2, π/2] and range(f ) = [−1, 1].
−1 −1
The inverse f (x) is denoted sin x or, in many texts, arcsin x. It follows that
so
domain(f −1 ) = [−1, 1] and range(f −1 ) = [−π/2, π/2].
1
The notation sin−1 x should not be confused with (sin x)−1 = .
sin x
Now if sin x = y and x ∈ [−π/2, π/2], then x = sin−1 y and y ∈ [−1, 1]. One can think
of sin−1 x as√meaning the angle
√ in [−π/2, π/2] whose sine is x. For √ example, we know that
−1
sin π/4 = 1/ 2. So sin
√ (1/ 2) = π/4, i.e. the angle whose sine is 1/ 2 is π/4. It is also true
that sin = 3π/4 = 1/ 2.
17
√
IT DOES NOT FOLLOW THAT sin−1 (1/ 2) = 3π/4, since 3π/4 is not in the range of
sin−1 (see (6)).
We can easily plot the graph of sin−1 x by considering a few values. Thus
π/2
y = sin−1 x
−1 1
−π/2
Figure 3.3
Notice that the graph is the same shape as that of sin, but it has been reflected in the line
y = x, as follows from the general theory of inverse functions.
It is tempting to think that the following relations hold:
The second is true. However, the first is true only if x ∈ range(f −1 ), i.e. if x ∈ [−π/2, π/2].
For example if x = 2π, then sin x = 0, but
sin−1 (sin x) = sin−1 0 = 0 6= 2π = x.
An exactly analogous process can be used to define cos−1 and tan−1 . Let us deal with these
in turn. Noting the graph of g(x) = cos x in Figure 3.4,
y = cos x
−1
Figure 3.4
we see again that g is neither one-to-one nor onto; but if we consider g as a mapping from [0, π]
to [−1, 1] it becomes both one-to-one and onto (Figure 3.5).
18
1
π/2 π
−1
Figure 3.5
The choice of the interval [0, π] is again dictated by our desire to give the full range [−1, 1].
Then the inverse g −1 = cos−1 (also written arccos) exists. Now
i.e.
domain(g) = [0, π], and range(g) = [−1, 1].
So
g −1 : [−1, 1] → [0, π]
or
domain(g −1 ) = [−1, 1], range(g −1 ) = [0, π].
1
Again cos−1 x should not be confused with .
cos x
Thus if cos x = y and x ∈ [0, π] then x = cos−1 y, and y ∈ [−1, 1]. For example, we know that
cos π/3 = 1/2. Hence cos−1 (1/2) = π/3. The graph of cos−1 can be plotted just as that of
sin−1 was (see Figure 3.6).
π/2 y = cos−1 x
−1 1
Figure 3.6
Exactly the same sort of argument applies to tan−1 . Here it is clearly desirable to restrict
ourselves to the interval (−π, π) (see Figure 3.7).
19
y = tan x
−π −π/2 π/2 π
Figure 3.7
Then if y = tan x and x ∈ (−π, π), it follows that x = tan−1 y. For example, tan π/4 = 1, so
tan−1 1 = π/4. The graph of tan−1 can be plotted as before (Figure 3.8).
π/2
y = tan−1 x
−π/2
Figure 3.8
Example 3.1
√
Evaluate : (a) sin−1 3/2 (b) tan−1 (−1) (c) cos−1 (−1/2).
Solution
√
(a) Let y = sin−1 3/2.
√ √
Then sin y = 3/2 and −π/2 ≤ y ≤ π/2. Since sin π/3 = 3/2, y = π/3.
Example 3.2
π
Let x ∈ [−1, 1]. Show sin−1 x + cos−1 x = .
2
20
Solution
sin(π/2 − y) = cos y = x.
Thus
π
− y = sin−1 x.
2
(Note that 0 ≤ y ≤ π, so −π/2 ≤ π/2 − y ≤ π/2.) Thus
π
y + sin−1 x = ,
2
whence the required formula follows.
Example 3.3
1 1 π
Show tan−1 + tan−1 = .
3 2 4
Solution
Let
x = tan−1 (1/3).
Then −π/2 < x < π/2 and tan x = 1/3.
Since tan−1 0 = 0 and tan−1 1 = π/4, we can even say 0 < x < π/4.
Similarly, letting y = tan−1 (1/2), we have tan y = 1/2 and 0 < y < π/4.
Hence 0 < x + y < π/2. Using the addition formula for tan,
21