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.

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.

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}\]