4.1 Functions on the real line: definitions and basic examples

Throughout the remainder of the course, we are interested in studying functions f:f\colon\mathbb{R}\to\mathbb{R} (or f:Ef\colon E\to\mathbb{R} for some subset EE\subseteq\mathbb{R}). Here we present many examples of such functions, in order to impress upon the reader their variety.

Some familiar functions

We begin by recalling some familiar functions which you will have seen in your earlier studies and which, indeed, we have already used extensively in previous chapters.

Polynomials.

We say p:p\colon\mathbb{R}\to\mathbb{R} is a polynomial if there exists some d0d\in\mathbb{N}_{0} and real coefficients c0c_{0}, c1c_{1}, \dots, cdc_{d}\in\mathbb{R} such that

p(x):=cdxd+cd1xd1++c1x+c0for all x.p(x):=c_{d}x^{d}+c_{d-1}x^{d-1}+\cdots+c_{1}x+c_{0}\qquad\text{for all $x\in% \mathbb{R}$.}

A concrete example is the function f1(x):=x2f_{1}(x):=x^{2} for all xx\in\mathbb{R}, illustrated in Figure 4.1. Polynomials are particularly simple functions, because they are defined purely using the basic algebraic operations of addition and multiplication.

Rational functions.

Suppose pp, q:q\colon\mathbb{R}\to\mathbb{R} are two polynomials and qq is not identically zero. Then we can define E:={x:q(x)0}E:=\{x\in\mathbb{R}:q(x)\neq 0\} and

r:E,r(x):=p(x)q(x)for all xE.r\colon E\to\mathbb{R},\qquad r(x):=\frac{p(x)}{q(x)}\qquad\text{for all $x\in E% $.}

In this case, we call r:Er\colon E\to\mathbb{R} a rational function. As a concrete example, we have the function f:{0}f\colon\mathbb{R}\setminus\{0\}\to\mathbb{R} given by f(x):=1/xf(x):=1/x for all x{0}x\in\mathbb{R}\setminus\{0\}. The graph of this function is shown in Figure 4.3.

Figure 4.3: The rational function f:{0}f\colon\mathbb{R}\setminus\{0\}\to\mathbb{R} given by f(x):=1/xf(x):=1/x.

Trigonometric functions.

The sine function sin:\sin\colon\mathbb{R}\to\mathbb{R} and cosine function cos:\cos\colon\mathbb{R}\to\mathbb{R} are important examples which will feature frequently in our discussion. It is worth recalling the geometric meaning behind these functions.

Take a circle in the plane of radius 11, centred at the origin. This intersects the xx-axis at the point A:=(1,0)A:=(1,0) and has circumference 2π2\pi. Given θ[0,2π)\theta\in[0,2\pi), starting from AA we traverse anticlockwise an arc of the circle of length θ\theta to arrive at BB: see Figure 4.4. This corresponds to an angle of θ\theta radians. Then, in xx-yy coordinates, the point BB is given by B=(cosθ,sinθ)B=(\cos\theta,\sin\theta). We can take this to be the definition of the sin\sin and cos\cos: they correspond to coordinates of points on the circle.

Figure 4.4: Definition of the trigonometric functions sin\sin and cos\cos.

The above describes the definition of sin\sin and cos\cos for θ[0,2π)\theta\in[0,2\pi), but the same works for θ\theta\in\mathbb{R}: we just allow ourselves to potentially loop round the circle multiple times (for θ<0\theta<0 we travel round the circle in a clockwise, rather than anticlockwise, direction).

The functions sin\sin and cos\cos satisfy the important angle summation formulæ

sin(θ+ψ)\displaystyle\sin(\theta+\psi) =sinθcosψ+cosθsinψ,\displaystyle=\sin\theta\cos\psi+\cos\theta\sin\psi,
cos(θ+ψ)\displaystyle\cos(\theta+\psi) =cosθcosψsinθsinψ,\displaystyle=\cos\theta\cos\psi-\sin\theta\sin\psi,

for all θ\theta, ψ\psi\in\mathbb{R}, to which we shall frequently refer. These formulæ  can be proved using trigonometry.

New functions from old

Using the basic building blocks of polynomials, rational functions, trigonometric functions, exponentials and logarithms, we can build many new examples of functions. A simple way to do this is to form sums, differences, products and ratios. For instance, the tangent function tan:=sin/cos:(π/2,π/2)\tan:=\sin/\cos\colon(-\pi/2,\pi/2)\to\mathbb{R} is defined as the ratio between sin\sin and cos\cos. However, there are many alternative methods for constructing new functions from old.

Piecewise definition.

One way to define new functions is to patch them together using pieces of existing functions. Rather than give a precise definition of this procedure, we simply illustrate it through some concrete examples.

Example 4.1.

Consider the functions g:g\colon\mathbb{R}\to\mathbb{R} and h:h\colon\mathbb{R}\to\mathbb{R} defined piecewise by

g(x):={xfor x0,xfor x>0.andh(x):={x2for x1,x2+1for x>1g(x):=\begin{cases}-x&\text{for $x\leq 0$,}\\ \sqrt{x}&\text{for $x>0$.}\end{cases}\qquad\text{and}\qquad h(x):=\begin{cases% }x^{2}&\text{for $x\leq 1$,}\\ x^{2}+1&\text{for $x>1$}\end{cases}

We illustrate the graphs of these functions in Figure 4.5.

Figure 4.5: The piecewise-defined functions g:g\colon\mathbb{R}\to\mathbb{R} and h:h\colon\mathbb{R}\to\mathbb{R} from Example 4.1.

The piecewise-defined functions in Example 4.1 are made up of two pieces. However, there is nothing to stop us using many more pieces if we wish. The following example has infinitely many pieces!

Example 4.2.

Consider the function f:(0,1)f\colon(0,1)\to\mathbb{R} given by

f(x):=(n+1)(1nx)if 1n+1x<1n for some n.f(x):=(n+1)(1-nx)\qquad\text{if $\displaystyle\frac{1}{n+1}\leq x<\frac{1}{n}$% for some $n\in\mathbb{N}$.}

This is an example of a piecewise-defined function with infinitely many pieces: we specify the values of ff on the intervals [1/2,1)[1/2,1), [1/3,1/2)[1/3,1/2), [1/4,1/3)[1/4,1/3), and so on. We sketch the graph of this function in Figure 4.6(a).

Using piecewise definitions we can construct remarkably complicated and pathological functions.

Example 4.3 (Dirichlet function).

We define χ:\chi_{\mathbb{Q}}\colon\mathbb{R}\to\mathbb{R} by

χ(x):={1if x,0if x.\chi_{\mathbb{Q}}(x):=\begin{cases}1&\text{if $x\in\mathbb{Q}$,}\\ 0&\text{if $x\in\mathbb{R}\setminus\mathbb{Q}$.}\end{cases}

Because the rationals and irrationals are both dense subsets of \mathbb{R} (see Section 1.6), this function is very complicated and it is impossible to accurately plot. Nevertheless, it is common to use a pair of dotted lines to provide a schematic for the graph, as in Figure 4.6(b).

(a) f:(0,1)f\colon(0,1)\to\mathbb{R} from Example 4.2.
(b) Schematic of the Dirichlet function.
Figure 4.6: Further examples of piecewise-defined functions.

Composition.

Given functions f:Ef\colon E\to\mathbb{R} and g:g\colon\mathbb{R}\to\mathbb{R}, we can consider the composition gf:Eg\circ f\colon E\to\mathbb{R}. This can often lead to interesting and useful functions. Here we describe an important explicit example, formed by composing sin\sin and 1/x1/x.

Example 4.4.

Let f:f\colon\mathbb{R}\to\mathbb{R} be defined by

(4.1) (4.1) f(x):={sin(1/x)if x0,0if x=0.f(x):=\begin{cases}\sin(1/x)&\text{if $x\neq 0$,}\\ 0&\text{if $x=0$.}\end{cases}

We sketch the graph of ff in Figure 4.7. For xx near 0, the function sin(1/x)\sin(1/x) oscillates very rapidly.11 1 You can zoom in on an interactive version of this graph online, at https://www.desmos.com/calculator/sbysutrdl3

Figure 4.7: The highly oscillatory function f:f\colon\mathbb{R}\to\mathbb{R} as defined in (4.1).

We remark that Example 4.4 is also another example of a piecewise-defined function. Here the piecewise definition was used to get around the fact that 1/x1/x is not defined at x=0x=0, allowing us to define ff on the whole of \mathbb{R}.

The exponential function

Another method for constructing functions is to use convergent sequences and series. A very important example of this is the exponential function. Given xx\in\mathbb{R}, consider the series k=0xkk!\sum_{k=0}^{\infty}\frac{x^{k}}{k!}. By the ratio test (Theorem 3.32), this series always converges absolutely, and therefore converges, no matter the value of xx. This observation allows us to make the following definition.

Definition 4.5 (The exponential function).

We define exp:\exp\colon\mathbb{R}\to\mathbb{R} by

(4.2) (4.2) exp(x):=k=0xkk!for all x.\exp(x):=\sum_{k=0}^{\infty}\frac{x^{k}}{k!}\qquad\text{for all $x\in\mathbb{R% }$.}

The exponential function is one of the most important functions in all of mathematics. You will likely have encountered it in your earlier courses (although perhaps not defined in the same way) and will be aware it plays an important role in algebra and differentiation. You will also likely be familiar with its graph, as illustrated in Figure 4.8. Later in the course, we shall explore why the various properties of the exponential function hold and why the graph looks the way it does. For now, we record the important properties in the following proposition.

Figure 4.8: Graphs of the exponential and natural logarithm functions.
Proposition 4.6 (Properties of the exponential function).
  1. 1

    The image of exp\exp is (0,)(0,\infty) (that is, exp(x)>0\exp(x)>0 for all xx\in\mathbb{R}).

  2. 2

    exp:(0,)\exp:\mathbb{R}\to(0,\infty) is injective.

  3. 3

    exp:(0,)\exp:\mathbb{R}\to(0,\infty) is surjective.

Proof (Partial).

Here we consider only the case of x0x\geq 0.

  1. 1.

    This follows from the fact that the series in (4.2) always takes positive values. For x0x\geq 0, we can see that all terms in the series in (4.2) are non-negative, and the first term is always 11.

  2. 2.

    For y>x0y>x\geq 0, it follows immediately from (4.2) that

    exp(y)>exp(x).\exp(y)>\exp(x).

    From this we see that exp\exp is injective on [0,)[0,\infty).

  3. 3.

    We defer a proof until later in the chapter (see Example 4.97).

For x<0x<0, it is less straightforward to determine the behaviour of exp\exp directly from (4.2). Nevertheless, we shall see that exp\exp is in fact injective on the the whole real line and exp(x)>0\exp(x)>0 for all xx\in\mathbb{R}. We shall ‘borrow’ this result for now, and prove it later in the course.

The natural logarithm

One further method for constructing functions is to take inverses. Here we illustrate this through the example of the natural logarithm.

As discussed above, exp:(0,)\exp\colon\mathbb{R}\to(0,\infty) is both injective and surjective. Since exp\exp is both injective and surjective, we know from Introduction to Mathematics at University that it is bijective, and therefore we can define its inverse.

Definition 4.7 (The natural logarithm function).

We define log:(0,)\log\colon(0,\infty)\to\mathbb{R} to be the inverse of the exponential function exp:(0,)\exp\colon\mathbb{R}\to(0,\infty).

Remark 4.8.

The notation ln\ln is often used for the natural logarithm, rather than log\log. However, here, and very likely throughout many of your mathematics courses, the notation log\log will always be used to denote the natural logarithm.

As log\log is the inverse of exp\exp, its graph is formed by reflecting the graph of exp\exp across the diagonal line x=yx=y, as shown in Figure 4.8.