Skip to content

Functions, domains and ranges

A function is a rule that assigns exactly one output to each permitted input. The permitted inputs form the domain. The outputs the function can actually produce form the range.

Functions give precise language for relationships between quantities. They also underpin graphs, transformations, calculus, numerical methods and mathematical modelling.

You should be comfortable with:

  • substituting values into algebraic expressions
  • solving equations and inequalities
  • sketching standard graphs
  • interval notation and inequality notation

If function notation is completely new, the foundation lesson on function notation provides a shorter introduction.

Suppose a rule sends an input xx to an output yy. It is a function if every allowed value of xx has one and only one output.

For example,

f(x)=x2f(x)=x^2

is a function. The input 33 produces the single output 99. The fact that both 33 and 3-3 produce 99 does not cause a problem. Different inputs are allowed to share an output.

By contrast, the relation

y2=xy^2=x

does not define yy as a function of xx for x>0x>0, because

y=xory=x.y=\sqrt{x}\quad\text{or}\quad y=-\sqrt{x}.

For example, x=4x=4 would have two outputs, 22 and 2-2.

The crucial test is therefore:

One input cannot be assigned two different outputs.

The notation

f(x)=3x+5f(x)=3x+5

names the function ff and describes its output for an input xx. The expression f(x)f(x) is read as ”ff of xx”. It does not mean f×xf\times x.

Let

f(x)=2x23x+1.f(x)=2x^2-3x+1.

To find f(4)f(4), replace every xx with 44:

f(4)=2(4)23(4)+1=3212+1=21.\begin{aligned} f(4)&=2(4)^2-3(4)+1\\ &=32-12+1\\ &=21. \end{aligned}

Brackets protect the substitution, especially when the input is negative.

Using the same function,

f(2)=2(2)23(2)+1=8+6+1=15.\begin{aligned} f(-2)&=2(-2)^2-3(-2)+1\\ &=8+6+1\\ &=15. \end{aligned}

The square gives (2)2=4(-2)^2=4, not 4-4.

Find f(a+1)f(a+1) when f(x)=x24xf(x)=x^2-4x.

Substitute the entire expression a+1a+1:

f(a+1)=(a+1)24(a+1)=a2+2a+14a4=a22a3.\begin{aligned} f(a+1)&=(a+1)^2-4(a+1)\\ &=a^2+2a+1-4a-4\\ &=a^2-2a-3. \end{aligned}

Function notation allows the input to be a number, a variable or a complete expression.

A function can be described as a mapping from one set to another:

f:AB.f:A\to B.

This says that ff maps elements of the set AA into the set BB. More explicitly,

xf(x)x\mapsto f(x)

means that the input xx is mapped to the output f(x)f(x).

For example,

f:RR,x2x7f:\mathbb{R}\to\mathbb{R},\qquad x\mapsto 2x-7

defines a function from the real numbers to the real numbers.

These two arrows have different jobs:

  • f:ABf:A\to B names the input and output sets.
  • xf(x)x\mapsto f(x) states what happens to an individual input.

These terms are related but not interchangeable.

  • The domain is the set of allowed inputs.
  • The codomain is the declared set into which outputs are mapped.
  • The range is the set of outputs actually produced.

For a function f:ABf:A\to B, the domain is AA and the codomain is BB. The range is a subset of BB:

range(f)B.\operatorname{range}(f)\subseteq B.

Example 4: codomain and range are not always equal

Section titled “Example 4: codomain and range are not always equal”

Consider

f:RR,f(x)=x2.f:\mathbb{R}\to\mathbb{R},\qquad f(x)=x^2.

Its domain is R\mathbb{R} and its codomain is also R\mathbb{R}. However, a square cannot be negative, so its range is

[0,)[0,\infty)

or equivalently

{yR:y0}.\{y\in\mathbb{R}:y\ge0\}.

The codomain includes negative real numbers, but the function never reaches them.

Sometimes a domain is stated explicitly. If it is not, use the largest real domain for which the formula makes sense.

At A-level, check especially for:

  1. denominators, which cannot equal zero
  2. even roots, whose contents must be non-negative
  3. logarithms, whose arguments must be positive

For

f(x)=5x3,f(x)=\frac{5}{x-3},

the denominator cannot be zero:

x30.x-3\ne0.

Therefore the domain is

xR,x3.x\in\mathbb{R},\qquad x\ne3.

For

g(x)=72x,g(x)=\sqrt{7-2x},

the expression under the square root must satisfy

72x0.7-2x\ge0.

Solving gives

x72.x\le\frac72.

So the domain is

(,72].\left(-\infty,\frac72\right].

Remember that dividing an inequality by 2-2 reverses its direction.

Find the domain of

h(x)=x+1x4.h(x)=\frac{\sqrt{x+1}}{x-4}.

The square root requires

x+10x1.x+1\ge0\quad\Longrightarrow\quad x\ge-1.

The denominator requires

x4.x\ne4.

Both conditions must hold, so the domain is

[1,4)(4,).[-1,4)\cup(4,\infty).

There is no single method for every function. Useful approaches include:

  • using the shape and turning points of a graph
  • writing the formula in a form that exposes its minimum or maximum
  • setting y=f(x)y=f(x) and asking which values of yy give a real solution for xx
  • using known ranges of standard functions

Find the range of

f(x)=x26x+11,f(x)=x^2-6x+11,

where xRx\in\mathbb{R}.

Complete the square:

f(x)=(x3)2+2.f(x)=(x-3)^2+2.

Since

(x3)20,(x-3)^2\ge0,

we have

f(x)2.f(x)\ge2.

The value 22 occurs when x=3x=3, so the range is

[2,).[2,\infty).

Let

g(x)=x26x+11,qquad0x4.g(x)=x^2-6x+11,qquad 0\le x\le4.

The completed-square form is still

g(x)=(x3)2+2.g(x)=(x-3)^2+2.

The minimum occurs at x=3x=3 and is 22. To find the maximum on the closed interval, check the endpoints:

g(0)=11,qquadg(4)=3.g(0)=11,qquad g(4)=3.

Therefore the range is

[2,11].[2,11].

Checking only the turning point would miss the maximum.

Find the range of

f(x)=2x+1x3,qquadx3.f(x)=\frac{2x+1}{x-3},qquad x\ne3.

Set

y=2x+1x3.y=\frac{2x+1}{x-3}.

Rearrange for xx:

y(x3)=2x+1,y(x-3)=2x+1,

x(y2)=3y+1,x(y-2)=3y+1,

x=3y+1y2.x=\frac{3y+1}{y-2}.

This expression exists for every real yy except y=2y=2. Hence the range is

yR,y2.y\in\mathbb{R},\qquad y\ne2.

A function is one-to-one if different inputs always produce different outputs:

f(a)=f(b)a=b.f(a)=f(b)\quad\Longrightarrow\quad a=b.

For example, f(x)=3x+1f(x)=3x+1 on R\mathbb{R} is one-to-one.

A function is many-to-one if at least two different inputs share an output. For f(x)=x2f(x)=x^2 on R\mathbb{R},

f(2)=f(2)=4,f(2)=f(-2)=4,

so it is many-to-one.

Both are valid functions. The distinction concerns whether outputs are repeated, not whether each input has one output.

A graph represents a one-to-one function if every horizontal line meets it at most once. If a horizontal line meets it more than once, the function is many-to-one.

This matters because only a one-to-one function can be reversed without ambiguity. Domain restrictions and inverse functions are developed in composite and inverse functions.

Example 11: proving a linear function is one-to-one

Section titled “Example 11: proving a linear function is one-to-one”

Let f(x)=5x4f(x)=5x-4. Suppose f(a)=f(b)f(a)=f(b). Then

5a4=5b4,5a-4=5b-4,

so

5a=5b5a=5b

and therefore

a=b.a=b.

Thus ff is one-to-one on R\mathbb{R}.

Solving equations written in function notation

Section titled “Solving equations written in function notation”

Let

f(x)=x2+2x3.f(x)=x^2+2x-3.

Solve f(x)=5f(x)=5.

Substitute the formula for f(x)f(x):

x2+2x3=5,x^2+2x-3=5,

x2+2x8=0,x^2+2x-8=0,

(x+4)(x2)=0.(x+4)(x-2)=0.

Hence

x=4orx=2.x=-4\quad\text{or}\quad x=2.

Two inputs produce the output 55, which also shows that this quadratic is many-to-one on R\mathbb{R}.

  • Thinking f(x)f(x) means f×xf\times x. It names the output of function ff at input xx.
  • Objecting when two inputs share an output. That is allowed. A function fails only when one input has more than one output.
  • Using domain, codomain and range as synonyms. The range contains outputs actually achieved; the codomain is the declared target set.
  • Ignoring a stated domain. A restriction can change the range and whether a function is one-to-one.
  • Cancelling away restrictions. Even if an algebraic expression simplifies, excluded values from the original rule remain excluded.
  • Finding a quadratic range from the constant term. Use the turning point and any domain endpoints.
  • Forgetting brackets in substitutions. Write f(2)f(-2) by replacing every xx with (2)(-2) before simplifying.

Given f(x)=3x22xf(x)=3x^2-2x, find f(1)f(-1) and f(2a)f(2a).

Answer

f(1)=3(1)22(1)=5.f(-1)=3(-1)^2-2(-1)=5.

f(2a)=3(2a)22(2a)=12a24a.f(2a)=3(2a)^2-2(2a)=12a^2-4a.

Find the domain of

g(x)=3x6.g(x)=\sqrt{3x-6}.

Answer

Require 3x603x-6\ge0, so x2x\ge2. The domain is [2,)[2,\infty).

Find the range of

h(x)=4(x+1)2,h(x)=4-(x+1)^2,

where xRx\in\mathbb{R}.

Answer

Since (x+1)20(x+1)^2\ge0,

4(x+1)24.4-(x+1)^2\le4.

The maximum 44 occurs at x=1x=-1, so the range is (,4](-\infty,4].

Is f(x)=x3f(x)=x^3 one-to-one or many-to-one on R\mathbb{R}?

Answer

It is one-to-one. The function is strictly increasing, so different real inputs cannot produce the same output. Every horizontal line meets its graph exactly once.

Next, study composite and inverse functions to combine and reverse function rules. Then use function graphs and graph transformations to connect algebraic rules with their geometry.