← All Guides

Functions and Function Notation Explained

Functions are the central objects of modern mathematics. From simple formulas that convert temperatures to the complex models that power machine learning, understanding what a function is, how to work with function notation, and what domain and range mean will unlock algebra, calculus, and almost every area of applied mathematics.

What Is a Function?

A function is a rule that assigns to each input exactly one output. The key word is exactly one: every valid input must produce a single, well-defined output. A vending machine is a useful analogy — pressing button A3 always delivers the same item; you would not accept a machine that sometimes gave you crisps and sometimes gave you nothing, or two different items, for the same button.

Formally, a function from a set A to a set B is a relation in which every element of A is paired with exactly one element of B. The set A is called the domain (the set of all valid inputs) and the set B from which outputs are drawn is called the codomain. The range (or image) is the subset of B that is actually produced — it may be smaller than the full codomain.

Function Notation: f(x)

Instead of writing “the rule that squares a number and adds 3”, mathematicians write f(x) = x² + 3. The letter f names the function; the letter x inside the parentheses is the input variable (also called the argument). The expression on the right describes what to do to the input.

To evaluate a function, substitute the specific input for x. If f(x) = x² + 3, then:

  • f(2) = 2² + 3 = 7
  • f(−4) = (−4)² + 3 = 19
  • f(0) = 0² + 3 = 3
  • f(a + 1) = (a + 1)² + 3 = a² + 2a + 4

The choice of letter is arbitrary. f, g, h are common, but a function can be called anything. The notation g(t) = 2t − 5 defines a perfectly valid function using t as the input variable.

Domain and Range

The domain is the set of all inputs for which the function is defined. When a function is defined by a formula, the domain is typically all real numbers except values that would cause a mathematical problem — division by zero or the square root of a negative number are the most common restrictions.

  • For h(x) = 1/(x − 3), the domain is all real numbers except x = 3 (division by zero).
  • For k(x) = √(x + 5), the domain is all real numbers with x ≥ −5 (the expression under the root must be non-negative).
  • For p(x) = 2x² − 7, the domain is all real numbers; no restrictions apply.

The range is the set of all output values the function actually produces. Finding the range often requires some analysis. For p(x) = 2x² − 7, the minimum value is −7 (when x = 0), and outputs can be any value ≥ −7, so the range is [−7, ∞).

The Vertical Line Test

A graph represents a function if and only if every vertical line drawn on the graph intersects it at most once. If any vertical line crosses the graph twice, the relation is not a function (one input would have two outputs). A circle fails the vertical line test; a parabola opening upward passes it.

Types of Functions

Familiarity with common function families speeds up problem-solving enormously:

  • Linear: f(x) = mx + b. Straight-line graph. Constant rate of change.
  • Quadratic: f(x) = ax² + bx + c. Parabola. Has a minimum or maximum turning point.
  • Polynomial: sums of terms with non-negative integer exponents. Smooth, continuous curves.
  • Rational: ratio of two polynomials. May have vertical asymptotes (where denominator = 0).
  • Exponential: f(x) = a⋅bx. Models growth and decay. Domain: all reals. Range: positive reals (for b > 0, a > 0).
  • Logarithmic: f(x) = logb(x). The inverse of an exponential. Domain: positive reals only.

Composite Functions

A composite function applies one function to the output of another. The notation (f ˆ g)(x) means “apply g first, then apply f to the result”. It is equivalent to f(g(x)).

If f(x) = 2x + 1 and g(x) = x², then:

  • f(g(x)) = f(x²) = 2x² + 1 (square first, then double and add 1)
  • g(f(x)) = g(2x + 1) = (2x + 1)² (double and add 1 first, then square)

These are different functions. Composition is generally not commutative: f(g(x)) ≠ g(f(x)).

Inverse Functions

An inverse function undoes what a function does. If f maps input x to output y, then the inverse function f−1 maps y back to x. For f−1 to exist, the original function must be one-to-one (each output must come from exactly one input) — this can be tested with the horizontal line test: no horizontal line should cross the graph more than once.

To find an inverse algebraically: write y = f(x), swap x and y, solve for y, and rename the result f−1(x).

Example: if f(x) = 3x − 7, write y = 3x − 7, swap: x = 3y − 7, solve: y = (x + 7)/3, so f−1(x) = (x + 7)/3. You can verify: f(f−1(x)) = 3⋅(x+7)/3 − 7 = x + 7 − 7 = x. Correct.

Graphically, f and f−1 are reflections of each other in the line y = x.

Summary

A function maps each input to exactly one output. Function notation f(x) names the function and specifies the input; evaluating means substituting a value for x. The domain is the set of valid inputs; the range is the set of actual outputs. The vertical line test identifies functions on graphs. Composite functions chain two functions together, applying the inner one first; the order matters. Inverse functions reverse the mapping and exist when the original function is one-to-one. Mastering these ideas provides the language in which calculus, statistics, and all of applied mathematics are written.