5.1  Restriction, Extension and Gluing

Chapter 1 made a function a graph with a codomain, and Chapter 4 cut sets into classes. This chapter builds new functions out of old ones. Here we take the three simplest constructions: cutting a function down to a smaller domain, enlarging its domain, and assembling one function from pieces defined on parts of the domain. The last of these is behind every definition “by cases”, and the section ends with the functions that take only the values 0 and 1, with which an equation between sets becomes a computation with numbers.

5.1.1. A function in two pieces

The proof of the Schröder–Bernstein theorem (Theorem 3.4.3) defined its bijection h by one formula on a set C and by another off C, and then said: each a falls under exactly one case, and in each case the value exists and is unique, so h is a function. That sentence carried the whole definition. It is worth asking what it really needed.

Here is a familiar definition by cases: |x|={xif x≥0,−xif x≤0. This time a point falls under both cases: 0≥0 and 0≤0. So the sentence from Schröder–Bernstein does not apply. Is |⋅| still a function? Most readers would say yes at once, because both formulas give 0 at 0. Now try r(x)={xif x≥0,x+1if x≤0. At 0 the first line gives 0 and the second gives 1. The “rule” offers two values at one input, and by (Fn2) of Definition 1.5.1 it is not a function.

So whether “one formula on this piece, another on that piece” defines a function depends on two things: whether the pieces leave any point out, and what the formulas do where the pieces meet. Before reading on: write down the condition on two formulas, on two pieces, that makes the definition a function. The gluing theorem below answers this, for any number of pieces.

5.1.2. Restriction and extension

Section 1.5 cut a function down: the restriction of f:X→Y to a subset A⊆X keeps the pairs of f whose input lies in A. The reverse question is just as natural. A function is known on part of a set, say g(x)=1/x on (0,1]; can it be extended to a larger set, and in how many ways?

A restriction forgets part of the domain; an extension fills in the part that was missing.

Definition 5.1.1 (Restriction, Extension, Inclusion)

Let X and Y be sets and A⊆X.

  • (a) For f:X→Y, the restriction of f to A is the function f|A:A→Y, f|A(a):=f(a), as in Section 1.5.
  • (b) For g:A→Y, an extension of g to X is a function f:X→Y with f|A=g.
  • (c) The inclusion map of A into X is ιA:A→X, ιA(a):=a.

In words: the restriction keeps the codomain and forgets the inputs outside A. An extension is any function on the larger set that agrees with g at every point of A; by Proposition 1.5.1, f|A=g says exactly that f(a)=g(a) for every a∈A, since both functions have domain A and codomain Y. The inclusion map is the identity of A with its codomain enlarged to X; it is not idA unless A=X, because the codomains differ.

The article in (b) is “a”, not “the”, and the naive expectation that an extension is determined by g fails at once. The function g:(0,1]→R, g(x)=1/x, has an extension to [0,1] for every choice of a value at 0: sending 0 to 0 and sending 0 to 5 give two different extensions, since they differ at 0. The formula 1/x suggests no value at all there. Nor need an extension keep a property that g has. Let a≠b, and let g:{1,2}→{a,b} send 1↦a and 2↦b, a bijection. An extension to {1,2,3} with codomain {a,b} is a function from a set of three elements to a set of two, and by Corollary 2.5.3 (a) no such function is injective. So the bijection g has extensions, but no injective one.

Restriction, by contrast, is predictable. The next proposition lists what it does.

Proposition 5.1.1 (Restrictions)

Let f:X→Y be a function and B⊆A⊆X.

  • (a) f|A=f∘ιA.
  • (b) (f|A)|B=f|B.
  • (c) For every function g:Y→Z, (g∘f)|A=g∘(f|A).
  • (d) If f is injective, then so is f|A.
  • (e) f|A(B)=f(B).

Idea. Parts (a)–(c) are equations between functions, so we compare domains, codomains and values. Parts (d) and (e) only unwind Definition 1.5.3 and Definition 1.7.1, using f|A(a)=f(a).

Proof. For (a)–(c) we use Proposition 1.5.1: in each part both sides have the same domain and codomain, and we compare values.

  • (a) Both sides are functions A→Y (Definition 1.5.2). For a∈A, (f∘ιA)(a)=f(ιA(a))=f(a)=f|A(a).

  • (b) Both sides are functions B→Y. For b∈B, (f|A)|B(b)=f|A(b)=f(b)=f|B(b), where the middle step uses b∈A.

  • (c) Both sides are functions A→Z. For a∈A, (g∘f)|A(a)=g(f(a))=g(f|A(a))=(g∘(f|A))(a).

  • (d) Let a,a′∈A with f|A(a)=f|A(a′). Then f(a)=f(a′), so a=a′ because f is injective (Definition 1.5.3).

  • (e) By Definition 1.7.1, f|A(B)={f|A(b):b∈B}={f(b):b∈B}=f(B), since f|A(b)=f(b) for every b∈B⊆A.

Part (e) with B=A says that the restriction has the same image as f on A: f|A(A)=f(A). Part (d) has no partner for surjectivity, and the next check asks why.

Quick check. Is a restriction of a surjection always surjective?

Solution. No. The function f:R→[0,∞), f(x)=x2, is surjective (every t≥0 is (t)2). Its restriction f|[1,2]:[1,2]→[0,∞) has image f([1,2])=[1,4], so 0 is not a value. The restriction keeps the codomain while the domain shrinks, so it can lose surjectivity. It can also gain injectivity: f|[0,∞) is injective, although f is not.

5.1.3. Gluing

Restriction takes a function apart: it hands us the pieces f|Ai on the parts Ai of the domain. Gluing is the reverse. We are given functions on the parts and want one function on the whole set. The hook named the two ways this can go wrong: a point may lie in no part, and a point may lie in two parts whose formulas disagree there. Only the second failure appeared there; the first is easy to picture.

Theorem 5.1.2 (Gluing Functions)

Let (Ai)i∈I be a family of subsets of a set X with ⋃i∈IAi=X, and let (fi)i∈I be a family of functions fi:Ai→Y. Suppose the fi agree on overlaps: fi(x)=fj(x)for all i,j∈I and every x∈Ai∩Aj. Then there is exactly one function f:X→Y with f|Ai=fi for every i∈I.

Idea (Scratch work). A function is a graph satisfying (Fn1) and (Fn2), together with a codomain (Definition 1.5.1). We must produce a graph, and the only graphs in sight are the graphs Gi of the fi. The obvious candidate is their union. The plan, as givens and goal:

Givens Goal
graphs Gi⊆Ai×Y, each with (Fn1) and (Fn2) on Ai; ⋃iAi=X; agreement on overlaps a function f:X→Y whose restriction to each Ai is fi, and only one
G:=⋃iGi⊆X×Y (Fn1) and (Fn2) for G on X
x∈X, so x∈Ai for some i (the cover) (Fn1): (x,fi(x))∈Gi⊆G
(x,y)∈Gi, (x,y′)∈Gj; so y=fi(x), y′=fj(x) and x∈Ai∩Aj (Fn2): y=y′; this is the gap, and agreement on overlaps closes it

In the existence part each hypothesis has one job: the cover gives (Fn1), agreement gives (Fn2). Uniqueness is easier: two functions with the right restrictions both take the value fi(x) at a point x∈Ai.

Proof. For each i∈I, let Gi⊆Ai×Y be the graph of fi, and let G:=⋃i∈IGi (Definition 1.3.4). Since Ai⊆X, each Gi⊆X×Y, so G⊆X×Y.

(Fn1). Let x∈X. Since ⋃i∈IAi=X, there is i∈I with x∈Ai. Then (x,fi(x))∈Gi⊆G.

(Fn2). Let (x,y)∈G and (x,y′)∈G. Then (x,y)∈Gi and (x,y′)∈Gj for some i,j∈I. Since Gi⊆Ai×Y and Gj⊆Aj×Y, we have x∈Ai∩Aj, and by (∗∗) of Section 1.5, y=fi(x) and y′=fj(x). Agreement on overlaps gives y=y′.

So f:=(G,Y) is a function X→Y. Let i∈I. Both f|Ai and fi are functions Ai→Y, and for x∈Ai we have (x,fi(x))∈G, so f(x)=fi(x) by (∗∗); that is, f|Ai(x)=fi(x). By Proposition 1.5.1, f|Ai=fi.

Uniqueness. Let g:X→Y also satisfy g|Ai=fi for every i∈I. Let x∈X, and choose i with x∈Ai. Then g(x)=g|Ai(x)=fi(x)=f|Ai(x)=f(x). By Proposition 1.5.1, g=f. This proves the theorem.

In the existence part, the proof used the cover only for (Fn1) and agreement only for (Fn2). Each hypothesis is needed. If a point x lies in no Ai, the union graph has no pair with first coordinate x, and (Fn1) fails; the theorem fails too: for X=Y={0,1}, A1={0} and f1(0)=0, both ways of choosing the value at 1 give a function f with f|A1=f1, so “exactly one” fails. The rule r of the hook shows two pieces that cover R and disagree at 0, where (Fn2) fails.

The theorem is used so often that its use deserves a template. Step (4) below is the one most often forgotten.

Example (Method: define a function by gluing)

Template. (1) Name the pieces and check that they cover the domain. (2) For each two pieces, find the overlap and check that the formulas agree on it; disjoint pieces need nothing. (3) Conclude by Theorem 5.1.2. (4) Prove further properties piece by piece and across pieces: for injectivity, compare a value from one piece with a value from another.

When to use it. Definitions by cases, piecewise formulas, a default value off a subset, constructions such as Schröder–Bernstein’s.

The usual failure. Checking the cover and forgetting the overlaps (a boundary point lies in two pieces); checking injectivity inside each piece only.

Example (Piecewise definitions are gluings)

Decide whether each definition glues to a function R→R.

  • (a) x on [0,∞) and −x on (−∞,0].
  • (b) x on [0,∞) and x+1 on (−∞,0].
  • (c) x on [0,∞) and x+1 on (−∞,0). If it glues, is the result injective?

Solution.

  • (a) Step (1): the pieces cover R, since every real number is ≥0 or ≤0. Step (2): the overlap is {0}, where the formulas give 0 and −0=0. They agree, so by Theorem 5.1.2 there is exactly one function with these restrictions: the absolute value |⋅|.

  • (b) The pieces cover R and overlap in {0}, where the values are 0 and 1. Agreement fails, so the hypothesis of Theorem 5.1.2 fails; and no function can have both restrictions, since its value at 0 would be 0 and 1. This is the rule r of the hook, which is not a function.

  • (c) A minimal change to (b): the second piece loses the point 0. Now the pieces are disjoint and still cover R, so step (2) has nothing to check, and they glue to a function k:R→R. Inside each piece k is injective (x=x′ and x+1=x′+1 each force x=x′). Across the pieces, step (4) finds a collision: k(12)=12 and k(−12)=−12+1=12. So k is not injective.

Back to Schröder–Bernstein. In the proof of Theorem 3.4.3, the pieces were C and A∖C: disjoint, and covering A. So the definition of h is a gluing, with nothing to check in step (2), and “each a falls under exactly one case” is steps (1) and (2) at once: the pieces cover A, and there is no overlap to check. The proof’s Case 3 of injectivity, one point in C and one outside, is step (4)’s comparison across pieces; Cases 1 and 2 are the checks inside each piece.

Default values. Let A⊆X, g:A→Y and y0∈Y. “Take g on A and the value y0 on X∖A” glues g with the constant function X∖A→Y with value y0: the pieces A and X∖A are disjoint and cover X. The “Repair” in the solution of Section 3.1’s Exercise (C2: Find the error) was a default-value definition of this kind, with the default a0 on the inputs that had no value of the right kind. The indicator functions of the next subsection are default-value definitions too.

Warning. A boundary point usually lies in two pieces. “x2 on (−∞,1], 3x on [1,∞)” covers R, and each formula is a function on its piece, but at 1 the values are 1 and 3, so nothing glues. Check every overlap, not just the cover.

Quick check. Glue x2 on (−∞,1] and 2x−1 on [1,∞). Does it glue? Is the result injective?

Solution. The pieces cover R and overlap in {1}, where 12=1=2⋅1−1; so the definitions glue to a function f:R→R. It is not injective, and the failure is inside the first piece: f(−1)=1=f(1).

5.1.4. Indicator functions

A subset A of X can be described by a function that answers, for each x∈X, the question “is x in A?” with 1 for yes and 0 for no. Section 1.5 met this function in Example (First functions) (d). It now gets its own label, because it turns statements about sets into arithmetic.

Definition 5.1.2 (Indicator Function)

Let X be a set and A⊆X. The indicator function of A is 1A:X→{0,1}, 1A(x):={1if x∈A,0if x∈X∖A.

It is a default-value definition: the constant 1 on A glued with the constant 0 on X∖A, over a disjoint cover of X. The function depends on X as well as on A, since X is its domain; throughout this subsection one set X is fixed and every set named is a subset of it. Two small cases: 1X is the constant function 1, and 1∅ is the constant function 0.

Section 3.6 proved that A↦1A is a bijection P(X)→{0,1}X, with inverse f↦{x∈X:f(x)=1}=f−1({1}) (Theorem 3.6.4). Only one consequence is needed here, and it can be read off directly: A is recovered from its indicator as the set of points where the value is 1. So 1A=1BimpliesA=B. This is what lets a computation with indicators prove an equation between sets: show that the two sides have the same indicator, and they are equal.

To compute, we need to know what the set operations do to indicators. Besides the operations of Definition 1.3.1 we use one more. The symmetric difference of A and B is A△B:=(A∖B)∪(B∖A), the set of points that lie in exactly one of A and B.

Proposition 5.1.3 (Set Operations as Arithmetic of Indicators)

Let A,B⊆X. For every x∈X, write u:=1A(x) and v:=1B(x). Then:

  • (a) 1A∩B(x)=uv;
  • (b) 1X∖A(x)=1−u;
  • (c) 1A∪B(x)=u+v−uv;
  • (d) 1A△B(x)=u+v−2uv;
  • (e) A⊆B if and only if 1A(x)≤1B(x) for every x∈X.

Idea. For (a), (b) and (d), membership of x in the left-hand set is decided by which of x∈A, x∈B hold: four cases, one table. Part (c) need not be tabled at all: De Morgan turns a union into a complement of an intersection, and (a), (b) compute that.

Proof. Fix x∈X. By Definition 5.1.2, u=1 if x∈A and u=0 otherwise, and likewise for v and B.

(a), (b), (d). There are four cases, and in each we read membership from Definition 1.3.1 and the definition of △:

x∈A? x∈B? u v x∈A∩B? uv x∈X∖A? 1−u x∈A△B? u+v−2uv
yes yes 1 1 yes 1 no 0 no 0
yes no 1 0 no 0 no 0 yes 1
no yes 0 1 no 0 yes 1 yes 1
no no 0 0 no 0 yes 1 no 0

In every row, the number in each formula column is 1 exactly when the membership column before it says yes, and 0 otherwise. That is (a), (b) and (d).

  • (c) By Theorem 1.3.1 (d) with X in the place of A, X∖(A∪B)=(X∖A)∩(X∖B). Applying (a) to the sets X∖A and X∖B, whose indicators at x are 1−u and 1−v by (b), gives 1X∖(A∪B)(x)=(1−u)(1−v). Applying (b) to the set A∪B⊆X, 1A∪B(x)=1−1X∖(A∪B)(x)=1−(1−u)(1−v)=u+v−uv.

  • (d) (⇒) Suppose A⊆B and let x∈X. If 1A(x)=1, then x∈A, so x∈B and 1B(x)=1. If 1A(x)=0, then 1A(x)≤1B(x) since 1B(x)∈{0,1}. (⇐) Suppose the inequality holds at every point, and let x∈A. Then 1=1A(x)≤1B(x)≤1, so 1B(x)=1 and x∈B. By Definition 1.2.2, A⊆B.

Part (e) says the only pattern of values that A⊆B forbids is u=1, v=0: a point of A outside B.

Quick check. Express 1A∖B(x) in terms of u=1A(x) and v=1B(x).

Solution. By Definition 1.3.1, A∖B=A∩(X∖B), since both consist of the points of A not in B. By (a) and (b), 1A∖B(x)=u(1−v)=u−uv. Check on the row u=1, v=0: the value is 1, and indeed such an x lies in A∖B.

Compute with indicators. To prove an equation L=R between sets built from subsets A,B,C of X, fix x∈X, write u,v,w for the values of 1A,1B,1C at x, and translate each side into a polynomial in u,v,w by Proposition 5.1.3. Simplify both, using u2=u, v2=v, w2=w, which hold because 02=0 and 12=1. If the two polynomials agree for all values in {0,1}, then 1L=1R, and L=R because a set is recovered from its indicator. The method replaces a case analysis on memberships by algebra, and it pays most when the case analysis is long.

Example (Symmetric difference is associative)

Show that (A△B)△C=A△(B△C) for all A,B,C⊆X.

Solution. Fix x∈X and let u,v,w be the values of 1A,1B,1C at x. By Proposition 5.1.3 (d), 1A△B(x)=u+v−2uv. Applying (d) again, to the sets A△B and C, 1(A△B)△C(x)=(u+v−2uv)+w−2(u+v−2uv)w=u+v+w−2uv−2uw−2vw+4uvw. The final expression does not change when u,v,w are permuted. The right-hand side gives u+(v+w−2vw)−2u(v+w−2vw), which expands to the same expression. So the two sets have the same indicator, and they are equal.

The common value is 1 exactly when an odd number of u,v,w equal 1: with one of them equal to 1 it is 1, with two it is 2−2=0, with three 3−6+4=1. So both sides are the set of points lying in an odd number of A,B,C. An element chase would split into eight cases, one for each pattern of memberships; the indicator computation did all eight at once.

Cantor, re-read. The set D={x∈X:x∉f(x)} in the proof of Theorem 3.3.2 has indicator 1D(x)=1−1f(x)(x): it is the flipped diagonal of the proof of Theorem 3.3.1 in Section 3.3, and Section 3.3, after Theorem 3.3.2, already joined the two arguments for X=N. Exercise C3 runs the argument for an arbitrary set, with 0–1 functions first and subsets second.

Quick check. Let X={1,2,3,4}, A={1,2} and B={2,3}. List the values 1A△B(1),…,1A△B(4), first from the formula u+v−2uv and then from the definition of △.

Solution. The values of 1A are (1,1,0,0) and those of 1B are (0,1,1,0). The formula gives 1+0−0=1, 1+1−2=0, 0+1−0=1, 0: the list (1,0,1,0). From the definition, A△B={1}∪{3}={1,3}, whose indicator is the same list.

5.1.5. Exercises

A. Check your understanding

Exercise (A1)
  • (a) Let f:R→R, f(x)=x2. What is the image of f|[−1,2]?
  • (b) Let a,b,c be distinct and let g:{1,2}→{a,b} send 1↦a, 2↦b. Does g have an injective extension to {1,2,3} with codomain {a,b}? With codomain {a,b,c}?
  • (c) Let A⊆X and g:A→Y. Show that g has an extension to X if and only if A=X or Y≠∅.
  • (d) For X={1,2,3,4}, write 1{1,3} as the list of its values at 1,2,3,4, and name the subset of X whose indicator has the values (0,1,1,0).

Solution.

  • (a) By Proposition 5.1.1 (e), the image is f([−1,2]). For x∈[−1,2], 0≤x2≤4; conversely each t∈[0,4] is (t)2 with t∈[0,2]. So the image is [0,4].

  • (b) No: a function from a set of three elements to a set of two elements is not injective, by Corollary 2.5.3 (a). Yes: send 3↦c; the three values a,b,c are distinct, so the extension is injective.

  • (c) (⇐) If A=X, then g is an extension of itself, since g|X=g. If Y≠∅, choose y0∈Y and glue g with the constant function X∖A→Y with value y0: the pieces A and X∖A are disjoint and cover X, so Theorem 5.1.2 gives f:X→Y with f|A=g. (⇒) Suppose A≠X and Y=∅. Since A⊆X and A≠X, some x0∈X is not in A; so X is non-empty, and by Proposition 1.5.2 (b) there is no function X→∅, let alone an extension of g. By contraposition, an extension forces A=X or Y≠∅.

  • (d) (1,0,1,0); the subset {2,3}, the set of points where the value is 1.

B. Practice

Exercise (B1: Three pieces)

Let f1(x)=−x on (−∞,−1], f2(x)=x2 on [−1,1] and f3(x)=x on [1,∞), each with codomain R. Show that they glue to a function f:R→R. Find f(R) and f−1({14}), and decide whether f is injective.

Solution. The three intervals cover R. The overlaps are (−∞,−1]∩[−1,1]={−1}, where f1(−1)=1=f2(−1); [−1,1]∩[1,∞)={1}, where f2(1)=1=f3(1); and (−∞,−1]∩[1,∞)=∅. So the pieces agree on overlaps and glue, by Theorem 5.1.2.

Since R is the union of the three pieces, Theorem 1.7.3 gives f(R) as the union of the images of the pieces, and by Proposition 5.1.1 (e) the image of a piece is the image of the corresponding fi. These are f1((−∞,−1])=[1,∞), f2([−1,1])=[0,1] and f3([1,∞))=[1,∞). Hence f(R)=[0,∞).

On the first and third pieces every value is ≥1, so a solution of f(x)=14 lies in [−1,1], where it solves x2=14. Hence f−1({14})={−12,12}. Two different points have the same value, so f is not injective.

Exercise (B2: Injective across pieces)

Let f:X→Y and X=A∪B. Prove that f is injective if and only if f|A and f|B are injective and f(A)∩f(B)=f(A∩B).

Solution. (⇒) The restrictions are injective by Proposition 5.1.1 (d), and f(A)∩f(B)=f(A∩B) by Theorem 1.7.4 (b), since f is injective.

(⇐) Let x,x′∈X with f(x)=f(x′). If both lie in A, then f|A(x)=f|A(x′) and x=x′ since f|A is injective; likewise if both lie in B. Otherwise, since X=A∪B, one lies in A and the other in B; by symmetry say x∈A and x′∈B. Then y:=f(x)=f(x′) lies in f(A)∩f(B)=f(A∩B), so y=f(z) for some z∈A∩B (Definition 1.7.1). Now x,z∈A with f|A(x)=y=f|A(z), so x=z; and x′,z∈B with f|B(x′)=f|B(z), so x′=z. Hence x=x′, and f is injective.

Exercise (B3: By indicators)

Let A,B,C⊆X. Prove by computing with indicators:

  • (a) A∖(B∪C)=(A∖B)∩(A∖C);
  • (b) A∩(B△C)=(A∩B)△(A∩C).

Solution. Fix x∈X and write u,v,w for the values of 1A,1B,1C at x. For any S⊆X, A∖S=A∩(X∖S), so Proposition 5.1.3 (a), (b) give 1A∖S(x)=u(1−1S(x)).

  • (a) By Proposition 5.1.3 (c), 1B∪C(x)=v+w−vw, so the left side has indicator value u(1−v−w+vw)=u(1−v)(1−w). The right side has, by Proposition 5.1.3 (a), u(1−v)⋅u(1−w)=u2(1−v)(1−w)=u(1−v)(1−w), using u2=u. The indicators agree at every x, so the sets are equal.

  • (b) By Proposition 5.1.3 (a) and (d), the left side has u(v+w−2vw)=uv+uw−2uvw. The sets A∩B and A∩C have indicator values uv and uw, so by Proposition 5.1.3 (d) the right side has uv+uw−2(uv)(uw)=uv+uw−2u2vw=uv+uw−2uvw. The indicators agree, so the sets are equal.

Exercise (B4: Prove or disprove)

Prove each true statement and refute each false one with a counterexample.

  • (a) If X=A∪B with A∩B=∅, and f:A→Y, g:B→Y are functions, then there is exactly one h:X→Y with h|A=f and h|B=g.
  • (b) If f:X→Y, X=A∪B, and f|A and f|B are injective, then f is injective.
  • (c) If f:X→Y and f|A:A→Y is surjective for some A⊆X, then f is surjective.
  • (d) The definition h(x)=x for x∈Q, h(x)=2x for x∈R∖Q gives a bijection h:R→R.
  • (e) Gluing x on [0,1] and 2−x on [1,2] gives an injective function [0,2]→R.

Solution.

  • (a) True. The family A,B covers X, and the only overlap A∩B is empty, so agreement holds vacuously. By Theorem 5.1.2 there is exactly one such h.

  • (b) False. Let f:R→R, f(x)=x2, A=[0,∞) and B=(−∞,0]. Then X=A∪B, and both restrictions are injective (on each piece, x2=x′2 with x,x′ of the same sign gives x=x′), but f(1)=1=f(−1). The collision is across the pieces.

  • (c) True. Let y∈Y. Since f|A is surjective, y=f|A(a)=f(a) for some a∈A⊆X. So y is a value of f.

  • (d) True. The pieces Q and R∖Q are disjoint and cover R, so h is a function by Theorem 5.1.2. Injective. Inside the pieces: x=x′ and 2x=2x′ each give x=x′. Across the pieces: if x∈Q, x′∉Q and h(x)=h(x′), then x=2x′, so x′=x/2∈Q, a contradiction. Surjective. A rational y is h(y). An irrational y is h(y/2): here y/2∉Q, since otherwise y=2⋅(y/2)∈Q.

  • (e) False. The pieces agree at the overlap {1} (both give 1), so they glue to a function f; but f(12)=12=2−32=f(32).

C. Going deeper

Exercise (C1: Counting extensions)

Let A⊆X and g:A→Y, and let E be the set of all extensions of g to X. Show that f↦f|X∖A is a bijection from E to YX∖A.

Solution. Write ρ(f):=f|X∖A, a function E→YX∖A. For k∈YX∖A, the pieces A and X∖A are disjoint and cover X, so by Theorem 5.1.2 there is exactly one γ(k):X→Y with γ(k)|A=g and γ(k)|X∖A=k. In particular γ(k)∈E, so γ:YX∖A→E.

Round trip on YX∖A. ρ(γ(k))=γ(k)|X∖A=k, by the choice of γ(k).

Round trip on E. Let f∈E. Both f and γ(ρ(f)) restrict to g on A and to f|X∖A on X∖A. By the uniqueness in Theorem 5.1.2, γ(ρ(f))=f.

So γ is a two-sided inverse of ρ, and ρ is a bijection by Theorem 1.6.4. In words: an extension of g is the same thing as an arbitrary choice of values off A. For finite sets this counts the extensions: if X∖A has m elements and Y has n, there are as many extensions as functions from an m-element set to an n-element set.

Marking scheme. (10 points) - 3: defines γ by gluing, checking the pieces cover and are disjoint. - 2: ρ(γ(k))=k. - 3: γ(ρ(f))=f by uniqueness in Theorem 5.1.2. - 2: concludes that ρ is a bijection.

Exercise (C2: Find the error)

Here is a proposed proof of the existence part of Theorem 5.1.2. “Given x∈X, pick i with x∈Ai, and set f(x):=fi(x). Then f|Ai=fi for every i∈I.” Which hypothesis of the theorem is never used? Where does the argument fail, and which check is missing? Is the conclusion true?

Solution. The conclusion is true: it is Theorem 5.1.2. The argument does not prove it.

Agreement on overlaps is never used. The failure is in the definition of f: the rule reads a chosen index i from the set {i∈I:x∈Ai}, and it defines a function only if the value fi(x) does not depend on which such i is picked. That is the well-definedness check of Example (Method: checking that a definition on classes is well defined), with “an index i with x∈Ai” in the role of a representative; it is exactly agreement on overlaps. Without it, the second sentence fails too: at a point x∈Ai∩Aj where i was picked, f|Aj(x)=fi(x), which need not equal fj(x). Example (Piecewise definitions are gluings) (b) at x=0 is a case: picking the first piece gives f(0)=0, and then f|(−∞,0] is not x↦x+1, which has the value 1 at 0.

Marking scheme. (10 points) - 3: names agreement on overlaps as the unused hypothesis. - 4: locates the failure either in the definition of f (the value depends on the choice of i, so a well-definedness check is missing) or in the claim f|Aj=fj at a point of Ai∩Aj where another index was picked, and says that agreement on overlaps is what is missing. - 3: gives a concrete case where the choice matters and f|Aj=fj fails. Fatal errors (0 for the step): claiming the conclusion is false; locating the error in the cover (every x does lie in some Ai).

Exercise (C3: Cantor through indicators)

Let X be a set and g:X→{0,1}X a function. Define d:X→{0,1} by d(x):=1−g(x)(x).

  • (a) Prove that d is not a value of g.
  • (b) Deduce Theorem 3.3.2. Hint: for f:X→P(X), use g(x):=1f(x).

Solution.

  • (a) Since g(x)(x)∈{0,1}, also d(x)∈{0,1}, so d∈{0,1}X. Suppose d=g(a) for some a∈X. Then d(a)=g(a)(a), and by the definition of d, d(a)=1−g(a)(a). Hence 2g(a)(a)=1, which is impossible for g(a)(a)∈{0,1}. So d is not a value of g.

  • (b) Let f:X→P(X) be a function, and put g(x):=1f(x)∈{0,1}X. Let D:={x∈X:d(x)=1}. Since d takes only the values 0 and 1, 1D=d. If D=f(a) for some a∈X, then g(a)=1f(a)=1D=d, against (a). So D is not a value of f, and f is not surjective. Unwinding, d(x)=1 exactly when 1f(x)(x)=0, so D={x∈X:x∉f(x)}, the set of the proof in Section 3.3.

Marking scheme. (10 points) - 1: checks that d∈{0,1}X. - 4: assumes d=g(a) and reaches the contradiction 2g(a)(a)=1. - 4: shows 1D=d and transfers the argument to f via g(x)=1f(x). - 1: concludes that f is not surjective.

Section 3.6’s Corollary 3.6.5 went the other way, from Cantor’s theorem to 0–1 functions; here the argument about 0–1 functions comes first, and the statement about subsets follows from it.