Login

Concepts

Read through concept notes with worked explanations and diagrams, chapter by chapter.

Concept 06 / 10Sets, Relations and Functions

One-One, Onto and Bijective Functions, and Counting Functions

Injective, surjective and bijective functions, how to test them algebraically, graphically and with derivatives, the finite-set equivalence of one-one and onto, and the formulas for counting all, one-one, onto and bijective maps between finite sets.

Figure 1
Functions are classified by two independent questions. Does ff ever merge two inputs into one output? Does ff use up the whole codomain? One-one (injective): distinct inputs always give distinct outputs. Formally, f(x1)=f(x2)⇒x1=x2f(x_{1}) = f(x_{2}) \Rightarrow x_{1} = x_{2}, or equivalently x1≠x2⇒f(x1)≠f(x2)x_{1} \neq x_{2} \Rightarrow f(x_{1}) \neq f(x_{2}). If some pair of distinct inputs shares an image, ff is many-one. Graphically, a function is one-one exactly when every horizontal line meets its graph at most once (the horizontal line test). A strictly monotonic function is always one-one, so for differentiable functions a quick sufficient test is that f′(x)>0f'(x) > 0 throughout (or f′(x)<0f'(x) < 0 throughout), with f′=0f' = 0 allowed only at isolated points. The converse fails for discontinuous functions: f(x)=1xf(x) = \frac{1}{x} is one-one on R−{0}\mathbb{R} - \{0\} but not monotonic there. Onto (surjective): every element of the codomain is the image of at least one input, that is, range == codomain. If some element of the codomain is left unused, ff is into. Onto-ness depends on the codomain you declare. The same rule f(x)=x2f(x) = x^{2} is into as a map R→R\mathbb{R} \to \mathbb{R} (negative numbers are unused) but onto as a map R→[0,∞)\mathbb{R} \to [0, \infty). To test onto-ness, compute the range and compare it with the stated codomain. Bijective: both one-one and onto. A bijection pairs the domain and codomain perfectly, element for element, which is exactly the condition for an inverse function to exist. The diagram shows one example of each type: one-one but into, many-one but onto, and bijective. Useful facts. For continuous functions on an interval, one-one is equivalent to strictly monotonic. A polynomial of even degree from R\mathbb{R} to R\mathbb{R} is never one-one and never onto: it tends to the same infinity at both ends, so it has a global maximum or minimum. A polynomial of odd degree from R\mathbb{R} to R\mathbb{R} is always onto (by the intermediate value theorem), and it is one-one exactly when it is monotonic, which can be checked with f′f'. Every periodic function on R\mathbb{R} is many-one. Finite sets. If f:A→Af : A \to A with AA finite, then ff is one-one if and only if it is onto. If nn inputs give nn distinct outputs in an nn-element set, every output is used; conversely, if all nn outputs are used by nn inputs, no two inputs can share one. This pigeonhole argument fails for infinite sets, as Brain-Teaser 3 shows. More generally, a one-one map A→BA \to B forces n(A)≤n(B)n(A) \le n(B), and an onto map forces n(A)≥n(B)n(A) \ge n(B). Counting functions from AA (with mm elements) to BB (with nn elements). All functions: each of the mm inputs independently chooses one of nn outputs, giving nmn^{m}. Note that this is nmn^{m}, not mnm^{n}: the base is the number of choices, the exponent is the number of choosers. One-one functions (requires m≤nm \le n): the first input has nn choices, the next n−1n - 1, and so on, giving nPm=n!(n−m)!^{n}P_{m} = \frac{n!}{(n - m)!}. If m>nm > n there are none. Bijections (requires m=nm = n): n!n!. Onto functions (requires m≥nm \ge n): count all functions and subtract those that miss at least one output, using inclusion-exclusion over the missed outputs: ∑k=0n(−1)k(nk)(n−k)m=nm−(n1)(n−1)m+(n2)(n−2)m−⋯\sum_{k=0}^{n} (-1)^{k} \binom{n}{k} (n - k)^{m} = n^{m} - \binom{n}{1}(n - 1)^{m} + \binom{n}{2}(n - 2)^{m} - \cdots For n=2n = 2 this gives 2m−22^{m} - 2: every function except the two constant ones. Into functions: total minus onto. Key Takeaways: - One-one: f(x1)=f(x2)⇒x1=x2f(x_{1}) = f(x_{2}) \Rightarrow x_{1} = x_{2}; horizontal line test; strictly monotonic implies one-one. - Onto: range == codomain. Always compute the range and compare. - Changing the codomain changes onto-ness; restricting the domain can create one-one-ness. - Even-degree polynomials R→R\mathbb{R} \to \mathbb{R}: neither one-one nor onto. Odd-degree: always onto. - Finite AA, f:A→Af : A \to A: one-one   ⟺  \iff onto   ⟺  \iff bijective. - Counts: all nmn^{m}; one-one n!(n−m)!\frac{n!}{(n - m)!}; bijections n!n!; onto ∑k=0n(−1)k(nk)(n−k)m\sum_{k=0}^{n} (-1)^{k}\binom{n}{k}(n - k)^{m}. - Onto maps from mm elements to 22 elements: 2m−22^{m} - 2. Onto maps from mm elements to 33 elements: 3m−3⋅2m+33^{m} - 3 \cdot 2^{m} + 3. - Pitfall: writing mnm^{n} for the number of functions from AA to BB. Brain-Teaser 1: Find the number of onto functions from a 55-element set to a 33-element set, and verify the answer by a direct count. Solution: By inclusion-exclusion, 35−(31)25+(32)15−(33)05=243−96+3−0=1503^{5} - \binom{3}{1}2^{5} + \binom{3}{2}1^{5} - \binom{3}{3}0^{5} = 243 - 96 + 3 - 0 = 150. Direct check: an onto map splits the 55 inputs into 33 non-empty groups, then assigns the groups to the 33 outputs. The group sizes are (3,1,1)(3, 1, 1) or (2,2,1)(2, 2, 1). The number of ways to form groups of sizes 3,1,13, 1, 1 is (53)=10\binom{5}{3} = 10, and of sizes 2,2,12, 2, 1 is 12(52)(32)=15\frac{1}{2}\binom{5}{2}\binom{3}{2} = 15, so there are 2525 ways to split. Assigning the 33 groups to the 33 outputs gives 3!=63! = 6 ways, and 25×6=15025 \times 6 = 150. Having two independent methods that agree is the best check you can have in the exam. Brain-Teaser 2: Decide whether f(x)=x3+xf(x) = x^{3} + x and g(x)=x3−xg(x) = x^{3} - x, both as maps R→R\mathbb{R} \to \mathbb{R}, are one-one, onto, or bijective. Solution: Both are odd-degree polynomials, so both are onto. For one-one-ness, check monotonicity. f′(x)=3x2+1>0f'(x) = 3x^{2} + 1 > 0 for all xx, so ff is strictly increasing and therefore one-one; ff is a bijection. g′(x)=3x2−1g'(x) = 3x^{2} - 1 changes sign at x=±13x = \pm\frac{1}{\sqrt{3}}, and indeed g(−1)=g(0)=g(1)=0g(-1) = g(0) = g(1) = 0, three inputs with the same output, so gg is many-one and not a bijection. The small change from +x+x to −x-x creates a local maximum and minimum, and a turning point is what makes a continuous function fail the horizontal line test. Brain-Teaser 3: Give a function N→N\mathbb{N} \to \mathbb{N} that is one-one but not onto, and one that is onto but not one-one. Why doesn't this contradict the finite-set result? Solution: f(n)=n+1f(n) = n + 1 is one-one (n1+1=n2+1n_{1} + 1 = n_{2} + 1 forces n1=n2n_{1} = n_{2}), but 11 is never attained, so it is not onto. g(n)=⌈n2⌉g(n) = \lceil \frac{n}{2} \rceil (so 1,1,2,2,3,3,…1, 1, 2, 2, 3, 3, \ldots) is onto, since k=g(2k)k = g(2k), but g(1)=g(2)g(1) = g(2), so it is not one-one. The finite result relied on counting: nn distinct images inside an nn-element set must fill it. An infinite set can be put in one-one correspondence with a proper subset of itself, as ff does with N\mathbb{N} and N−{1}\mathbb{N} - \{1\}, so the counting argument breaks. The equivalence 'one-one   ⟺  \iff onto' is a genuinely finite phenomenon.