A function is the most-used object in mathematics and computing: a rule that turns each input into exactly one output. Chapter 6 built sets and Cartesian products; a function is just a special subset of a product X × Y, so this chapter stands directly on the last one.
The thread. Section 7.1 pins down what a function is (every input gets one output) and the vocabulary of image, range and inverse image. Section 7.2 asks two questions about the output side: can two inputs collide (one-to-one?) and is every target hit (onto?). Both at once is a bijection, which can be run backward to give an inverse. Section 7.3 chains functions together (composition), and 9.4 turns “not one-to-one” into a powerful counting tool, the pigeonhole principle.
The full recorded session for section 7.1. Watch it alongside this companion: the “is it a function?” arrow-diagram checker, the function evaluator and the equality-of-functions demonstrator below let you practise each idea as it is introduced.
In an arrow diagram the two rules read simply: every left-hand element has exactly one arrow leaving it. The right side is unconstrained – a co-domain element may receive zero, one, or many arrows.
Reading a diagram (Example 7.1.2). With f(a)=2, f(b)=4, f(c)=2: the range is {2, 4}; the inverse image of 2 is {a, c}; of 4 is {b}; of 1 is ∅ (nothing maps to 1). As ordered pairs, f = {(a,2),(b,4),(c,2)}. Two arrows reaching 2 is allowed; 1 and 3 being missed is allowed – only the left side is constrained.
In 7.1 the constraint was only on the left (domain) side. Now two questions about the right (co-domain) side:
Example 7.2.2. f : R → R, f(x)=4x−1 is one-to-one (4x₁−1=4x₂−1 ⇒ x₁=x₂). But g : Z → Z, g(n)=n² is not: g(2)=g(−2)=4 yet 2 ≠ −2 – squaring forgets the sign.
Example 7.2.5. f : R → R, f(x)=4x−1 is onto: given y, take x=(y+1)/4 ∈ R. But h : Z → Z, h(n)=4n−1 is not onto: y=0 needs n=1/4 ∉ Z. Same rule, different domain, opposite verdict – one-to-one and onto are independent properties.
Bijections count. A bijection X ↔ Y proves |X| = |Y|. Example 7.2.8 pairs the four subsets of {a,b} with the four length-2 bit strings (∅↔00, {a}↔10, {b}↔01, {a,b}↔11) – a perfect matching, so a subset and a bit string are “the same data”.
Order is part of the operation (Example 7.3.1). For f(n)=n+1 and g(n)=n²: (g∘f)(n)=(n+1)² but (f∘g)(n)=n²+1. At n=1 these give 4 and 2. So composition is not commutative.
Why 7.3.3 holds. If g(f(x₁))=g(f(x₂)), then g one-to-one gives f(x₁)=f(x₂), then f one-to-one gives x₁=x₂.
The recipe every time: name the pigeons, name the holes, check pigeons > holes. The conclusion is then automatic; the art is choosing the holes. Examples: 13 people share a birth-month (13 > 12); 3 socks guarantee a matched pair from 2 colours; among 8 integers {1..8}, picking 5 forces a pair summing to 9 (holes {1,8},{2,7},{3,6},{4,5}); every fraction’s decimal terminates or repeats (only b possible remainders).
Example 9.4.5. Among 85 people, must 4 share a last initial? Holes = 26, take k=3: 3 < 85/26 ≈ 3.27, so some initial is shared by ≥ 4. Contrapositive view (Example 9.4.6 style): if at most 3 shared each initial, at most 3×26 = 78 people – but there are 85 > 78, contradiction. “At most k per hole ⇒ at most k·m total” is often the cleanest route.