6.2 Examples of functions of a real variable

This section gives examples of important classes of functions whose domain is a subset of \mathbb{R}. Even if these are familiar from previous studies, you should make sure you understand these definitions in the context of the formal definition of a function in Definition 6.1.

6.2.1 Polynomials

Definition 6.8 (Polynomial, polynomial function).

Suppose a0,a1,a2,,ana_{0},a_{1},a_{2},\ldots,a_{n} are real numbers, with an0a_{n}\neq 0. The expression

a0+a1x+a2x2++anxna_{0}+a_{1}x+a_{2}x^{2}+\cdots+a_{n}x^{n}

is called a polynomial with real coefficients. The numbers a0,a1,a2,,ana_{0},a_{1},a_{2},\ldots,a_{n} are called coefficients. The integer nn is called the degree of the polynomial. The special polynomial 0 has degree 0.

We can use this algebraic expression to define a polynomial function p:p:\mathbb{R}\to\mathbb{R} given by the formula

p(x)=a0+a1x+a2x2++anxn.p(x)=a_{0}+a_{1}x+a_{2}x^{2}+\cdots+a_{n}x^{n}.

If a polynomial has degree nn, we call the coefficient in front of xnx^{n} the leading coefficient of the polynomial.

Note that there is a subtle difference between a polynomial and a polynomial function. Polynomials (i.e. expressions of the form a0+a1x+a2x2++anxna_{0}+a_{1}x+a_{2}x^{2}+\cdots+a_{n}x^{n} as above) can be treated as mathematical objects in their own right and are studied in the field of abstract algebra. Whereas, polynomial functions must also have a domain and codomain. In practice, mathematicians are often informal about the difference between a polynomial and polynomial function. This informality rarely causes problems, especially when the domain and codomain are \mathbb{R}, but it is good to keep clear in your mind what sort of mathematical object you are working with.

  • A polynomial of degree 0 defines a constant function.

  • A polynomial of degree 11 defines an affine function. For example, p:p:\mathbb{R}\to\mathbb{R} where p(x)=15xp(x)=1-5x defines an affine function.

  • A polynomial of degree 22 defines a quadratic function. For example, q:q:\mathbb{R}\to\mathbb{R} with q(x)=52x2q(x)=5-2x^{2} defines a quadratic function.

  • Polynomials of degree 33, 44 and 55 are respectively known as cubics, quartics and quintics.

The graph of an affine function is a straight line in the plane. However, since these lines need not go through the origin, they do not define what mathematicians call “linear functions” in many other areas (e.g. “linear maps” in linear algebra.) Hence, we use the word “affine” to avoid future confusion.

6.2.2 Manipulating and combining polynomials

Polynomials can be added, subtracted, multiplied and manipulated in general using elementary algebra. For example, to multiply the polynomials x2+3x^{2}+3 and 2x52x-5 you could expand (x2+3)(2x5)(x^{2}+3)(2x-5) and then collect together terms of the same degree, as follows:

(x2+3)(2x5)=x2(2x1)+3(2x5)=2x3x2+6x15.(x^{2}+3)(2x-5)=x^{2}(2x-1)+3(2x-5)=2x^{3}-x^{2}+6x-15.
Exercise 6.9.

Write 4x212x+74x^{2}-12x+7 in the form a(xb)2+ca(x-b)^{2}+c, for constants aa, bb and cc. [This manipulation is known as ‘completing the square’.]

Solution (please try for yourself before looking)

First observe that

a(x+b)2+c=ax2+2abx+(ab2+c).a(x+b)^{2}+c=ax^{2}+2abx+(ab^{2}+c).

By comparing this with 4x212x+74x^{2}-12x+7 and equating corresponding coefficients, we see that a=4a=4. Then 2ab=122ab=-12 which means b=3/2b=-3/2. Finally, ab2+c=7ab^{2}+c=7. So, after substituting our values for aa and bb, we obtain c=2c=-2. Therefore,

4x212x+7=4(x32)22.4x^{2}-12x+7=4\left(x-\frac{3}{2}\right)^{2}-2.

[Expand out the right hand side of this equation to check that it does indeed give you 4x212x+74x^{2}-12x+7].

In Block 1, we were introduced to the notion of a divisor within the set of real numbers. This notion of a divisor can also be applied to polynomials.

Definition 6.10 (Polynomial divisor).

Let a0+a1x+a2x2++anxna_{0}+a_{1}x+a_{2}x^{2}+\cdots+a_{n}x^{n} and b0+b1x+b2x2++bmxmb_{0}+b_{1}x+b_{2}x^{2}+\cdots+b_{m}x^{m} be polynomials, where a0+a1x+a2x2++anxn0a_{0}+a_{1}x+a_{2}x^{2}+\cdots+a_{n}x^{n}\neq 0.

We say the polynomial a0+a1x+a2x2++anxna_{0}+a_{1}x+a_{2}x^{2}+\cdots+a_{n}x^{n} is a divisor of b0+b1x+b2x2++bmxmb_{0}+b_{1}x+b_{2}x^{2}+\cdots+b_{m}x^{m} if

b0+b1x+b2x2++bmxma0+a1x+a2x2++anxn\frac{b_{0}+b_{1}x+b_{2}x^{2}+\cdots+b_{m}x^{m}}{a_{0}+a_{1}x+a_{2}x^{2}+% \cdots+a_{n}x^{n}}

can be written as a polynomial.

Exercise 6.11.

Given that x+7x+7 is a divisor of x337x+84x^{3}-37x+84, factorise x337x+84x^{3}-37x+84 completely as a product of polynomials of degree 1.

Solution (please try for yourself before looking)

First we divide x337x+84x^{3}-37x+84 by x+7x+7, and then factorise to get

x337x+84x+7=x27x+12=(x4)(x3).\frac{x^{3}-37x+84}{x+7}=x^{2}-7x+12=(x-4)(x-3).

Hence x337x+84=(x+7)(x4)(x3)x^{3}-37x+84=(x+7)(x-4)(x-3).

Polynomial expressions have many written forms. for example,

Expanded ax2+bx+c\displaystyle ax^{2}+bx+c
a0+a1x+a2x2+a3x3++anxn\displaystyle a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+\cdots+a_{n}x^{n}
Factored a(xb)(xc)\displaystyle a(x-b)(x-c)
a(xr1)(xr2)(xr3)(xrn)\displaystyle a(x-r_{1})(x-r_{2})(x-r_{3})\cdots(x-r_{n})
Completed square a(xb)2+c\displaystyle a(x-b)^{2}+c
About the point x=a\displaystyle\mbox{About the point }x=a\quad a0+a1(xa)+a2(xa)2\displaystyle a_{0}+a_{1}(x-a)+a_{2}(x-a)^{2}
a0+a1(xa)+a2(xa)2++an(xa)n\displaystyle a_{0}+a_{1}(x-a)+a_{2}(x-a)^{2}+\cdots+a_{n}(x-a)^{n}
a0+a1x+a2x(x1)+a3x(x1)(x2)+\displaystyle a_{0}+a_{1}x+a_{2}x(x-1)+a_{3}x(x-1)(x-2)+\cdots
+anx(x1)(x2)(x(n1))\displaystyle+a_{n}x(x-1)(x-2)\cdots(x-(n-1))
Nested form a0+x(a1+xa2)\displaystyle a_{0}+x(a_{1}+xa_{2})
a0+x(a1+x(a2+x(a3+x(an1+anx))))\displaystyle a_{0}+x(a_{1}+x(a_{2}+x(a_{3}+\cdots x(a_{n-1}+a_{n}x)\cdots)))

A significant goal of elementary algebra is to transform an expression from one form into an equivalent expression in another form. We can show all of the above forms are equivalent to the expanded form by multiplying out the brackets. More work is needed to re-write an expanded polynomial into one of the other forms.

6.2.3 Rational functions

Definition 6.12 (Rational function).

A rational expression is defined as the ratio of two polynomials, e.g.

x21x3+7.\frac{x^{2}-1}{x^{3}+7}.

A rational function is a function defined by a formula that is the ratio of two polynomials. That is ff is a rational function if

f(x)=p(x)q(x),f(x)=\frac{p(x)}{q(x)},

where pp and qq are polynomial functions, and q(x)0q(x)\neq 0.

Note that the implied domain of a rational function f(x)=p(x)/q(x)f(x)=p(x)/q(x) is all real numbers except for those where the denominator q(x)q(x) is zero (in symbols, {x:q(x)=0}\mathbb{R}\setminus\{x\in\mathbb{R}:q(x)=0\}). The codomain of a rational function is usually \mathbb{R}.

  • Zeros of ff are the values xx where f(x)=0f(x)=0. Equivalently, these are the values xx where p(x)=0p(x)=0 and q(x)0q(x)\neq 0.

  • Poles (or singularities) of ff are the values xx where denominator q(x)=0q(x)=0.

  • If the same factor appears in both the numerator and the denominator, it can cancel out algebraically. This algebraic cancellation might remove values of xx for which q(x)=0q(x)=0, in which case the graph has a removable discontinuity (a hole) at that point.

What happens to the rational function ff when its input xx is large depends on the degrees of pp and qq. Using degp\deg p and degq\deg q to denote the degree of pp and qq respectively, we have the following:

  • If degp<degq\deg p<\deg q, then f(x)f(x) approaches 0 as xx approaches \infty or -\infty.

  • If degp=degq\deg p=\deg q, then f(x)f(x) approaches the ratio of the leading coefficients as xx approaches \infty or -\infty.

  • If degp>degq\deg p>\deg q and the leading coefficient of pp is positive then f(x)f(x) grows to \infty as xx approaches \infty. Otherwise, if the leading coefficient of pp is negative, then f(x)f(x) descends towards -\infty as xx approaches \infty. In both cases, the graph of ff looks like a polynomial when xx is large (this can be made precise by long division).

This describes the horizontal or oblique asymptotes.

Example 6.13.

Consider

f(x)=x21x2.f(x)=\frac{x^{2}-1}{x-2}.

The denominator vanishes at x=2x=2, giving a vertical asymptote there.

To better understand the behaviour of ff we perform division of x21x^{2}-1 by x2x-2:

x+2x2)x21x22x2x12x43\begin{array}[]{r@{\;}c@{\;}rrrrrr}&&&&&x&+&2\\ \cline{2-8}\cr x-2&\Big{)}&&x^{2}&&&-&1\\ &&&x^{2}&-&2x&&\\ \cline{3-8}\cr&&&&&2x&-&1\\ &&&&&2x&-&4\\ \cline{5-8}\cr&&&&&&&3\\ \end{array}

Hence

x21x2=x+2+3x2.\frac{x^{2}-1}{x-2}=x+2+\frac{3}{x-2}.

As xx approaches \infty or -\infty, the term 3x2\frac{3}{x-2} gets very close to 0, and hence the graph behaves like the line y=x+2y=x+2 for large positive xx and large negative xx.

Our discussion of the behaviour of a function ff as its input approaches \infty or -\infty is very informal here. You will learn about this more rigorously when you study “limits” in the course Introduction to Mathematical Analysis (IMA).

6.2.4 Equivalent Expressions vs Equivalent Functions

In algebra, two expressions are called equivalent if they can be transformed into one another using the rules of algebraic manipulation; for example,

x21x1andx+1\frac{x^{2}-1}{x-1}\quad\text{and}\quad x+1

are algebraically equivalent because

x21x1=(x1)(x+1)x1=x+1.\frac{x^{2}-1}{x-1}=\frac{(x-1)(x+1)}{x-1}=x+1.

However, when creating functions from these expressions we need to be more careful: a function is defined by its domain, codomain and graph (defined by the expression) and two functions are equal only when their domains, codomains and graphs are the same. The expression x21x1\frac{x^{2}-1}{x-1} defines a function whose domain excludes x=1x=1, while the expression x+1x+1 defines a function on all real numbers. So although the formulas agree everywhere else, if their corresponding functions are defined on their implied domains, they are technically different functions, because these implied domains are not the same. In abstract algebra we often focus on equivalence of expressions, while in calculus (and later analysis) we distinguish functions by their graph (defined by their rule, expression or formula), domain and codomain.

The following example illustrates the dangers of algebraic cancelling without carefully considering the domains.

Example 6.14.

Consider the following two functions f:{6}f:\mathbb{R}\setminus\{6\}\to\mathbb{R} and g:{13}g:\mathbb{R}\setminus\{13\}\to\mathbb{R} where

f(x)=x+10x65,f(x)=\frac{x+10}{x-6}-5,

and

g(x)=4x4013x.g(x)=\frac{4\,x-40}{13-x}.

Let’s try to find the point(s) (if any) at which the graphs of these functions cross, that is, we want to find all xx for which f(x)=g(x)f(x)=g(x).

Sketching the graphs of ff (red, solid line) and gg (blue, dashed line) we see that the graphs appear to cross once. So we expect one solution to f(x)=g(x)f(x)=g(x).

However, if we try to solve the equation f(x)=g(x)f(x)=g(x), we get:

x+10x65=4x4013x\displaystyle\frac{x+10}{x-6}-5=\frac{4\,x-40}{13-x}\iff x+105(x6)x6=4x4013x\displaystyle\frac{x+10-5\,\left(x-6\right)}{x-6}=\frac{4\,x-40}{13-x}
\displaystyle\iff 4x406x=4x4013x\displaystyle\frac{4\,x-40}{6-x}=\frac{4\,x-40}{13-x}
\displaystyle\iff 6x=13x\displaystyle 6-x=13-x
\displaystyle\iff 6=13.\displaystyle 6=13.

What went wrong? Can you try to correct it to find the solution to f(x)=g(x)f(x)=g(x)?

Exercise 6.15.

Identify the error in the above example and correct it to find the solution to f(x)=g(x)f(x)=g(x).

Solution (please try for yourself before looking)

It is important to note that, since we are looking for solutions to f(x)=g(x)f(x)=g(x), we must only consider those xx that lie in BOTH the domain of ff and the domain of gg. This means our possible options for solutions are those elements of {6,13}\mathbb{R}\setminus\{6,13\}.

In the attempt above, we perform the step

4x406x=4x4013x6x=13x\frac{4\,x-40}{6-x}=\frac{4\,x-40}{13-x}\iff 6-x=13-x

by dividing both sides of the equation by 4x40=4(x10)4x-40=4(x-10). But this is 0 when x=10x=10 and 10{6,13}10\in\mathbb{R}\setminus\{6,13\}. So we must consider x=10x=10 as a separate case.

Indeed, if x=10x=10,

f(x)=10+101065=2045=0f(x)=\frac{10+10}{10-6}-5=\frac{20}{4}-5=0

and

g(x)=4(10)401310=0=f(x).g(x)=\frac{4(10)-40}{13-10}=0=f(x).

So x=10x=10 is a solution to f(x)=g(x)f(x)=g(x).

Are there any more solutions? Well now, if we consider the case where x10x\neq 10, we are permitted to divide both sides of our equation by 4x4004x-40\neq 0 and we end up with the working given in the above example, resulting in the false statement 6=136=13. Thus, there are no solutions except for x=10x=10 to the equation f(x)=g(x)f(x)=g(x), which matches what we see in the graphs of these functions.

6.2.5 Symmetry properties

Definition 6.16 (Periodic function).

Let DD be a subset of \mathbb{R} and f:Df:D\to\mathbb{R} be a function. Suppose there is a real number p>0p>0 such that f(x+p)=f(x)f(x+p)=f(x) for all xDx\in D. Then the function ff is said to be pp-periodic or periodic with period pp.

For example, the function sin:\sin:\mathbb{R}\to\mathbb{R} is 2π2\pi-periodic because sin(x+2π)=sin(x)\sin(x+2\pi)=\sin(x) for all xx\in\mathbb{R}. Note that sin\sin is also periodic with period 4π4\pi, 6π6\pi, 8π8\pi, and so on.

The graph of a periodic function has translational symmetry in the direction of the xx-axis. This means that the shifting the graph along the xx-axis by its period produces the same graph. [Check that you understand why from the definition of a periodic function.]

Exercise 6.17.

Is the constant function f:f:\mathbb{R}\to\mathbb{R} defined by f(x)=3f(x)=3 periodic? If so, what period does it have?

Solution (please try for yourself before looking)

The function ff is pp-periodic for any real number p>0p>0. This is because f(x)=3=f(x+p)f(x)=3=f(x+p) for every p>0p>0. In fact this is true for every constant function.

Definition 6.18 (Even function).

Let DD be a subset of \mathbb{R}. A function f:Df:D\to\mathbb{R} is said to be even if f(x)=f(x)f(-x)=f(x) for all xDx\in D.

Example 6.19.

Some examples of even functions are:

  • cos:\cos:\mathbb{R}\to\mathbb{R} because cos(x)=cos(x)\cos(-x)=\cos(x) for all xx\in\mathbb{R}.

  • g:g:\mathbb{R}\to\mathbb{R} where g(x)=x2g(x)=x^{2} because g(x)=(x)2=x2=g(x)g(-x)=(-x)^{2}=x^{2}=g(x) for all xx\in\mathbb{R}.

The graph of an even function has reflectional symmetry about the yy-axis. This means that the part of the graph that lies to the left of the yy-axis is the same as the part of the graph that lies to the right of the yy-axis, causing the yy-axis to act as a mirror. [Check that you understand why this is true from the definition of an even function.]

Definition 6.20 (Odd function).

Let DD be a subset of \mathbb{R}. A function f:Df:D\to\mathbb{R} is said to be odd if f(x)=f(x)f(-x)=-f(x) for all xDx\in D.

Example 6.21.

Some examples of odd functions are:

  • sin:\sin:\mathbb{R}\to\mathbb{R} because sin(x)=sin(x)\sin(-x)=-\sin(x) for all xx\in\mathbb{R};

  • tan:{π2+nπ:n}\tan:\mathbb{R}\setminus\{\frac{\pi}{2}+n\pi:n\in\mathbb{Z}\}\to\mathbb{R} because tan(x)=tan(x)\tan(-x)=-\tan(x) for all xx in its domain.

  • f:f:\mathbb{R}\to\mathbb{R} where f(x)=x3f(x)=x^{3} since f(x)=(x)3=x3=f(x)f(-x)=(-x)^{3}=-x^{3}=-f(x) for all xx\in\mathbb{R}.

The graph of an odd function has half-turn rotational symmetry about the origin. This means that we can take any straight line LL through the origin, take the part of the graph that lies on one side of LL and rotate it by 180180^{\circ} around the origin to match the part of the graph that lies on the other side of LL.

6.2.6 Quadratic polynomials, completed square form and symmetry

Any quadratic polynomial can be written in completed-square form:

f(x)=a(xb)2+c.f(x)=a(x-b)^{2}+c.

Completed-square form makes the parabola’s symmetry immediate: the square (xb)2(x-b)^{2} depends only on the distance xbx-b from the vertical line x=bx=b.

Now suppose h>0h>0. At any point x=b+hx=b+h the value of ff is f(b+h)=ah2+cf(b+h)=ah^{2}+c and at the mirror point x=bhx=b-h the value of ff is

f(bh)=a(h)2+c=ah2+c.f(b-h)=a(-h)^{2}+c=ah^{2}+c.

So, because the +h+h and h-h enter only through the same squared term, we get f(b+h)=f(bh)f(b+h)=f(b-h). This shows that points in the graph that are equidistant from x=bx=b have the same height (or yy coordinate). Thus the line x=bx=b is the axis of (reflectional) symmetry for our quadratic and (b,c)(b,c) is known as the unique vertex (highest or lowest point on the graph of ff, depending on the sign of aa).

Example 6.22.

Take f(x)=2x28x+5f(x)=2x^{2}-8x+5 and complete the square:

2x28x+5\displaystyle 2x^{2}-8x+5 =2(x24x)+5\displaystyle=2(x^{2}-4x)+5
=2((x2)24)+5\displaystyle=2\left((x-2)^{2}-4\right)+5
=2(x2)28+5\displaystyle=2(x-2)^{2}-8+5
=2(x2)23.\displaystyle=2(x-2)^{2}-3.

Therefore the unique vertex is (2,3)(2,-3) and the axis of symmetry is x=2x=2. Notice that f(0)=5f(0)=5 and f(4)=5f(4)=5, so (0,5)(0,5) and (4,5)(4,5) are symmetric about the line x=2x=2.

(2,3)(2,-3)x=2x=2(0,5)(0,5)(4,5)(4,5)y=2(x2)23y=2(x-2)^{2}-3

6.2.7 The symmetry of cubic polynomials

Consider a general cubic polynomial with a0a\neq 0:

p(x)=ax3+bx2+cx+d.p(x)=ax^{3}+bx^{2}+cx+d.

If we translate this horizontally by some ss\in\mathbb{R} we get

p(x+s)=a(x+s)3+b(x+s)2+c(x+s)+dp(x+s)=a(x+s)^{3}+b(x+s)^{2}+c(x+s)+d
={ax3+3asx2+3as2x+as3+bx2+2bsx+bs2+cx+cs+d=\left\{\begin{array}[]{ccccccc}ax^{3}&+&3asx^{2}&+&3as^{2}x&+&as^{3}\\ &+&bx^{2}&+&2bsx&+&bs^{2}\\ &&&+&cx&+&cs\\ &&&&&+&d\\ \end{array}\right.

and thus

p(x+s)=ax3+(3as+b)x2+(3as2+2bs+c)x+(as3+bs2+cs+d).p(x+s)=ax^{3}+(3as+b)x^{2}+(3as^{2}+2bs+c)x+(as^{3}+bs^{2}+cs+d).

Then, since p(x)=p((xs)+s)p(x)=p((x-s)+s), it follows that

p(x)=a(xs)3+(3as+b)(xs)2+(3as2+2bs+c)(xs)+(as3+bs2+cs+d).p(x)=a(x-s)^{3}+(3as+b)(x-s)^{2}+(3as^{2}+2bs+c)(x-s)+(as^{3}+bs^{2}+cs+d).

Notice, in passing, that the complicated looking coefficients can be calculated using differential calculus

p(x)=(as3+bs2+cs+d)=p(s)+(3as2+2bs+c)=p(s)1!(xs)+(3as+b)=p(2)(s)2!(xs)2+a=p(3)(s)3!(xs)3.p(x)=\underbrace{(as^{3}+bs^{2}+cs+d)}_{=p(s)}+\underbrace{(3as^{2}+2bs+c)}_{=% \frac{p^{\prime}(s)}{1!}}(x-s)+\underbrace{(3as+b)}_{=\frac{p^{(2)}(s)}{2!}}(x% -s)^{2}+\underbrace{a}_{=\frac{p^{(3)}(s)}{3!}}(x-s)^{3}. (6.1)

This holds for any value of ss.

Now choose ss so that 3as+b=03as+b=0 i.e. s=b3as=-\frac{b}{3a}. Then the x2x^{2} coefficient becomes zero and we have

p(x)=a(xx)3+(cb23a)(xx)+(dbc3a+2b327a2)p\left(x\right)=a(x-x^{*})^{3}+\left(c-{\frac{b^{2}}{3a}}\right)(x-x^{*})+% \left(d-{\frac{b\,c}{3\,a}}+{\frac{2\,b^{3}}{27\,a^{2}}}\right)

where x=b3ax^{*}=-\frac{b}{3a}.

This form has no x2x^{2} term, and is called the reduced cubic. The point x=b3ax^{*}=-\frac{b}{3a} is called the point of inflexion11 1 A point of inflection is a point on a smooth plane curve at which the curvature changes sign. Such points are typically studied in a calculus class. of the cubic.

We performed a horizontal translation by x=b3ax^{*}=-\frac{b}{3a}. Now we perform a vertical translation by subtracting the constant term. If we translate vertically and horizontally in this particular way, then every cubic polynomial can be written in the form

q(x)=αx3+βx,q(x)=\alpha x^{3}+\beta x,

for some α,β\alpha,\beta\in\mathbb{R}. This defines an odd function q:q:\mathbb{R}\to\mathbb{R} since

q(x)=α(x)3+β(x)=αx3βx=(αx3+βx)=q(x).q(-x)=\alpha(-x)^{3}+\beta(-x)=-\alpha x^{3}-\beta x=-(\alpha x^{3}+\beta x)=-% q(x).

This shows that every cubic has half-turn rotational symmetry about the point of inflexion.