Artificial Intelligence 🤖
Function Basics
Inverse functions

Inverse functions

Before we move on to inverse functions, we discuss function composition. Suppose we have two functions f(x)f(x) and g(x)g(x); the composition of f(x)f(x) and g(x)g(x), denoted by (fg)(x)(f \circ g)(x), is evaluated by plugging the second function in the first function, as follows

(fg)(x)=f(g(x))(f \circ g)(x)=f(g(x))

note that the order is important and interchanging the order generally gives a different result. Consider f(x)=x+5f(x)=x+5 and g(x)=x5g(x)=x-5, then

f(g(x))=f(x5)=x5+5=x,f(g(x))=f(x-5)=x-5+5=x,

and

g(f(x))=g(x+5)=x+55=x.g(f(x))=g(x+5)=x+5-5=x .

In this case, the compositions are the same, both yielding xx,

(fg)(x)=(gf)(x)=x.(f \circ g)(x)=(g \circ f)(x)=x .

Choosing a value for xx and plugging it in the composition of ff and gg (or of gg and ff ), we end up with that same value of xx, i.e. for x=3x=3,

f(g(3))=35+5=3,f(g(3))=3-5+5=3,

and a similar result is obtained for g(f(3))g(f(3)). Whatever operation the first function does to the value of xx, the second one undoes it. An inversefunction, denoted by f1f^{-1} is a rule that undoes ff 's rule (e.g. addition and subtraction are inverse operations).

A function f(x)f(x) is one-to-one (11)(1-1) if f(a)=f(b)f(a)=f(b) whenever a=ba=b i.e. for each xx value, there exists one unique yy value. For example, f(x)=exf(x)=e^{x} is a 1 - 1 function while f(x)=sinxf(x)=\sin x on 0xπ0 \leq x \leq \pi, is not. Inverse functions exist only for 111-1 functions; if ff is not 111-1, then f1f^{-1} maps yy back to more than one xx value, violating the definition of a function.

Definition 1.1 Given two, one-to-one functions f(x)f(x) and g(x)g(x), if

(fg)(x)=(gf)(x)=x,(f \circ g)(x)=(g \circ f)(x)=x,

then g(x)g(x) is the inverse of f(x)f(x), denoted by g(x)=f1(x)g(x)=f^{-1}(x) and f(x)f(x) is the inverse of g(x)g(x), denoted by f(x)=g1(x)f(x)=g^{-1}(x).

For a 1 - 1 function ff with domain AA and range BB, its inverse f1f^{-1} has domain BB and range AA.

Inverse function theorem

If ff is strictly increasing or decreasing, then ff is a 1 - 1 function and invertible. A function is increasing if f(x1)f(x2)f\left(x_{1}\right) \geq f\left(x_{2}\right) and strictly increasing if f(x1)>f(x2)f\left(x_{1}\right)>f\left(x_{2}\right) whenever x1>x2x_{1}>x_{2} for all x1x_{1} and x2x_{2} in its domain. Similarly, a function is decreasing if f(x1)f(x2)f\left(x_{1}\right) \leq f\left(x_{2}\right) and strictly decreasing if f(x1)<f(x2)f\left(x_{1}\right)<f\left(x_{2}\right) whenever x1>x2x_{1}>x_{2}. An example of a strictly increasing function is f(x)=exf(x)=e^{x} and an example of a strictly decreasing function over R\mathbb{R} is f(x)=1/(ex+1)f(x)=1 /\left(e^{x}+1\right).

Suppose that we have an increasing function f(x)f(x); then, any tangent drawn to the curve of ff at any point is positively sloped which implies that the derivative, denoted by f(x)f^{\prime}(x) (this is the rate of change of ff with xx ), is positive 2{ }^{2}. Note that this is a sufficient but

2 A{ }^{2} \mathrm{~A} number is positive if it is greater than zero and negative if it is less than zero. A number is nonnegative if it is greater than or equal to zero. not necessary condition for a function to be strictly increasing. For instance, consider f(x)=x3f(x)=x^{3}; this is a strictly increasing function since ff increases as xx increases. However, f(x)f^{\prime}(x) is not positive at all values of xx since at x=0,f(0)=0x=0, f^{\prime}(0)=0. Increasing and strictly increasing functions never have a negative gradient. Further, strictly increasing functions can have a zero gradient provided that this occurs at what is referred to as an inflection point (like in the x3x^{3} example above).

Finding inverses

Given a function ff (assumed to be 111-1 ), we want to find the inverse function, f1f^{-1}. We outline the steps required to construct f1f^{-1} from ff next.

For a function y=f(x)y=f(x), replace every xx with yy and every yy with xx. Next, solve the resulting equation for yy. This is the inverse function since x=f1(y)x=f^{-1}(y). To verify, check that (ff1)(x)=(f1f)(x)=x\left(f \circ f^{-1}\right)(x)=\left(f^{-1} \circ f\right)(x)=x.

Example 1.3 Given f(x)=x/2+1f(x)=x / 2+1, find f1(x)f^{-1}(x)

Solution We write y=x/2+1y=x / 2+1 and replace all xx 's with yy and yy 's with xx to give x=y/2+1x=y / 2+1. Solving for yy,

y=2(x1).y=2(x-1) .

Replacing yy with f1f^{-1} gives the inverse. To verify the result,

(ff1)(x)=f(f1)(x)=x,\left(f \circ f^{-1}\right)(x)=f\left(f^{-1}\right)(x)=x,

and

(f1f)(x)=f1(f(x))=x\left(f^{-1} \circ f\right)(x)=f^{-1}(f(x))=x

There is an interesting relationship between the graphs of the functions ff and f1f^{-1}. Given a function y=f(x)y=f(x), to plot the graph of the inverse, we swap the (x,y)(x, y) coordinates of every point on the graph. Geometrically, this is represented by reflecting the graph of ff about the line y=xy=x as shown in Fig. 1.2; this is always the case with the graphs of a function and its inverse.

Derivatives

Derivatives are discussed in detail in Chapter 3; however for the purposes of this section we use the definition of the derivative as a slope of a curve at a point or, simply, the slope of the tangent line.

The derivatives of the function and its inverse are related; if (a,b)(a, b) lies on the graph of ff then (b,a)(b, a) lies on the graph of f1f^{-1} (as shown in Fig. 1.2). The slopes of the tangent lines at the inverse points are reciprocals of each other; this is true for all slopes of inverses. The graph of function ff is y=f(x)y=f(x) or equivalently x=f1(y)x=f^{-1}(y) so, we have

dxdy=ddy[f1(y)]=(dydx)1.\frac{d x}{d y}=\frac{d}{d y}\left[f^{-1}(y)\right]=\left(\frac{d y}{d x}\right)^{-1} .

Figure 1.2: The graph of the inverse of a function f(x)f(x) is a reflection of ff about the line y=xy=x. For every point (x,y)(x, y) on the graph of ff, there is a corresponding point (y,x)(y, x) on the graph of the inverse function.

Let ff be a 1 - 1 function that is differentiable on an interval I\mathcal{I}. If f1f^{-1} is the inverse of ff and f(x)0f^{\prime}(x) \neq 0 then,

(f1)(f(x))=1f(x).\left(f^{-1}\right)^{\prime}(f(x))=\frac{1}{f^{\prime}(x)} .

Note that the above result is a consequence of taking the derivative with respect to (wrt) xx on both sides of

f1(f(x))=xf^{-1}(f(x))=x

As an example, consider f(x)=exf(x)=e^{x} which is a 111-1, strictly increasing function with domain, D=R\mathcal{D}=\mathbb{R} and range, y>0y>0. Its inverse is given by the natural logarithm function denoted by ln\ln. The domain is all positive numbers and the range is all real numbers.

The natural logarithm is sometimes written as loge\log _{e} or just log (often in programming languages). Generally, given a>0a>0 and x>0x>0 with a1a \neq 1, the logarithm base aa of xx, written as logax\log _{a} x gives the exponent to which aa needs to be raised to obtain xx. That is, logax=y\log _{a} x=y means ay=xa^{y}=x. It follows that logax\log _{a} x and axa^{x} are inverses.

Back to the natural logarithm, its derivative is

ddxln=1x\frac{d}{d x} \ln =\frac{1}{x}

Using Eq. (1.6), we write y=exy=e^{x} which is equivalent to x=lnyx=\ln y,

dxdy=ddxlny=(dydx)1=1ex=1y.\frac{d x}{d y}=\frac{d}{d x} \ln y=\left(\frac{d y}{d x}\right)^{-1}=\frac{1}{e^{x}}=\frac{1}{y} .

Restricting domains

We mentioned that a function needs to be 1 - 1 to have an inverse. A non 1 - 1 function cannot have an inverse over its domain; however, we can define its inverse if we restrict the domain such that the function becomes 1 - 1 . For instance, f(x)=x2f(x)=x^{2} is not 1 - 1 for xRx \in \mathbb{R}. For the restricted functions g(x)=x2g(x)=x^{2} for x0x \geq 0 and h(x)=x2h(x)=x^{2} for x0x \leq 0, we can find an inverse.

Periodic functions such as the trigonometric functions sin, cos, tan cannot be 1 - 1 functions.

Definition 1.2 A function f(x)f(x) is periodic with period ll if

f(x+l)=f(x),f(x+l)=f(x),

for all xx. The period of ff is the smallest positive ll for which the above relation holds.

To invert those functions, we restrict the domain. A conventional choice is to restrict the domain to π/2xπ/2-\pi / 2 \leq x \leq \pi / 2 for sinx\sin x and 0xπ0 \leq x \leq \pi for cosx\cos x. Of course other domains can be used, e.g. π/2x3π/2\pi / 2 \leq x \leq 3 \pi / 2 giving different inverse trigonometric functions. The tangent function (see Fig. 1.3(a) for the graph of y=tanxy=\tan x in [2π,2π][-2 \pi, 2 \pi] ) can also be inverted by restricting the domain, say to the open interval π/2<x<π/2-\pi / 2<x<\pi / 2 [this is shown in red in Fig. 1.3(a)]. The values that form the restricted domain are called principal values. Figure 1.3(b) shows the inverse of tanx\tan x or arctan\arctan (given by y=tan1xy=\tan ^{-1} x ) restricted in the open interval (π/2,π/2)(-\pi / 2, \pi / 2).

(a)

(b)

Figure 1.3: (a) The graph of y=tanxy=\tan x in 2πx2π-2 \pi \leq x \leq 2 \pi. The red part of the graph is in π/2<x<π/2-\pi / 2<x<\pi / 2. (b) The inverse of the red part of graph in panel (a) given by y=tan1xy=\tan ^{-1} x; its range is π/2<x<π/2-\pi / 2<x<\pi / 2.

Note on trigonometric functions

Recall the elementary geometric definition of cosine\operatorname{cosine} and sine which defines cosθ\cos \theta and sinθ\sin \theta for 0<θ<π/20<\theta<\pi / 2.

Using the right triangle shown, we define

sinθ=y1 and cosθ=x1.\sin \theta=\frac{y}{1} \quad \text { and } \quad \cos \theta=\frac{x}{1} .

sinθ\sin \theta \quad We extend the definitions to the endpoints θ=0,π/2\theta=0, \pi / 2 as:

cos0=sin(π/2)=1,cos(π/2)=sin0=0.\cos 0=\sin (\pi / 2)=1, \quad \cos (\pi / 2)=\sin 0=0 .

The sine and cosine satisfy the addition formulae,

sin(α+β)=sinαcosβ+cosαsinβcos(α+B)=cosαcosβsinαsinβ;\begin{aligned} \sin (\alpha+\beta) & =\sin \alpha \cos \beta+\cos \alpha \sin \beta \\ \cos (\alpha+B) & =\cos \alpha \cos \beta-\sin \alpha \sin \beta ; \end{aligned}

which can be proven geometrically by stacking two right triangles.

OP=1,OQ=cosβ,PQ=sinβsin(α+β)=NP1=NR+RPNR=QQ;QQOQ=sinαQQ=sinαcosβ\begin{aligned} & \overline{\mathrm{OP}}=1, \overline{\mathrm{OQ}}=\cos \beta, \overline{\mathrm{PQ}}=\sin \beta \\ & \sin (\alpha+\beta)=\frac{\overline{\mathrm{NP}}}{1}=\overline{\mathrm{NR}}+\overline{\mathrm{RP}} \\ & \overline{\mathrm{NR}}=\overline{\mathrm{QQ}^{\prime}} ; \quad \frac{\overline{\mathrm{QQ}^{\prime}}}{\overline{\mathrm{OQ}}}=\sin \alpha \\ & \Rightarrow \overline{\mathrm{QQ}^{\prime}}=\sin \alpha \cos \beta \end{aligned}

Similarly, we can show,

RP=cosαsinβ\overline{\mathrm{RP}}=\cos \alpha \sin \beta

It is much easier however to prove the addition formulae using complex numbers (see Chapter 7, Section 7.2) or rotation matrices. The addition formulae can be used to extend the definitions of cosθ\cos \theta and sinθ\sin \theta to any angle. The cosine and sine can also be defined (for any angle) through a polar form. Consider a circle of radius rr centred at the origin. The coordinates of the point PP on the circle are

x=rcosθ,y=rsinθ;x=r \cos \theta, \quad y=r \sin \theta ;

where θ\theta is the angle (taken anti-clockwise) between the xx-axis and the line segment joining O\mathrm{O} and P\mathrm{P} (see below).

Using the polar form or the addition formulae.

sin(x+π/2)=cosx,cos(x+π/2)=sinx.\sin (x+\pi / 2)=\cos x, \quad \cos (x+\pi / 2)=-\sin x .

Combining the two, we have

sin(x+π)=sin[(x+π/2)+π/2]=cos(x+π/2)=sinx.\sin (x+\pi)=\sin [(x+\pi / 2)+\pi / 2]=\cos (x+\pi / 2)=-\sin x .

Similarly,

cos(x+π)=cosx\cos (x+\pi)=-\cos x

and consequently,

tan(x+π)=tanx\tan (x+\pi)=\tan x

i.e. the tangent function is periodic with period π\pi.