Function

Functions & Advanced Algebra

A function is a rule that assigns exactly one output value to each input value.

Definition

A function is like a machine: you put something in, and you always get exactly one thing out. Every input has one and only one output.

Example

A vending machine is like a function. Press B3 and you always get the same snack. You never press B3 and get two different things at random.

Key Insight

The key rule is "one output per input." If an input could give two different outputs, it is not a function.

Definition

A function is a relation between a set of inputs (the domain) and a set of outputs (the range) such that every element of the domain is paired with exactly one element of the range.

Example

$f(x) = x^2$ is a function: input $3$ gives output $9$, always. The relation $y^2 = x$ is NOT a function because $x = 4$ gives both $y = 2$ and $y = -2$.

Key Insight

Functions can be represented as equations, tables, graphs, or mappings. On a graph, the vertical line test checks: if any vertical line crosses the graph more than once, it is not a function.

Definition

Formally, a function $f: A \to B$ is a subset of the Cartesian product $A \times B$ such that for every $a \in A$ there exists exactly one $b \in B$ with $(a, b) \in f$. $A$ is the domain and $B$ is the codomain.

Example

The function $f: \mathbb{R} \to \mathbb{R}$ defined by $f(x) = \sin(x)$ maps every real number to a value in $[-1, 1]$. Its range (image) is $[-1, 1]$, a proper subset of the codomain $\mathbb{R}$.

Key Insight

The concept of a function is foundational to all of mathematics. Category theory generalizes functions to morphisms, capturing structure-preserving maps between abstract objects.