What Is a Function?

Part 14, Chapter 14: Functions and Their Graphs

Learning objectives

  • Define what a function is and use proper function notation
  • Identify the domain and range of a function
  • Evaluate a function at a given input
  • Determine whether a rule defines a function

A function is a machine, not a formula. You feed it an input, it produces exactly one output, and it does the same thing every time you give it the same input. The formula on the inside is just one way to describe the machine, the machine itself is the rule "this input goes to that output." Once you internalise that picture, almost every confusion about functions dissolves.

The formal definition

A function ff from a set AA to a set BB, written f:AtoBf: A \to B, is a rule that assigns to each element xinAx \in A exactly one element f(x)inBf(x) \in B. The set AA is the domain (the legal inputs). The set BB is the codomain. The range (or image) is the subset of BB that ff actually hits: f(x):xinA\{f(x) : x \in A\}.

The phrase "exactly one" is the rule that makes a function a function. Two different inputs may share an output, that is fine, but a single input cannot fork into two outputs. If the rule "square this number" sent 22 to both 44 and 4-4, it would not be a function.

Notation: name, input, output

The expression f(x)=x2+1f(x) = x^2 + 1 has three parts. The name ff identifies the machine. The variable xx is a placeholder for the input. The expression x2+1x^2 + 1 is the recipe applied to that input. Some books write xmapstox2+1x \mapsto x^2 + 1 to emphasise the mapping picture, xx goes to x2+1x^2 + 1.

Domain by formula

For real-valued functions, the domain is often whatever inputs the formula actually accepts. The square root f(x)=sqrtxf(x) = \sqrt{x} refuses negative numbers in the reals, so its domain is [0,infty)[0, \infty). The reciprocal g(x)=dfrac1x2g(x) = \dfrac{1}{x - 2} refuses x=2x = 2 because dividing by zero is undefined, so its domain is xinmathbbR:xneq2\{x \in \mathbb{R} : x \neq 2\}. Reading the formula and asking "what would break?" is the standard technique.

Where this shows up
  • Programming: A function in any programming language is exactly a function in this sense: a rule that takes an input and produces a unique output. The function's signature is the formal domain-range declaration.
  • Economics: A demand function Q(P)Q(P) returns "quantity demanded" for any price; the domain is non-negative prices, and the range is non-negative quantities, economics is built on functions throughout.
  • Machine Learning: A trained neural network IS a function from input vectors (images, text tokens) to output vectors (class scores, embeddings); the entire field is about finding the right function within a parameterised family.

(Pick a family in the dropdown, drag the coefficient sliders, and click anywhere on the curve to read off a specific (x,f(x))(x, f(x)) pair. The readout names the domain and range for the family you have selected.)

Try it

  • Predict first: for y=ax2y = ax^2 with aa negative, what does the range become? Choose the quadratic family, drag aa to a negative value, and verify.
  • Predict first: for y=1/(xh)y = 1/(x - h) with h=2h = 2, which value of xx must be excluded from the domain, and why? Switch to the reciprocal family, drag hh to 22, and explain in your own words.
  • Pick the square-root family with h=1h = 1. Click the curve at x=5x = 5 and read off f(5)f(5); verify by hand.

Pause: a rule sends 1mapstoa1 \mapsto a, 1mapstob1 \mapsto b, and 2mapstoc2 \mapsto c. Is this a function? Why or why not?

A trap to watch for

Beginners often see f1(x)f^{-1}(x) and read it as dfrac1f(x)\dfrac{1}{f(x)}. It is not. The superscript 1-1 on a function name denotes the inverse mapping, not the reciprocal value. If f(x)=2x+3f(x) = 2x + 3, then f1(x)=dfracx32f^{-1}(x) = \dfrac{x - 3}{2}, not dfrac12x+3\dfrac{1}{2x + 3}. The notation is unfortunate because x1x^{-1} on a number really does mean dfrac1x\dfrac{1}{x}, but on a function it means "the rule that undoes ff." Read the symbol in context: if there is a function name to its left, it is an inverse, not a reciprocal.

What you now know

You can recognise a rule as a function (or reject it because some input has two outputs), identify domain and codomain, evaluate a function at a chosen input, and find the natural domain implied by a formula by asking what would make the formula break. The next section narrows the focus to a single very well-behaved family, the polynomials, where the domain question never arises because every real input is legal.

Quick check

Mark section complete →

References

  • Lang, S. (1971). Basic Mathematics. Springer. Chapter 13: the function-as-machine viewpoint Lang uses to bridge from algebra to analysis.
  • Spivak, M. (2008). Calculus, 4th ed. Publish or Perish. Chapter 3: rigorous treatment of functions, domains, and graphs.
  • Stewart, J. (2015). Calculus: Early Transcendentals, 8th ed. Cengage. Sections 1.1–1.2, standard pedagogical treatment with many worked examples.

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.