Functions — Domain, Range, Composition, Inverses

⚡ Key Takeaways

A function assigns each input exactly one output; its domain is the set of allowed inputs, its range the set of achieved outputs. Composition chains functions (g∘fg\circ f means "do ff, then gg"), and an inverse f−1f^{-1} undoes ff exactly when ff is one-to-one and onto. Used everywhere in algebra, calculus, and applied modelling. Formalised through the 17th–19th centuries (Leibniz, Euler, Dirichlet).

💡 The Core Insight

A function is a machine with a guarantee: feed it a legal input and you get one, and only one, output. Three operations follow naturally. Domain/range ask what is legal in and what comes out. Composition asks what happens when the output of one machine becomes the input of another. Inversion asks can we run the machine backward — possible only when no two inputs share an output (injective) and every target value is reached (surjective).

Formal Statement

DefinitionFunction, Domain, Codomain, Range

A function ff from a set AA to a set BB, written f:A→Bf:A\to B, is a rule assigning to each x∈Ax\in A exactly one element f(x)∈Bf(x)\in B.

1
f:A→B,∀x∈A  ∃! y∈B:  y=f(x)\quad f:A\to B,\qquad \forall x\in A\;\exists!\,y\in B:\; y=f(x)

Derivation hint: the symbol ∃!\exists! means "there exists exactly one"; this is the defining single-valuedness property.

  • AA = domain (set of legal inputs), denoted dom⁡(f)\operatorname{dom}(f).
  • BB = codomain (declared target set).
  • The range (or image) is the actually-achieved subset:
2
ran⁡(f)={ f(x):x∈A }⊆B\quad \operatorname{ran}(f)=\{\,f(x): x\in A\,\}\subseteq B

Derivation hint: collect every output as xx runs over all of AA; this need not be all of BB. For real functions given by a formula with no stated domain, the natural domain is the largest subset of R\mathbb{R} on which the formula is defined (no division by zero, no even root of a negative, no log of a non-positive).

DefinitionInjective, Surjective, Bijective
3
injective (one-to-one):f(x1)=f(x2)  ⇒  x1=x2\quad \text{injective (one-to-one):}\quad f(x_1)=f(x_2)\;\Rightarrow\;x_1=x_2

Derivation hint: contrapositive of "distinct inputs give distinct outputs."

4
surjective (onto):∀y∈B  ∃x∈A:  f(x)=y\quad \text{surjective (onto):}\quad \forall y\in B\;\exists x\in A:\; f(x)=y

Derivation hint: every codomain element is hit, i.e. ran⁡(f)=B\operatorname{ran}(f)=B.

5
bijective  ⟺  injective and surjective\quad \text{bijective}\;\Longleftrightarrow\;\text{injective and surjective}

Derivation hint: combine [3] and [4]; bijectivity is exactly the condition for an inverse to exist.

DefinitionComposition

Given f:A→Bf:A\to B and g:B→Cg:B\to C, the composition g∘f:A→Cg\circ f:A\to C is

6
(g∘f)(x)=g(f(x)),dom⁡(g∘f)={x∈dom⁡(f):f(x)∈dom⁡(g)}\quad (g\circ f)(x)=g\big(f(x)\big),\qquad \operatorname{dom}(g\circ f)=\{x\in\operatorname{dom}(f): f(x)\in\operatorname{dom}(g)\}

Derivation hint: apply ff first, then feed its output into gg; the input must survive both stages.

TheoremExistence of the Inverse Function

A function f:A→Bf:A\to B has a two-sided inverse f−1:B→Af^{-1}:B\to A if and only if ff is bijective. When it exists, f−1f^{-1} is unique and satisfies

7
f−1(f(x))=x    (∀x∈A),f(f−1(y))=y    (∀y∈B)\quad f^{-1}\big(f(x)\big)=x\;\;(\forall x\in A),\qquad f\big(f^{-1}(y)\big)=y\;\;(\forall y\in B)

Derivation hint: f−1f^{-1} undoes ff on both sides; these two identities say f−1∘f=idAf^{-1}\circ f=\mathrm{id}_A and f∘f−1=idBf\circ f^{-1}=\mathrm{id}_B.

Why It Holds / Derivation

ProofBijectivity ⇔ Invertibility

Steps: 1. (⇐ Suppose ff is bijective.) For each y∈By\in B, surjectivity [4] guarantees some xx with f(x)=yf(x)=y, and injectivity [3] guarantees that xx is unique. Define f−1(y)f^{-1}(y) to be that unique xx. 2. This rule assigns exactly one output to each yy, so by [1] it is a genuine function f−1:B→Af^{-1}:B\to A. 3. By construction f(f−1(y))=yf(f^{-1}(y))=y. And for any xx, applying the rule to y=f(x)y=f(x) returns the unique preimage of f(x)f(x), which is xx itself, giving f−1(f(x))=xf^{-1}(f(x))=x. Both identities of [7] hold. 4. (⇒ Suppose an inverse gg exists with g∘f=idg\circ f=\mathrm{id} and f∘g=idf\circ g=\mathrm{id}.) If f(x1)=f(x2)f(x_1)=f(x_2), apply gg: x1=g(f(x1))=g(f(x2))=x2x_1=g(f(x_1))=g(f(x_2))=x_2, so ff is injective. For any yy, f(g(y))=yf(g(y))=y exhibits a preimage, so ff is surjective. Hence ff is bijective. ■\blacksquare

∎
ProofUniqueness of the Inverse

Suppose gg and hh both invert ff. Then for every yy:

g(y)=g(f(h(y)))=(g∘f)(h(y))=h(y).g(y)=g\big(f(h(y))\big)=\big(g\circ f\big)\big(h(y)\big)=h(y).

So g=hg=h; the inverse is unique. ■\blacksquare

∎
mathematician · Peter Gustav Lejeune Dirichlet | 1805–1859

Dirichlet gave (1837) the modern definition of a function as an arbitrary correspondence — yy is a function of xx if to each xx there corresponds a single definite yy, regardless of any formula. His "monster," the indicator function of the rationals,

1Q(x)={1x∈Q0x∉Q\mathbf{1}_\mathbb{Q}(x)=\begin{cases}1 & x\in\mathbb{Q}\\ 0 & x\notin\mathbb{Q}\end{cases}

deliberately had no analytic expression, forcing mathematicians to accept that "function" means rule of assignment, not formula. This freed the concept from the Eulerian view of functions as expressions and underpins all subsequent analysis.

Building Intuition

🧠 Intuition

Think of a function as a vending machine. The domain is the list of buttons that actually do something; pressing a nonexistent button (input outside the domain) yields nothing — undefined. The range is the set of snacks you can possibly get out. Single-valuedness means each button gives the same product every time — a machine that randomly dispensed chips or a soda would not be a function.

Composition is two machines in series: button on machine ff produces a token, which you feed into machine gg. You can only do this if ff's token is a valid input for gg — hence the domain restriction in [6].

Inverse is a refund machine: insert the snack, get your money back. This is only sensible if (a) two different buttons never give the same snack (otherwise the refund machine wouldn't know which button to credit — injectivity), and (b) every snack on the shelf was actually obtainable (surjectivity). Graphically, injectivity is the horizontal line test, and the inverse's graph is the original reflected across y=xy=x.

Figure
Reflection of a function and its inverse across the line y = x
x y y = x y = f(x) y = f⁻¹(x) (a, b) (b, a)

Worked Examples

ExampleDomain, Range, and Composition with Numbers

Given: f(x)=x−2f(x)=\sqrt{x-2} and g(x)=1x−5g(x)=\dfrac{1}{x-5}.

Find the natural domain of ff, the range of ff, and (g∘f)(x)(g\circ f)(x) with its domain.

Steps: 1. Domain of ff: need x−2≥0⇒x≥2x-2\ge 0\Rightarrow x\ge 2. So dom⁡(f)=[2,∞)\operatorname{dom}(f)=[2,\infty). 2. Range of ff: ⋅≥0\sqrt{\cdot}\ge 0 and grows without bound, so ran⁡(f)=[0,∞)\operatorname{ran}(f)=[0,\infty). 3. Compose: (g∘f)(x)=g(x−2)=1x−2−5(g\circ f)(x)=g(\sqrt{x-2})=\dfrac{1}{\sqrt{x-2}-5}. 4. Domain of g∘fg\circ f: start with x≥2x\ge 2 (so ff is defined). Then exclude where x−2−5=0\sqrt{x-2}-5=0, i.e. x−2=5⇒x−2=25⇒x=27\sqrt{x-2}=5\Rightarrow x-2=25\Rightarrow x=27.

Answer:

(g∘f)(x)=1x−2−5,dom⁡=[2,27)∪(27,∞)\boxed{(g\circ f)(x)=\frac{1}{\sqrt{x-2}-5},\quad \operatorname{dom}=[2,27)\cup(27,\infty)}
ExampleFinding an Inverse and Verifying It

Given: f(x)=2x+3x−1f(x)=\dfrac{2x+3}{x-1}, defined for x≠1x\ne 1.

Find f−1f^{-1}, and verify [7] at a test value.

Steps: 1. Set y=2x+3x−1y=\dfrac{2x+3}{x-1} and solve for xx:

y(x−1)=2x+3  ⇒  yx−y=2x+3  ⇒  x(y−2)=y+3.y(x-1)=2x+3\;\Rightarrow\;yx-y=2x+3\;\Rightarrow\;x(y-2)=y+3.

2. Hence x=y+3y−2x=\dfrac{y+3}{y-2}, so swapping names:

f−1(x)=x+3x−2,x≠2.f^{-1}(x)=\frac{x+3}{x-2},\qquad x\ne 2.

3. Check ranges/domains match: ran⁡(f)=R∖{2}=dom⁡(f−1)\operatorname{ran}(f)=\mathbb{R}\setminus\{2\}=\operatorname{dom}(f^{-1}) ✓ (the excluded output 22 is the horizontal asymptote). 4. Verify [7] at x=3x=3: f(3)=6+32=92f(3)=\dfrac{6+3}{2}=\dfrac{9}{2}. Then f−1(9/2)=9/2+39/2−2=15/25/2=3f^{-1}(9/2)=\dfrac{9/2+3}{9/2-2}=\dfrac{15/2}{5/2}=3 ✓.

Answer:

f−1(x)=x+3x−2,x≠2\boxed{f^{-1}(x)=\frac{x+3}{x-2},\quad x\ne 2}

Common Misconceptions

⚠️ Common mistake

Pitfall 1 — "f−1f^{-1} means 1/f1/f." The superscript −1-1 on a function denotes the inverse function, not the reciprocal. For f(x)=x3f(x)=x^3, f−1(x)=x3f^{-1}(x)=\sqrt[3]{x}, not x−3x^{-3}.

Pitfall 2 — composition order. g∘fg\circ f applies ff first. In general g∘f≠f∘gg\circ f\ne f\circ g; composition is not commutative.

Pitfall 3 — forgetting domain restrictions in composition. Simplifying (g∘f)(x)(g\circ f)(x) algebraically can hide excluded points. The domain of the composite is determined before any cancellation, from [6].

Pitfall 4 — assuming every function has an inverse. Only bijective functions do. Many "inverses" in school (like arcsin⁡\arcsin) exist only after restricting the domain to make the original injective.

Counterexample

Let f(x)=x2f(x)=x^2 on R\mathbb{R}. This is not invertible: it fails the horizontal line test because f(2)=f(−2)=4f(2)=f(-2)=4, violating injectivity [3]. There is no single rule gg with g(4)g(4) returning both 22 and −2-2. The fix is to restrict the domain to [0,∞)[0,\infty), where ff becomes injective; then f−1(x)=xf^{-1}(x)=\sqrt{x} is well-defined. This is exactly why 4=2\sqrt{4}=2 (not ±2\pm 2): the square-root symbol denotes the inverse of the restricted squaring function. The same restriction strategy gives arcsin⁡\arcsin, arccos⁡\arccos, and arctan⁡\arctan.

Connections

connection

Domain and range are the natural arena for Limits and Continuity — a limit asks about behaviour near a domain point, possibly one not in the domain. Composition underlies the Chain Rule in differentiation: ddxg(f(x))=g′(f(x))f′(x)\frac{d}{dx}g(f(x))=g'(f(x))f'(x) is composition made dynamic. Inverses connect to Logarithmic and Exponential Functions (mutual inverses) and to Inverse Trigonometric Functions. The bijection concept is the backbone of Cardinality of Sets, where "same size" means "there exists a bijection." Reflection across y=xy=x links to Transformations of Graphs.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- c. 1350 — Oresme plots qualities against extension, an early graphical sense of dependence.
- 1673 — Leibniz introduces the word function (Latin functio) for quantities depending on a curve.
- 1718 — Johann Bernoulli defines a function as an expression formed from a variable and constants.
- 1748 — Euler (Introductio in analysin infinitorum) treats functions as analytic expressions and introduces the notation f(x)f(x).
- 1822 — Fourier shows discontinuous functions can be represented by trigonometric series, straining the "expression" view.
- 1829–1837 — Dirichlet gives the modern arbitrary-correspondence definition and his pathological indicator function.
- 1872 — Weierstrass exhibits a continuous, nowhere-differentiable function, cementing the abstract view.
- 1888–1895 — Dedekind & Cantor formalise functions set-theoretically and use bijections to define cardinality.
- 1914 — Hausdorff and the early 20th-century set theorists encode a function as a set of ordered pairs, the definition used today.

Subtleties & Limits

open-problem

The "function as set of ordered pairs" definition is clean but raises deep questions. The Axiom of Choice is needed to guarantee a choice function selecting one element from each of infinitely many nonempty sets — a function whose existence cannot be proved constructively. In analysis, distinguishing functions that are defined everywhere but wildly discontinuous (Dirichlet's), from continuous ones, motivated measure theory and the question of which functions can be integrated. At the foundational frontier, constructive mathematics rejects non-computable functions, so even the seemingly settled notion of "function" splits into competing schools depending on whether one demands an explicit algorithm. Whether a clean "inverse" exists for broad classes of maps (e.g. the open question of efficiently inverting cryptographic one-way functions, tied to P vs NP) remains unresolved.

See Also

Graphs of Functions · Transformations of Graphs · Inverse Trigonometric Functions · Logarithmic and Exponential Functions · The Chain Rule · Cardinality of Sets · Limits and Continuity