Mathematics · 22 min read
Functions
A rule that assigns exactly one output to each allowed input. Functions are the main way algebra names relationships you can graph, compose, and invert.
Why this exists
Equations and graphs stay mysterious until you know what object you are defining. A function is that object: a pairing rule with a domain (allowed inputs) and a rule that picks one output per input.
Most of algebra is building, transforming, and solving questions about functions. Without the definition, slope, inverse, and composition look like unrelated tricks.
Axioms & primitives
- 01A function maps each input in its domain to exactly one output.
- 02The domain is the set of inputs where the rule is defined.
- 03The range is the set of outputs that actually occur, not every conceivable output type.
- 04Two functions are the same only if they agree on every input in the domain.
- 05Composition applies one function after another when outputs match inputs.
Learning objectives
After this lesson you should be able to:
- Use function notation f(x) and state the domain when given a rule.
- Distinguish domain, range, and codomain in a word problem.
- Decide whether a graph or table represents a function. Use the vertical line test.
- Compose two simple functions and state the domain of the composition.
Progressive depth
Read the layers in order for a full explanation. Or open the layer you need.
Intuition
Think of a vending machine that takes a code and returns one snack. Two different snacks for the same code would be a bug. A function is the mathematical version of that contract.
Temperature as a function of time gives one temperature reading per moment. Price as a function of weight gives one price for each weight on the scale.
When a rule is ambiguous, you fix the domain or rewrite the rule until each allowed input has a single answer.
Formal shape
A function f from set A to set B assigns each element a in A exactly one element f(a) in B. We write f: A → B. The set A is the domain. The codomain B is the target type; the range is { f(a) : a in A }.
Function notation f(x) reads the value at x. Piecewise rules, tables, graphs, and formulas are different views of the same idea when they satisfy the one-output rule.
Composition: (f ∘ g)(x) = f(g(x)). The domain of f ∘ g is the set of x where g(x) is in the domain of f.
Worked examples
Linear rule f(x) = 2x + 1: domain often all reals; range all reals. Squaring g(x) = x²: domain all reals; range y ≥ 0.
Piecewise: f(x) = x if x ≥ 0, else -x (absolute value). Each x maps to one output.
Table: if input 2 maps to both 5 and 7, the table is not a function until you remove or fix the conflict.
Composition: if h(x) = x + 1 and k(x) = x², then (h ∘ k)(3) = h(k(3)) = h(9) = 10.
Edge cases
Implicit relations like x² + y² = 1 describe a circle. Solving for y requires two branches; the full relation is not one function until you restrict to y ≥ 0 or y ≤ 0.
Real data often has noise: two measurements at the same time may differ. Modeling still uses functions, but you may average or choose a domain where the rule is enforced.
Advanced math generalizes functions beyond numbers (maps between any sets). The one-output rule stays.
Mental models
Machine
Drop a number in; the machine applies a fixed rule; one number comes out.
Input-output table
Each row has one input and one output. Duplicate inputs with different outputs break the function idea.
Vertical line test
On a graph, if a vertical line hits more than one point, the graph is not a function of x.
Common misconceptions
Myth
Any equation with x and y defines a function of x.
Reality
A circle satisfies x and y but fails the one-output rule for many x values. Some relations are not functions.
Myth
The range is always all real numbers.
Reality
Range is what the rule actually hits. A square root of x has range y ≥ 0 when x ≥ 0.
Myth
f(x) means f times x.
Reality
f(x) is the value of function f at input x. Multiplication is a different use of parentheses.
Exercises
Work these without looking up answers first. Check yourself against the intent notes.
Exercise 01
Is the rule 'assign each person their birth year' a function from people to years? What if two people share a birth year?
What good looks like
Many inputs can share an output; the rule fails only if one person has two birth years.
Exercise 02
For f(x) = 1/(x - 2), state a natural domain and explain.
What good looks like
Domain excludes x = 2 where division by zero would occur.
Exercise 03
Given f(x) = x + 1 and g(x) = 3x, compute (f ∘ g)(2) and (g ∘ f)(2) and show they differ.
What good looks like
Composition order matters; numeric check shows non-commutativity.
Sources & further reading
External references. Prefer primary documents and clear explainers.