A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Functions and Mappings: Formal Definition

College Depth 61 in the knowledge graph ☐ I know this ☆ Set as goal
1,417topics build on this
283prerequisites beneath it
See this on the map →
Relations as Subsets of Cartesian Products→→Categories and MorphismsDomain and Structure in First-Order Logic+7 more
functions mappings domain-codomain-range

Core Idea

A function f: A → B is a relation from A to B where each element of A is paired with exactly one element of B. This definition generalizes functions beyond real arithmetic to arbitrary sets. The domain A and codomain B are essential parts of the definition; the range is the set of all actual outputs f(A).

Explainer

You already know that a relation from A to B is a subset of the Cartesian product A × B — a collection of ordered pairs (a, b) where a ∈ A and b ∈ B. A function f: A → B is a relation with two additional constraints: it is total (every element of A appears as a first coordinate) and single-valued (no element of A appears as a first coordinate more than once). In other words, for every a ∈ A there exists *exactly one* b ∈ B such that (a, b) ∈ f. Writing "f(a) = b" is shorthand for "(a, b) ∈ f." This is the set-theoretic definition of function — a function *is* a set of ordered pairs satisfying these two conditions.

The distinction between domain, codomain, and range is essential and often confused. The domain A is the set of all inputs — every element of A must have an output. The codomain B is the declared "output type" — it is part of the specification of f and need not equal the set of actual outputs. The range (or image) f(A) = {f(a) : a ∈ A} is the set of values that f actually takes; it is a subset of B, but may be a proper subset. For example, the function f: ℝ → ℝ defined by f(x) = x² has domain ℝ, codomain ℝ, and range [0, ∞) ⊊ ℝ. Changing the codomain to [0, ∞) gives a *different function* — same rule, different specification — even though the rule and range are identical.

Why define functions as sets of pairs rather than as "rules"? The set-theoretic definition is required for rigor in contexts where "rule" is ambiguous or where functions are constructed by set operations. For instance, the axiom of choice constructs functions whose rule cannot be written down explicitly; the set-of-pairs definition handles these without awkwardness. It also makes function equality precise: two functions f and g from A to B are equal iff they have the same graph — the same set of pairs — regardless of how they are described. This extensional notion of equality is fundamental: f(x) = x + 1 − 1 and g(x) = x are the *same* function from ℤ to ℤ.

This formal definition generalizes immediately to arbitrary sets, not just number systems. Functions between finite sets (used in combinatorics and group theory), functions between sets of strings (formal language theory), and functions between structures (homomorphisms in algebra) all fall under the same definition. The building blocks — total, single-valued relations — extend naturally to partial functions (drop totality) and multivalued functions (drop single-valuedness), which arise in computability theory and analysis. Mastering the formal definition of function here is the foundation for all of these, and for the classification of functions as injective, surjective, or bijective that follows immediately from it.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Making 10 as an Addition Strategy → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts Through 10 → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Opposites and Additive Inverses → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Introduction to Exponents → Order of Operations → Integer Order of Operations → Variable Expressions → Variables in Logic → Set Notation Basics → Set Membership and Notation → Cartesian Product and Ordered Pairs → Relations as Subsets of Cartesian Products → Functions and Mappings: Formal Definition

Longest path: 62 steps · 283 total prerequisite topics

Prerequisites (1)

Leads To (9)