Concept Foundations & Logic ✓ Live

Function

A function is a rule that assigns exactly one output to each input from a given set. Functions are one of the most fundamental and unifying concepts in mathematics — appearing in algebra, calculus, computer science, and beyond. Formally, a function is a special kind of relation between two sets.

A machine that always gives the same answer

Imagine a vending machine: you press button "B4," and it always gives you the same snack. Press it again, same snack comes out. That's exactly what a function is — a rule where every input has one, and only one, output.

🧱 Simple example: f(x) = x + 3 is a function. Put in 5, get out 8. Put in 5 again, you always get 8 again — never anything else. That reliability is the whole point.

What functions are NOT

Something is not a function if one input could give two different outputs. For example, "the square root of x" is tricky — is √9 equal to 3 or −3? Both work! To make it a function, mathematicians agree that √x always means the positive square root. That's a rule that fixes the ambiguity.

Function notation

We write f(x) to mean "the output of function f when the input is x." So if f(x) = x², then f(3) = 9, f(5) = 25, and f(−2) = 4.

Why functions matter everywhere

  • In science: temperature as a function of time, distance as a function of speed
  • In computer programming: a function is literally a named block of code that takes inputs and returns an output
  • In everyday life: your age is a function of your birth year (given today's date)

Formal definition and properties

Definition

A function f from set A (the domain) to set B (the codomain), written f : A → B, assigns to each element a ∈ A exactly one element f(a) ∈ B. The set of actual outputs {f(a) : a ∈ A} is the range (or image).

Key properties

  • Injective (one-to-one): different inputs always give different outputs — f(a) = f(b) implies a = b
  • Surjective (onto): every element of the codomain is hit by some input — the range equals the codomain
  • Bijective: both injective and surjective — a perfect pairing between A and B, meaning the function has an inverse

Common function types

FunctionFormulaDomain
Linearf(x) = mx + bAll reals
Quadraticf(x) = ax² + bx + cAll reals
Exponentialf(x) = aˣAll reals
Logarithmicf(x) = logₐ(x)x > 0
Trigonometricf(x) = sin(x)All reals

Composition of functions

Given f : A → B and g : B → C, the composition g∘f : A → C is defined by (g∘f)(a) = g(f(a)). Function composition is associative but not generally commutative: f∘g ≠ g∘f in general.

Inverse functions

If f : A → B is bijective, its inverse f⁻¹ : B → A satisfies f⁻¹(f(a)) = a and f(f⁻¹(b)) = b. Not every function has an inverse — only bijective ones. For example, f(x) = x² on all reals is not injective (both 2 and −2 map to 4), so it has no inverse unless the domain is restricted (e.g. to x ≥ 0).

Set-theoretic foundations and historical development

Functions as sets of ordered pairs

In modern set theory, a function f : A → B is formally defined as a subset of the Cartesian product A × B — a set of ordered pairs (a, b) — satisfying: for every a ∈ A, there is exactly one b ∈ B with (a,b) ∈ f. This reduces the function concept entirely to set theory, with no extra primitive notion needed. This definition, standard since the early 20th century, resolves earlier ambiguities about what a function "really is."

Historical development of the concept

The word "function" was introduced by Leibniz (1673) in a geometric context. Euler (1748) gave the first algebraic definition, treating a function as any expression built from variables and constants using algebraic operations. Dirichlet (1837) gave the modern, general definition — a function is any rule assigning outputs to inputs, without requiring an algebraic formula. This was radical: it allowed functions like the Dirichlet function (1 if x is rational, 0 if irrational), which cannot be written as any single "nice" formula and is discontinuous everywhere.

Functions in category theory

In category theory, functions between sets are the prototypical example of morphisms — the abstract notion of "structure-preserving map" that generalises to morphisms between groups (homomorphisms), topological spaces (continuous maps), and more. This perspective, developed by Eilenberg and Mac Lane (1945), treats objects and their maps as more fundamental than the internal structure of the objects themselves.

Computability and functions

Not every mathematically definable function is computable — able to be evaluated by an algorithm in finite time. The Church-Turing thesis identifies "computable function" with "function computable by a Turing machine." The halting problem shows there exist well-defined functions (e.g., "does program P halt on input x?") that provably cannot be computed by any algorithm.

📚 Sources

Tier 1 Enderton, H.B. (1977). Elements of Set Theory. Academic Press. — Standard formal treatment of functions as sets of ordered pairs.
Tier 1 Kline, M. (1972). Mathematical Thought from Ancient to Modern Times. Oxford University Press. — Historical development of the function concept.
Tier 2 Mac Lane, S. (1998). Categories for the Working Mathematician. 2nd ed. Springer.

🔗 Related entries

Built fromSet
Used inLimit— functions are the objects analysis studies
Used inVector Space— linear maps are functions
Entry v1.0 · Added 2026-05-27 · Foundations & Logic · Concept JSON Markdown Status