Basics of functions

Functions are one of the most fundamental concepts in mathematics, forming the foundation for topics in algebra, calculus and many other areas. A solid understanding of the basics of functions, including the definition of a function, its notation, domain and range, and inverse functions, is essential for success in more advanced mathematical problem-solving.


Use this page to revise the following concepts of functions:


Definition of a function and function notation

A function is a relation such that for each \(x\)-value there is only one corresponding \(y\)-value. In other words, a function cannot contain two different ordered pairs with the same first coordinate.

One way to identify whether a relation is a function is to draw a graph of the relation and then apply the vertical-line test.

Vertical-line test

If a vertical line can be drawn anywhere on the graph and it only ever intersects the graph a maximum of once, then the relation is a function.

For example:

Graph of \(x^{2} + y^{2} = 4\) Graph of \(y = 2x^{2} - 3\)

The line drawn here at \(x = 1\) intersects the graph at \(y = -3\) and \(y = 3\). The graph does not pass vertical-line test , so it is NOT a function.

The line drawn at \(x = 1\) intersects the graph once, at \((1,-1)\). The graph passes vertical-line test, so it is a function.

If a relation is a function, it can be written using function notation which is used to name the function. Commonly used for function notation is \(f(x)\) which is read as ‘\(f\) of \(x\)’. This means \(f(x)\) is the output which occurs by applying the process of \(f\) to the input \(x\).
However, any letter can be used to name the function, such as \(g\), \(h\) or \(k\).

Note

The brackets do not indicate multiplication as they do elsewhere in algebra. They indicate that \(x\) is the input, \(f\) is the process and \(f(x)\) is the output.

If the input (also known as domain) belongs to \(\mathbb{R}\) (all real numbers), a simple rule can be written in the form of \(f(x) = \rule{1cm}{0.15mm}\). For example, \(f\left(x\right) = x^2\) means that for any real value of \(x\), the output will be \(x^2\).

However, if the domain is not all real numbers due to restrictions, a full function notation could be used. A full function notation is written as \(f: X\rightarrow Y, f(x) = \rule{1cm}{0.15mm}\). The set \(X\) is the domain, set \(Y\) contains the range which is named co-domain. For example, writing \(y = \sqrt{x - 1}\) in a full function notation could be \(f:\left[1,\infty\right) \rightarrow \mathbb{R}, \ f\left(x\right) = \sqrt{x - 1}\).

Domain and Range

The domain and range of a function describes the inputs and outputs it can take. The domain is the set of all possible input values (often known as \(x\) values) that the function can accept without causing any mathematical issues, such as division by zero or taking the square root of a negative number. The range is the set of all possible output values (often known as \(y\) values) the function can produce.

The domain and range of a function can be written in interval notation which uses values within brackets to specify the set of numbers between which \(x\) is defined. In interval notation, a square bracket [ ] is used when the set includes the endpoint and a parenthesis ( ) is used to indicate that the endpoint is either not included or the interval is unbounded.

Summary of interval notation in a table:

Inequality Interval NotationDescription
\(x > a\) \(x \in (a, \infty)\) \(x\) is greater than \(a\)
\(x < a\) \(x \in (-\infty, a)\) \(x\) is less than \(a\)
\(x \geq a\) \(x \in [a,\infty)\) \(x\) is greater than or equal to \(a\)
\(x \leq a\) \(x \in (-\infty,a]\) \(x\) is less than or equal to \(a\)
\(a < x <b\) \(x \in (a,b)\) \(x\) is greater than a but less than \(b\)
\(a \leq x < b\) \(x \in [a,b)\) \(x\) is between \(a\) and \(b\) excluding \(b\)
\(a < x \leq b\) \(x \in (a,b]\) \(x\) is between \(a\) and \(b\) excluding \(a\)
\(a \leq x \leq b\) \(x \in [a,b]\) \(x\) is between \(a\) and \(b\) including \(a\) and \(b\)

\(\in\) means an element of a set, and \(\infty\) means positive infinity and \(-\infty\) means negative infinity.

Domain

To some functions, for example, \(y=x^2\), the domain of the function is all real numbers, but some functions could have implied restrictions because of their specific properties, or restrictions implied or defined by the context of the problem.
When looking for the implied domain (also known as maximal domain) of a function, ask ‘Is there any input value where the function will be undefined?’.

For example:

  • If there is a denominator in the function, excluding values in the domain that force the denominator to be zero
  • If there is a square root in the function, excluding values that would make the radicand (what is inside the square root)  negative
  • If it is a logarithmic function, excluding values that would make arguments negative.

How to find the implied domain of a function with a denominator:

  1. Identify the input values (the denominator cannot be zero)
  2. Set the denominator not equal to zero and solve for the unknown input values.
  3. Write the domain in interval notation, making sure to exclude any restricted values from the domain

Worked Example

Find the implied domain of the function \(f(x) = \frac{x + 1}{3 - x}\)

Step 1. Identify the denominator in the function. In this case, the denominator is \(3 - x\).  
Step 2. Include only values of input that do not force the denominator to be zero, so set the denominator NOT equal to zero and solve for the unknown input values.

\[\begin{align}3 -x &\neq 0 \\ -x &\neq -3 \\ x &\neq 3\end{align}\]

Step 3. Preferably, the answer should be written in interval notation.

\(x \neq 3\) means the \(x\) is either less than 3 or greater than 3. A symbol (known as the union), \(\cup\), could be used to combine the two sets.

Step 4. Write the final answer. The domain is x is all real numbers other than 3 using the interval notation.

\[x \in (-\infty,3) \cup (3,\infty)\]

This could also be written as:

\[x \in \mathbb{R}\text{{3}}\]

How to find the implied domain of a function with a square root:

  1. Identify the input values (the radicand cannot be negative).
  2. Set the radicand greater than or equal to zero and solve for the unknown input values.
  3. Write the domain in interval notation, making sure to exclude any restricted values from the domain.

Worked Example

Find the implied domain of the function \(f(x) = \sqrt{x - 5}\)

Step 1. Identify there the radicand in the function. In this case, the radicand is \(x - 5\).

Step 2. Include only values of input that do not result in a negative number in the radicand, so set the radicand greater than or equal to zero and solve for the unknown input values.

\[x - 5\geq 0\]

\[x \geq 0\]

Step 3. Write the answer in interval notation.

\[x \in [5,\infty)\]

How to find the implied domain of a logarithmic function:

  1. Identify the input values (the argument must be greater than zero)
  2. Set the argument greater than zero and solve for the unknown input values.
  3. Write the domain in interval notation, making sure to exclude any restricted values from the domain

Worked Example

Find the implied domain of the function \(f(x) = \log_2(x - 4)\)

Step 1. Identify the input values (the argument must be greater than zero).
Step 2. Set the argument greater than zero and solve for the unknown input values.

\[x - 4 > 0\]

\[x > 4\]

Step 3. Write the answer in interval notation.

\[x \in (4,\infty)\]

Range

The range of a function is the complete set of all possible output values (often known as \(y\)  values) in terms of the domain.

There are two main ways to find the range of a function:

  • Find the range graphically (easier method)
  • Find the range algebraically.

To find the range graphically, you need to identify the highest and lowest \(y\) values on the graph.

Worked Example 1: Function with a square root

Function and its graph How to find the range

\(f(x) = \sqrt{x + 2}\)

  • The domain of the function is \(x \in [-2,\infty]\)
  • The curve is either on or above the horizontal axis.
  • No matter what \(x\) values it takes, \(y\) values are always greater than or equal to zero.
  • The curve goes on forever vertically, so the range is all non-negative values.
  • This is written in interval notation as \(y \in [0,\infty]\).

Worked Example 2: Trigonometric Function

Function and its graph How to find the range

\(f(x) = \sin(x)\)

  • The domain of the function \(x \in \mathbb{R}\), which can also be written as \(x \in (-\infty,\infty)\) since there are no restrictions on \(x\) values.
  • From observing the curve, the minimum \(y\) value is -1, and the maximum \(y\) value is 1.
  • So the range of the function is between -1 and 1, which can be written in interval notation as \(y \in [-1,1]\).

Worked Example 3: Quadratic Function

Function and its graph How to find the range

\(f(x) = (x - 1 )^{2} - 3\)

  • The domain of the function is \(x \in \mathbb{R}\) which can also be written as \(x \in (-\infty,\infty)\) since there are no restrictions on \(x\) values.
  • From observing the parabola (graph of quadratics), there is always a turning point which indicates when the curve changes its direction. The turning point plays an important role in stating the range of quadratic functions as it states either the maximum \(y\) value or the minimum \(y\) value.
  • If the coefficient of \(x^2\) is positive, the graph is upright, and it has a minimum turning point indicating a minimum \(y\) value.
  • If the coefficient of \(x^2\) is negative, the graph is inverted, and it has a maximum turning point indicating a maximum \(y\) value.
  • In this case, the graph is upright. \(y = -3\) is the minimum y value so the range is \(y \in [-3,\infty)\).

Reading a function’s range directly from its graph can be helpful in many cases, but sketching a function usually requires knowing about a function’s discontinuities or properties first.
A more systematic approach is to determine the range algebraically, by examining the function’s formula and identifying any restrictions on its outputs. In particular, you should watch out for:

  1. Square root signs: the radicand must be non-negative for real-valued functions.
  2. Fractions: the denominator cannot be zero, as division by zero is undefined.

Worked Example

Find the range of the function \(f(x) = \dfrac{\sqrt{x + 2}}{x^{2} - 9}\).

Step 1. First, find the domain of the function because all output values are based on input values.

Since the radicand has to be greater than or equal to zero, \(x + 2\geq 0\), so \(x \geq -2\).

In addition, the denominator cannot be zero. \(x^{2} - \neq 0\), so \(\left(x + 3\right)\left(x - 3\right) \neq 0\). Then \(x \neq \pm3\). In order to find the domain, an intersection of all sets of x values need to be found.
As such, the domain of the function is \(x \in [-2,3) \cup (3,\infty)\).

Step 2: To work out the range, numerator and denominator will be considered separately.

Numerator: The radicand will have to be greater than or equal to zero. The numerator is 0 when \(x = -2\). Substituting into our function, \(f\left(-2\right) = 0\).

Denominator: Break up into two portions.

  • When \(x\) is between -2 and 3, \(x^2 - 9\) gets closer to zero, so \(f(x)\) will go to \(-\infty\) as it gets near \(x = 3\).
  • When \(x > 3\), the denominator is over zero, so \(f(x)\) will be a very large positive number.

Step 3. Find the actual range of the function, and write in interval notation

\[y \in (-\infty,0] \cup (0,\infty)\]

Summary of domains and ranges of commonly used functions

FunctionExampleDomainRange
Linear Functions \(f\left(x\right) = x\) \((-\infty,\infty)\) \((-\infty,\infty)\)
Quadratic Functions \(a = 1\) \(f\left(x\right) = x^2\) \((-\infty,\infty)\) Greater than or equal to the minimum \(y\) value according to the turning point
Quadratic Functions \(a = -1\) \(f\left(x\right) = -x^2\) \((-\infty,\infty)\) Less than or equal to the maximum \(y\) value according to the turning point
Cubic Functions \(f\left(x\right) = x^3\) \((-\infty,\infty)\) \((-\infty,\infty)\)
Reciprocal Functions \(f\left(x\right) = \frac{1}{x}\) \((-\infty,0) \cup (0,\infty)\) \((-\infty,0) \cup (0,\infty)\)
Reciprocal Squared Functions \(f\left(x\right) = \frac{1}{x^2}\) \((-\infty,0) \cup (0,\infty)\) \((0,\infty)\)
Square root Functions \(f\left(x\right) = \sqrt{x}\) \([0,\infty)\) \([0,\infty)\)
Exponential Functions \(f\left(x\right) = a^x\) \((-\infty,\infty)\) Real numbers above or below the horizontal asymptote, excluding the asymptote
Logarithmic Functions \(f\left(x\right) = \log_a{(x)}\) \((0,\infty)\) \((-\infty,\infty)\)
Trigonometric Function - sine \(f\left(x\right)=\sin(x)\) \((-\infty,\infty)\) \([-1,1]\)
Trigonometric Function - cosine \(f\left(x\right) = \cos(x)\) \((-\infty,\infty)\) \([-1,1]\)
Trigonometric Function - tangent \(f\left(x\right) = \tan(x)\) All real numbers except odd multiples of \(\frac{\pi}{2}\) \((-\infty,\infty)\)

Inverse Function

A function accepts values, performs particular operations on these values and generates an output. An inverse function, if it exists, essentially “undoes” those operations: it starts from the function’s output and recovers the original input. In other words, Inverse functions are rules that relate each \(y\) value to only one \(x\) value. These kinds of functions are named one-to-one functions.
However, not every function has an inverse. For example, consider the function \(y = x^2\) shown below:

For an inverse to exist, a function must have one x value associated with only one y value. The blue dashed line which represents \(y = 4\) intersects with the curve twice at \(x = -2\) and \(x = 2\). This means that one y value is associated with two \(x\) values, which does not satisfy the definition of inverse function.

Note

To tell if a function is one-to-one, a horizontal line test needs to be undertaken. If the horizontal line cuts the graph of the function only once, then it is one-to-one. Only one-to-one functions have inverses.

If a function does not have an inverse, since it is not one-to-one, restricting the domain of a function could be a good way to guarantee an inverse function exists.
For example, \(y = x^2\) does not have an inverse over all real values of \(x\). But if the function is only defined over \(x \geq 0\), the graph turns into:

If you draw a horizontal line now, it will only ever intersect the curve once. Each \(y\) value now has only one \(x\) value and therefore an inverse function exists.

Notation and Properties of Inverse Functions

The inverse of a function \(f\) is denoted by \(f^{-1}\) (and read as ‘\(f\) inverse’). It has the following properties:

  • The domain of the inverse function is the range of the original function.
  • The range of the inverse function is the domain of the original function.
  • The original function and the inverse function are reflections across the line \(y = x\).

Importantly, \(f^{-1}(x) \neq\frac{1}{f(x)}\). While the notation looks similar to the notation for a reciprocal, an inverse function is a separate concept.

For example, graphs for the function \(f\left(x\right) = x^3\) and its inverse \(f^{-1}\left(x\right) = \sqrt[3]{x}\) are shown below:

  • The blue curve represents the function \(f\left(x\right) = x^3\) and the blue one represents the inverse function \(f^{-1}\left(x\right) = \sqrt[3]{x}\).
  • The domain of \(f\left(x\right)\) is \(\mathbb{R}\), and the range of the inverse \(f^{-1}\left(x\right)\) is also \(\mathbb{R}\).
  • The range of \(f\left(x\right)\) is \(\mathbb{R}\), and the domain of the inverse \(f^{-1}\left(x\right)\) is also \(\mathbb{R}\).
  • The grey straight line represents \(y = x\); these two graphs of functions are reflections in the line \(y = x\).

Find the inverse of a function

A 5-step process needs to be followed to find the inverse of a function .

Step 1. Make sure the function is one-to-one as only one-to-one functions have inverses.
Step 2. If the function is denoted by \(f(x)\), replace \(f(x)\) with \(y\). This is done to make the rest of the process easier.
Step 3. Switch the \(x\) and \(y\) value in the function.
Step 4. Solve the equation from Step 3 for new \(y\).
Step 5. Replace the new y with \(f^{-1}\left(x\right)\), and state the domain of the inverse. The \(f^{-1}\left(x\right)\) notation must be written in the answer.

Worked Example

Given \(f(x) = 2x - 2\), find \(f^{-1}(x)\).

Step 1. One y value is associated with only one x value, and it passes the horizontal line test. As it is a one-to-one function, an inverse function exists.

Step 2. Replace \(f(x)\) with \(y\).

\[y = 3x-  2\]

Step 3. Switch \(x\) and \(y\) in the function.

\[x = 3y - 2\]

Step 4. Solve the equation for new \(y\).

\[\begin{align}3y &=  x +2 \\ y &= \frac{x + 2}{3}\end{align}\]

Step 5. Replace the new y with \(f^{-1}\left(x\right)\), and state the domain of the inverse.

\[f^{-1}(x) = \frac{x + 2}{3}, x \in \mathbb{R}\]