2.3  Gluing and Characteristic Functions

Section 2.1 made a function a graph with a codomain, and Section 2.2 asked what a function does to its inputs and to its codomain. This section builds new functions out of old ones by 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 is behind every definition “by cases”. 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, and with the theorem that the subsets of X and the 0–1 functions on X correspond one to one.

2.3.1. A function in two pieces

School mathematics defines many functions in pieces. The sign function is sgnx={1if x>0,0if x=0,−1if x<0. Each real number falls under exactly one case, and in each case the value exists and is unique, so sgn is a function R→R. That sentence carries 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 about sgn 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 2.1.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.

2.3.2. Restriction and extension

Section 2.1 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 2.3.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 2.1.
  • (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 2.1.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 map of Example (The maps that come with sets) (a), now given the name ιA: 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 f to {1,2,3} with codomain {a,b} has f(3)=a=f(1) or f(3)=b=f(2), so it is not injective. So the bijection g has extensions, but no injective one.

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

Proposition 2.3.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.

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

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

  • (a) Both sides are functions A→Y (Definition 2.1.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 2.2.1).

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,∞) takes only values x2≥1, 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, by Example (Squaring, three ways) (b), although f is not, since f(−1)=1=f(1).

2.3.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 2.3.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 2.1.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 2.1, 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 2.1.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 2.1.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) is the step that part (c) of Example (Piecewise definitions are gluings) below turns on.

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 2.3.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, a function given by different formulas on a subset and its complement.

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 2.3.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 2.3.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.

Part (c) found its collision across the pieces. Step (4) of the method box, for injectivity, is a proposition:

Proposition 2.3.3 (Injectivity Across Pieces)

Let f:X→Y and X=A∪B. Then f is injective if and only if f|A and f|B are injective and f(a)≠f(b) for all a∈A∖B and b∈B∖A.

Idea. Two different points either share a piece, where the restriction decides, or lie one in each piece outside the overlap, where the last condition decides. This is step (4) of Example (Method: define a function by gluing), and we prove injectivity in the contrapositive form given after Definition 2.2.1 (justified by Logic and Proof, Proposition 2.5.2).

Proof. (⇒) The restrictions are injective by Proposition 2.3.1 (d). For a∈A∖B and b∈B∖A we have a≠b, since b∈B and a∉B; so f(a)≠f(b) because f is injective.

(⇐) Let x,x′∈X with x≠x′. If both lie in A, then f(x)=f|A(x)≠f|A(x′)=f(x′), since f|A is injective; likewise if both lie in B. Otherwise they do not both lie in A, so one of them is outside A; renaming the two points if necessary, x∉A. Since X=A∪B, x∈B∖A. Then x′∉B, for otherwise both points lie in B, a case already done; so x′∈A∖B, and f(x′)≠f(x) by hypothesis. In every case f(x)≠f(x′), so f is injective.

The condition across the pieces mentions only points outside the overlap. A point of A∩B lies in both pieces, so a collision involving it is already caught by one of the two restrictions.

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 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).

2.3.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 2.1 met this function in Example (First functions) (d). It now gets its own label, because it turns statements about sets into arithmetic.

Definition 2.3.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.

The last subsection of this section proves that A↦1A is a bijection P(X)→{0,1}X, and f↦{x∈X:f(x)=1} undoes it on both sides (Theorem 2.3.5). 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 2.3.4 (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 2.3.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 2.3.4. 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 2.3.4 (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.

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.

2.3.5. Subsets are 0–1 functions

Section 2.1 stated, for every set, that subsets and 0–1 functions match, and gave both maps: send f to {x:f(x)=1} and A to 1A. Here are the two round trips, which make 2 a base like any other.

Theorem 2.3.5 (Subsets and 0–1 Functions)

For every set X, the map A↦1A is a bijection P(X)→{0,1}X, and f↦{x∈X:f(x)=1} undoes it on both sides: each round trip is the identity.

Proof. For A⊆X, 1A∈{0,1}X (Example (First functions) (d)), and {x∈X:1A(x)=1}=A by the definition of 1A. For f∈{0,1}X, let S:={x∈X:f(x)=1}. For x∈S, 1S(x)=1=f(x). For x∈X∖S, f(x)≠1, so f(x)=0=1S(x). So 1S=f (Proposition 2.1.1). The first round trip makes A↦1A injective, since 1A=1B gives A={x∈X:1A(x)=1}=B; the second makes it surjective. So it is a bijection (Definition 2.2.3).

Remark (Looking ahead). Chapter 4 counts the subsets of a finite set and, through this bijection, the 0–1 functions on it; with Cantor’s theorem it also shows that {0,1}X is larger than X.

2.3.6. Exercises

A. Check your understanding

Exercise (A1)
  • (a) Let f:R→R, f(x)=x2. Is f|(−∞,0] injective? Is f|[−1,2]?
  • (b) Let a,b,c be distinct and let g:{1,2}→{a,b,c} send 1↦a, 2↦b. How many extensions of g to {1,2,3} with codomain {a,b,c} are there, and how many of them are injective?
  • (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) Yes. Let x1,x2≤0 with x12=x22. Then −x1,−x2≥0 and (−x1)2=x12=x22=(−x2)2, so −x1=−x2 as in Example (Squaring, three ways) (b), and x1=x2. No: −1 and 1 lie in [−1,2], and f(−1)=1=f(1).

  • (b) Three. An extension agrees with g on {1,2}, so by Proposition 2.1.1 it is determined by its value at 3; and each of a,b,c gives one, by gluing g with a constant function on {3} (Theorem 2.3.2; the pieces are disjoint). Only 3↦c gives an injective extension, since its three values a,b,c are distinct; 3↦a collides with 1, and 3↦b with 2.

  • (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 2.3.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 2.1.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 the range of f and every x with f(x)=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 2.3.2.

Every x∈R lies in a piece, where f(x)=fi(x); so the range of f is the union of the ranges of the fi. On (−∞,−1], −x takes every value t≥1 (at x=−t) and no other; on [−1,1], x2 takes every value t∈[0,1] (at x=t) and no other; on [1,∞), x takes every value t≥1 (at x=t) and no other. Hence the range is [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 the solutions are −12 and 12. Two different points have the same value, so f is not injective.

Exercise (B2: A bijection in two pieces)

Let g1(x)=x on (−∞,0] and g2(x)=x2 on [0,∞), each with codomain R.

  • (a) Show that g1 and g2 glue to a function f:R→R.
  • (b) Prove that f is injective, using Proposition 2.3.3.
  • (c) Prove that f is surjective.

Solution.

  • (a) The pieces cover R, since every real number is ≤0 or ≥0. They overlap in {0}, where g1(0)=0=02=g2(0). By Theorem 2.3.2 they glue to a function f:R→R.

  • (b) Let A=(−∞,0] and B=[0,∞). Then f|A=g1 is injective, since g1(x1)=g1(x2) says x1=x2. And f|B=g2 is injective: x12=x22 with x1,x2≥0 gives x1=x2, as in Example (Squaring, three ways) (b). Across the pieces, let a∈A∖B and b∈B∖A, that is a<0<b. Then f(a)=a<0<b2=f(b), so f(a)≠f(b). By Proposition 2.3.3, f is injective.

  • (c) Let y∈R. We argue by cases (Example (Method: proof by cases)). If y<0, then y∈A and f(y)=y. If y≥0, then y∈B and f(y)=(y)2=y. So every real number is a value of f, and f is a bijection.

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 2.3.4 (a), (b) give 1A∖S(x)=u(1−1S(x)).

  • (a) By Proposition 2.3.4 (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 2.3.4 (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 2.3.4 (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 2.3.4 (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 2.3.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 2.3.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: The complement map, transported)

Let Φ:P(X)→{0,1}X, Φ(A)=1A, a bijection by Theorem 2.3.5, and let c:P(X)→P(X), c(A)=X∖A.

  • (a) Prove X∖(A∩B)=(X∖A)∪(X∖B) for A,B⊆X by computing with indicators.
  • (b) Show that Φ(c(A))=1−Φ(A) for every A⊆X, where 1−f∈{0,1}X denotes the function x↦1−f(x) (its values are 1−0=1 and 1−1=0).
  • (c) Use (b) to show that c∘c=idP(X) without chasing elements.

Solution.

  • (a) Fix x∈X and write u,v for the values of 1A,1B at x. By Proposition 2.3.4 (a) and (b), the left side has indicator value 1−uv. By Proposition 2.3.4 (b), the sets X∖A and X∖B have indicator values 1−u and 1−v, so by Proposition 2.3.4 (c) the right side has (1−u)+(1−v)−(1−u)(1−v)=2−u−v−(1−u−v+uv)=1−uv. The two sides have the same indicator, and Φ is injective, so they are equal.

  • (b) Both sides are functions X→{0,1}. At x∈X, Φ(c(A))(x)=1X∖A(x)=1−1A(x) by Proposition 2.3.4 (b), which is the value of 1−Φ(A) at x. By Proposition 2.1.1, Φ(c(A))=1−Φ(A).

  • (c) Let A⊆X. Applying (b) to c(A) and then to A, Φ(c(c(A)))=1−Φ(c(A))=1−(1−Φ(A))=Φ(A), where the last step holds at every point because 1−(1−t)=t for every number t. Since Φ is injective, c(c(A))=A. Both c∘c and idP(X) are functions P(X)→P(X) that agree at every A, so c∘c=idP(X) (Proposition 2.1.1). This is the identity of Example (The maps that come with sets) (d), recovered by a computation with numbers.

Exercise (C2: Infinitely many pieces)

For each n∈Z, let fn:[n,n+1)→R, fn(x)=x−n.

  • (a) Show that the intervals [n,n+1) cover R and are pairwise disjoint, so that the fn glue to a function f:R→R.
  • (b) Find the range of f, show that f(x+1)=f(x) for every x∈R, and decide whether f is injective.
  • (c) Do the functions x↦x−n on the closed intervals [n,n+1], n∈Z, glue to a function R→R?

Solution.

  • (a) Cover. Every x∈R lies in [⌊x⌋,⌊x⌋+1), where ⌊x⌋ is the integer of Example (Maps from calculus) (b). Disjoint. Suppose x∈[n,n+1)∩[m,m+1) with integers n≠m; since the situation is symmetric in n and m, we may assume n<m. Then n+1≤m, because n and m are integers, and so m≤x<n+1≤m, which is impossible. So no two pieces overlap, step (2) of Example (Method: define a function by gluing) has nothing to check, and Theorem 2.3.2 gives f.

  • (b) The range is [0,1). If x∈[n,n+1), then 0≤x−n<1, so every value lies in [0,1); and each t∈[0,1) lies in the piece with n=0, so f(t)=t−0=t. For the shift, let x∈[n,n+1). Then x+1∈[n+1,n+2), the piece of n+1, so f(x+1)=(x+1)−(n+1)=x−n=f(x). Hence f is not injective: f(0)=0=f(1).

  • (c) No. The point 1 lies in [0,1]∩[1,2], where the first formula gives 1−0=1 and the second gives 1−1=0. The functions disagree on an overlap, and no function can restrict to both, since its value at 1 would be 1 and 0.