1.6  Images and Preimages

A function f:X→Y sends points to points. Much of analysis asks what it does to sets of points. Where does f send an interval? Which inputs land in a given set of outputs? The first question is answered by the image f(A), the second by the preimage f−1(B), and the two are the subject of this section. They look like mirror images of each other, and they are not: preimages respect every set operation of Section 1.2, while images respect only unions. The reason is one quantifier, and by the end of the section we will be able to point at it.

Throughout, f:X→Y is a function (Definition 1.4.1), and the unions and intersections of families are those of Definition 1.2.4. An intersection of a family of subsets of Y is taken inside Y; of subsets of X, inside X.

1.6.1. A question about squares

Let f:R→R, f(x)=x2, and take the two intervals A=[−1,0] and B=[0,1]. Squaring A gives every number from 0 to 1, and so does squaring B. So the set of squares of points of A and the set of squares of points of B are both [0,1], and the points they share make up [0,1].

Now intersect first. The intervals A and B share only the point 0, so A∩B={0}, and its only square is 0. Squaring the intersection gives {0}; intersecting the squares gives [0,1]. The order of the two operations matters.

Try the same thing backwards. Instead of pushing sets forwards through f, pull them back: for a set C of outputs, collect the inputs whose squares lie in C. Take C=[0,1] and D=[1,4]. The inputs with square in C form [−1,1], those with square in D form [−2,−1]∪[1,2], and the inputs common to both are −1 and 1. Intersecting first gives C∩D={1}, whose inputs are again −1 and 1. This time the order does not matter.

Is that an accident of these intervals? No. Pulling back will turn out to respect intersections for every function and all sets, while pushing forwards respects them exactly for the injective functions. To see why, we first need names for the two operations.

1.6.2. Images and preimages

The two sets in the question above keep recurring: “all the values f(a) for a in A” and “all the inputs x with f(x) in B”. The first was already used in Section 1.4 for A=X, where it is the range of f.

An image hides a “there exists”; a preimage hides nothing.

Definition 1.6.1 (Image)

Let f:X→Y be a function and A⊆X. The image of A under f is the set f(A):={y∈Y:there exists a∈A with f(a)=y}. We also write it {f(a):a∈A}. In symbols, for every y, y∈f(A)⟺y∈Y∧∃a∈A f(a)=y.

Definition 1.6.2 (Preimage)

Let f:X→Y be a function and B⊆Y. The preimage of B under f, also called its inverse image, is the set f−1(B):={x∈X:f(x)∈B}. In symbols, for every x, x∈f−1(B)⟺x∈X∧f(x)∈B. The preimage is defined for every function f, whether or not f has an inverse.

In Section 1.4 a point x with f(x)=y was called a preimage of y; that is, x∈f−1({y}). So the preimages of a point y are the elements of the preimage of the set {y}.

Read the two definitions clause by clause.

  • The ambient sets. Both are sets by specification (Definition 1.1.3): f(A) is carved out of the codomain Y, and f−1(B) out of the domain X. So f(A)⊆Y and f−1(B)⊆X always. The shorthand {f(a):a∈A} names the same subset of Y; it is a way of writing, not a new rule of set formation.
  • The image. “y∈f(A)” says that y is hit by some point of A. The words “there exists” are part of the definition. To use a line y∈f(A), we must name a witness: “let a∈A with f(a)=y”. That is the rule ∃E of Logic and Proof, Section 5.6, and the name must be fresh. To prove y∈f(A), we exhibit a witness, by ∃I (Logic and Proof, Section 5.5).
  • The preimage. “x∈f−1(B)” says that x is sent into B. There is no quantifier. For x∈X, a line x∈f−1(B) is used and proved by one substitution: it is exchanged for f(x)∈B, and back.
  • The symbol f−1. In f−1(B), the symbol f−1 is not a function that is applied to B. The whole expression f−1(B) is the name of a set built from f and B. Section 1.5 used f−1 for the inverse function of a bijection; the remark at the end of this section reconciles the two readings.

The notation f(A) puts a set where f(x) puts a point. When the letter in the brackets has been declared a subset of X, the expression is an image; when it has been declared a point, it is a value. As with the pair and the interval of Section 1.3, the declaration decides.

Start with the smallest possible example, where everything can be listed.

Example (Images and preimages by listing)

Let X={1,2,3,4}, Y={0,1,2,5}, and let f:X→Y be given by f(1)=1,f(2)=2,f(3)=0,f(4)=1. Find f({1,4}), f({2,3}), f(X), and f(∅); then f−1({1}), f−1({0,2}), f−1({5}), f−1(∅), and f−1(Y).

Solution. Images. A point y lies in f(A) when some a∈A has f(a)=y, so we apply f to each point of A and collect the results. f({1,4})={1}: both points go to 1, and a set lists 1 once. f({2,3})={0,2}. f(X)={0,1,2}, the range; 5 is not in it. f(∅)=∅: a point y in it would need some a∈∅, and there is none.

Preimages. A point x∈X lies in f−1(B) when f(x)∈B, so we test each of the four points of X. f−1({1})={1,4}. f−1({0,2})={2,3}. f−1({5})=∅: no point of X is sent to 5. f−1(∅)=∅, since f(x)∈∅ never holds. f−1(Y)=X, since f(x)∈Y holds for every x∈X.

The two computations differ in shape. For the image we ran through the points of A and produced outputs. For the preimage we ran through the points of X and tested each one. That is the “there exists” of the image and the plain condition of the preimage, seen on a four-point set.

The example also contains a non-example by minimal change. The sets {1} and {5} are both one-point subsets of Y. The first has a two-point preimage; change 1 to 5 and the preimage becomes empty, because 5 lies outside the range. The preimage of a non-empty set can be empty. What fails is the existence of a point of X sent into the set.

Why is the preimage defined for every function, when f−1 as a function exists only for bijections? Because the question “which inputs land in B?” makes sense for any f: its answer may be empty, or contain many points, and neither is a problem for a set. The function f−1 of Section 1.5 asks for more: exactly one input for each output. This is why analysis states its definitions with preimages. “The preimage of every open set is open” makes sense for every function; Metric and Topological Spaces, Chapter 1 uses it to characterize continuity.

Warning. The preimage f−1(B) does not presuppose that f is invertible. For the squaring map on R, which has no inverse function, f−1({4})={−2,2} is a perfectly good set. What the symbol does not give is a value “f−1(4)”: that would be a point, and there are two candidates.

1.6.3. Computing images and preimages

With an infinite set, listing is impossible, and the definitions are used as they stand. The image asks us to name witnesses; the preimage asks us to solve an inequality.

Example (Images and preimages of intervals under squaring)

Let f:R→R, f(x)=x2. Prove that

  • (a) f([−1,2])=[0,4];
  • (b) f−1([1,4])=[−2,−1]∪[1,2];
  • (c) f−1({−1})=∅;
  • (d) f−1(f([0,1]))=[−1,1].

Solution. We use school facts about real numbers, x2≥0 and every y≥0 has a square root y≥0, and, by Logic and Proof, Theorem 2.4.5, for s,t≥0, s≤t holds exactly when s2≤t2.

  • (a) Idea. An image is proved equal to a set by two inclusions. The inclusion ⊆ uses y∈f([−1,2]), so it names a witness. The inclusion ⊇ proves y∈f([−1,2]), so it exhibits one.

    (⊆) Let y∈f([−1,2]). Then y=a2 for some a∈[−1,2]; name it a. Certainly y=a2≥0. If a≥0, then 0≤a≤2, so a2≤4. If a<0, then 0<−a≤1, so a2=(−a)2≤1≤4. In either case 0≤y≤4, that is, y∈[0,4].

    (⊇) Let y∈[0,4]. Take a:=y. Then 0≤a≤4=2, so a∈[−1,2], and f(a)=y. Hence y∈f([−1,2]).

    The witness in (⊇) could have been −y for y≤1, but not for y>1, where −y<−1. One witness per y is all we need, so we choose the one that always works.

  • (b) Idea. A preimage is a set of solutions of a condition on x. No witness is needed: each line is an equivalence.

    For every x∈R, x∈f−1([1,4])⟺1≤x2≤4⟺1≤|x|≤2⟺x∈[−2,−1]∪[1,2]. The first step is Definition 1.6.2. The second uses x2=|x|2 and Logic and Proof, Theorem 2.4.5 with s,t among 1, |x|, 2. The third splits by the sign of x: for x≥0, |x|=x, and for x<0, |x|=−x. So the two sets have the same elements.

  • (c) For every x∈R, f(x)=x2≥0>−1, so f(x)∈{−1} never holds. The preimage is empty, although {−1} is not.

  • (d) First f([0,1])=[0,1], by the argument of (a): a square of a number in [0,1] lies in [0,1], and each y∈[0,1] is (y)2 with y∈[0,1]. Then, as in (b), for every x∈R, x∈f−1([0,1])⟺0≤x2≤1⟺|x|≤1⟺x∈[−1,1].

Part (d) is worth a second look. We started with [0,1], pushed it forwards and pulled it back, and got the bigger set [−1,1]. The negative numbers came in because they have the same squares as the positive ones. That is a failure of injectivity, and the subsection “There and back” later in this section proves that it is the only way the round trip can grow a set.

Quick check. For f(x)=x2 on R, find f−1({4}), f−1([−4,−1]), and f(f−1([−1,1])).

Solution. f−1({4})={−2,2}, the solutions of x2=4. f−1([−4,−1])=∅, since x2≥0>−1. For the last, f−1([−1,1])={x∈R:−1≤x2≤1}=[−1,1], and then f([−1,1])=[0,1], by the argument of Example (Images and preimages of intervals under squaring) (a). So f(f−1([−1,1]))=[0,1], which is smaller than [−1,1]: the negative numbers are not squares.

1.6.4. Sets of numbers as images

Analysis on the Real Line, Chapter 1 works with three ways of making new sets of real numbers from old ones: for A,B⊆R and c∈R, −A:={−a:a∈A},cA:={ca:a∈A},A+B:={a+b:a∈A, b∈B}. The first two are images in the sense of Definition 1.6.1. In the third, two letters vary, and the notation means, as for Definition 1.3.2, A+B={y∈R:∃a∈A ∃b∈B y=a+b}. Each is an image, and seeing them as images tells us how to prove things about them: an element of A+B is used by naming two witnesses.

Example (Reflections, scalings and sums as images)

Let A,B⊆R and c∈R.

  • (a) Let n:R→R, n(x)=−x, and mc:R→R, mc(x)=cx. Show that −A=n(A) and cA=mc(A).
  • (b) Let s:R×R→R, s(a,b)=a+b. Show that A+B=s(A×B).
  • (c) Compute −[0,1], {1,2}+{10,20}, and {1,2}+{1,2}.

Solution.

  • (a) By the shorthand of Definition 1.6.1, n(A)={n(a):a∈A}={−a:a∈A}, which is −A as written above. In the same way, mc(A)={ca:a∈A}=cA. Nothing more is needed: the set-builder {−a:a∈A} is the image, written in the form of Definition 1.6.1.

  • (b) Here the domain is the product R×R of Section 1.3, and A×B⊆R×R. An element p of A×B is a pair (a,b) with a∈A and b∈B (Definition 1.3.2).

    (⊆) Let y∈A+B. Then y=a+b for some a∈A and b∈B; name them. The pair p:=(a,b) lies in A×B, and s(p)=a+b=y. So y∈s(A×B), with witness p.

    (⊇) Let y∈s(A×B). Then y=s(p) for some p∈A×B; name it p. Since p∈A×B, p=(a,b) for some a∈A and b∈B; name them. Then y=s(a,b)=a+b, so y∈A+B.

    Unwinding y∈s(A×B) took two layers of witnesses: first the pair p from the image, then its coordinates a,b from the product.

  • (c) −[0,1]=[−1,0]: if y=−a with 0≤a≤1, then −1≤y≤0; and if −1≤y≤0, then a:=−y∈[0,1] and y=−a. Next, {1,2}+{10,20} is the image of the four pairs (1,10), (1,20), (2,10), (2,20), so it is {11,21,12,22}, with 4 elements. Finally, {1,2}+{1,2} is the image of (1,1), (1,2), (2,1), (2,2), which is {2,3,4}, with only 3 elements: the pairs (1,2) and (2,1) have the same image 3, because s is not injective.

This pays a debt. Analysis on the Real Line, Chapter 1 introduces these sets by set-builder, and part (b) shows that even the two-variable form is an image, of A×B under s, so Definition 1.6.1 is what all three rest on: an element of A+B is used by naming two witnesses, as in part (b).

1.6.5. Preimages respect every operation

Now the promised theorem. The preimage of a union is the union of the preimages, and the same holds for intersections, complements, and differences. No hypothesis on f is needed.

Theorem 1.6.1 (Preimages of Set Operations)

Let f:X→Y be a function.

  • (a) For every family (Bi)i∈I of subsets of Y, f−1(⋃i∈IBi)=⋃i∈If−1(Bi).
  • (b) For every family (Bi)i∈I of subsets of Y, f−1(⋂i∈IBi)=⋂i∈If−1(Bi), the intersection on the left taken in Y and on the right in X.
  • (c) For every B⊆Y, f−1(Y∖B)=X∖f−1(B).
  • (d) For all B,C⊆Y, f−1(B∖C)=f−1(B)∖f−1(C).

Idea. Unwind each side at a point x∈X. A preimage turns “x is in the preimage of something” into “f(x) is in that something”. The set operation is then applied to one point, f(x), and on the other side it is applied to one point, x, whose membership in each f−1(Bi) is again a statement about f(x). The two sides say the same thing about the same point. No point is ever named as a witness for an image. The only “there exists” is over the index i in (a), and its witness is handed straight from ∃E to ∃I, so no witness can go wrong, and nothing is asked of f.

Proof. Every set in the four laws is a subset of X: a preimage is one by Definition 1.6.2, a union of subsets of X is one because each of its elements lies in some f−1(Bi)⊆X, an intersection in X and a difference X∖⋅ are subsets of X by Definition 1.2.4 and Definition 1.2.1, and f−1(B)∖f−1(C)⊆f−1(B). For two subsets S,T of X, a point outside X lies in neither, so by Definition 1.1.1, S=T holds as soon as x∈S⟺x∈T for every x∈X. Let x∈X. In each chain below, the steps labeled (P) are Definition 1.6.2, which applies because x∈X; the others are named.

  • (a) x∈f−1(⋃i∈IBi)⟺f(x)∈⋃i∈IBi(P)⟺∃i∈I, f(x)∈Bi(union)⟺∃i∈I, x∈f−1(Bi)(P)⟺x∈⋃i∈If−1(Bi)(union). The steps marked “union” are Definition 1.2.4. In the third step, for each fixed i∈I the statements f(x)∈Bi and x∈f−1(Bi) are equivalent, so one holds for some i exactly when the other does: a witness i for one is a witness for the other.

  • (b) x∈f−1(⋂i∈IBi)⟺f(x)∈⋂i∈IBi(P)⟺∀i∈I, f(x)∈Bi(intersection)⟺∀i∈I, x∈f−1(Bi)(P)⟺x∈⋂i∈If−1(Bi)(intersection). In the second step, the intersection in Y is {y∈Y:∀i∈I, y∈Bi}, and the clause f(x)∈Y holds because f maps into Y. In the last step, the intersection in X is {x′∈X:∀i∈I, x′∈f−1(Bi)}, and the clause x∈X holds by assumption. The third step holds for each i, hence for all i at once.

  • (c) x∈f−1(Y∖B)⟺f(x)∈Y∖B(P)⟺f(x)∉B(f(x)∈Y)⟺x∉f−1(B)(P, negated)⟺x∈X∖f−1(B)(x∈X). The second and fourth steps are Definition 1.2.1 for ∖, with the clause that is known to hold dropped. The third negates both sides of the equivalence x∈f−1(B)⟺f(x)∈B, as Logic and Proof, Example (Negating both sides of an iff) allows.

  • (d) x∈f−1(B∖C)⟺f(x)∈B∧f(x)∉C⟺x∈f−1(B)∧x∉f−1(C)⟺x∈f−1(B)∖f−1(C), by (P) and Definition 1.2.1 in the first step, (P) and Logic and Proof, Example (Negating both sides of an iff) in the second, and Definition 1.2.1 in the third.

In each chain the equivalences link up, so the first statement is equivalent to the last, for every x∈X. This proves the theorem.

The proof never named a witness for an image (the index i in (a) is taken by ∃E and passed unchanged to ∃I) and never used a property of f beyond its being a function. That is the whole content of the slogan: a preimage hides nothing. Each law of sets was carried across by the corresponding law of logic, applied to the one point f(x), exactly as in Section 1.2.

The empty family is covered. When I=∅, the intersection of the empty family in Y is Y and in X is X (Definition 1.2.4), and (b) says f−1(Y)=X, which is true. The union of the empty family is ∅, and (a) says f−1(∅)=∅, also true. This is the payoff of taking intersections inside a named ambient set: the theorem holds with no exception for I=∅.

Preimages also behave well under composition, with the order reversed. We will need this in Metric and Topological Spaces, Chapter 1, to show that composites of continuous maps are continuous.

Proposition 1.6.2 (Preimage under a Composite)

Let f:X→Y and g:Y→Z be functions, and C⊆Z. Then (g∘f)−1(C)=f−1(g−1(C)).

Proof. Both sides are subsets of X by Definition 1.6.2, so, as in the proof of Theorem 1.6.1, it suffices to compare memberships of each x∈X. For x∈X, x∈(g∘f)−1(C)⟺g(f(x))∈C⟺f(x)∈g−1(C)⟺x∈f−1(g−1(C)). The first step is Definition 1.6.2 for g∘f with Definition 1.4.2; the second is Definition 1.6.2 for g, which applies because f(x)∈Y; the third is Definition 1.6.2 for f. This proves the proposition.

To pull a set back through “first f, then g”, pull it back through g first. This is the same reversal as for the inverse of a composite (Exercise B2 of Section 1.5), and here no function needs an inverse.

1.6.6. Images respect unions

Now push forwards. For unions the result is the same as for preimages, but the proof is different in kind: it has to name witnesses.

Theorem 1.6.3 (Image of a Union)

Let f:X→Y be a function, and let (Ai)i∈I be a family of subsets of X. Then f(⋃i∈IAi)=⋃i∈If(Ai).

Idea. Unwind the left side at a point y: there is a point a in the union with f(a)=y, and being in the union means there is an index i with a∈Ai. So “there is a, and there is i”. The right side says “there is i, and there is a”. The two differ only in the order of two “there exists”, and two existential quantifiers can be exchanged: name both witnesses, then reintroduce them so that the quantifiers come out in the other order.

Proof. We prove two inclusions. The union ⋃i∈IAi is a subset of X, so its image is defined.

(⊆) Let y∈f(⋃i∈IAi). By Definition 1.6.1, y∈Y and there is a∈⋃i∈IAi with f(a)=y; name such a point a [∃E]. By Definition 1.2.4, there is j∈I with a∈Aj; name such an index j [∃E]. Now a∈Aj and f(a)=y, so y∈f(Aj), with witness a [∃I]. Since j∈I, y∈⋃i∈If(Ai), with witness j [∃I].

(⊇) Let y∈⋃i∈If(Ai). There is j∈I with y∈f(Aj); name it j [∃E]. So y∈Y, and there is a∈Aj with f(a)=y; name it a [∃E]. Since a∈Aj and j∈I, a∈⋃i∈IAi, with witness j [∃I]. Since f(a)=y, y∈f(⋃i∈IAi), with witness a [∃I].

This proves the theorem.

Look at the order of the tags in (⊆): ∃E for a, ∃E for j, ∃I for a, ∃I for j. The witnesses are reintroduced in the same order they were named. Because ∃I builds the formula from the inside out, a, which was the outer witness, ends up as the inner one. To rebuild the quantifiers in their old order, the ∃I steps would have run in reverse, ∃I for j before ∃I for a. That the order is not reversed is the exchange of the two “there exists”. The two ∃E boxes may close at the end because the conclusion y∈⋃if(Ai) mentions neither a nor j: the side condition of ∃E (Logic and Proof, Section 5.6) holds. The case I=∅ needs no separate treatment: both sides are f(∅)=∅ and ∅.

1.6.7. Images and intersections

For unions, images behave. For intersections, the question of the opening showed they do not: f(A∩B)={0} and f(A)∩f(B)=[0,1] for the squaring map. One inclusion survives, and the other fails in a way that is instructive, because the failing inclusion has a tempting false proof.

Example (Two witnesses under one name)

Here is a “proof” that f(A)∩f(B)⊆f(A∩B) for every function f:X→Y and all A,B⊆X.

  1. Let y∈f(A)∩f(B). (2) Then y∈f(A), so y=f(x) for some x∈A. (3) Also y∈f(B), so y=f(x) for some x∈B. (4) Hence x∈A and x∈B, so x∈A∩B. (5) Therefore y=f(x)∈f(A∩B).

Show that the conclusion is false, and find the line that fails.

Solution. The conclusion is false. Take f(x)=x2 on R, A={−1}, and B={1}. Then f(A)=f(B)={1}, so f(A)∩f(B)={1}; but A∩B=∅, so f(A∩B)=∅, and 1∉∅.

The failing line is (3). Line (2) is a correct ∃E: it names a witness x∈A with f(x)=y. Line (3) performs a second ∃E, on y∈f(B), and gives its witness the same name x. The rule requires a fresh name (Logic and Proof, Section 5.6). The statement “y=f(b) for some b∈B” promises some point of B, not the point already named. Reusing the name silently asserts that the two witnesses are equal, and nothing says they are. This is the error “one name for two witnesses”, entry (N4) of the catalogue of what is not allowed (Logic and Proof, Section 8.6).

A counterexample to the step. With the data above and y=1: line (2) names x=−1, the only point of A. The only point of B with square 1 is 1≠−1, so line (3), with the name x meaning the x of line (2), asserts −1∈B, which is false. Lines (4) and (5) are correct inferences from what (3) wrongly asserts.

Warning. When you unwind two images, give the two witnesses two names: “y=f(a) with a∈A, and y=f(b) with b∈B”. A single name is a hidden claim that a=b, which is exactly what fails for x↦x2 with a=−1, b=1. If the proof needs them equal, it must prove it.

With two names, the proof gets as far as f(a)=y=f(b) and stops. To conclude a=b we need exactly the property that injectivity supplies. So the inclusion should hold for injective functions, and only for them.

Theorem 1.6.4 (Image of an Intersection)

Let f:X→Y be a function.

  • (a) For all A,B⊆X, f(A∩B)⊆f(A)∩f(B).
  • (b) The equality f(A∩B)=f(A)∩f(B) holds for all A,B⊆X if and only if f is injective.

Try it first (ten minutes): if f is injective, why should f(A)∩f(B)⊆f(A∩B) hold? Start from “let y∈f(A)∩f(B)” and unwind both images, with two names.

Idea. The attempt names a∈A and b∈B with f(a)=y=f(b), and then has two points where it needs one in A∩B. That is the obstacle Example (Two witnesses under one name) tried to wish away. Injectivity removes it: f(a)=f(b) gives a=b, so a lies in both sets.

For the converse, run the failure backwards. If equality holds for all A,B, use it on the smallest sets that could show a failure of injectivity: two one-point sets {x1} and {x2} with f(x1)=f(x2).

Before reading on: which line of the proof of (⇐) uses injectivity, and which line of (⇒) uses that equality holds for all sets rather than for one pair?

Proof.

  • (a) Let y∈f(A∩B). By Definition 1.6.1 there is c∈A∩B with f(c)=y; name it c. Since c∈A, y∈f(A), with witness c; since c∈B, y∈f(B), with witness c. So y∈f(A)∩f(B).

  • (b) (⇐) Suppose f is injective, and let A,B⊆X. By (a) it suffices to prove f(A)∩f(B)⊆f(A∩B). Let y∈f(A)∩f(B). Since y∈f(A), there is a∈A with f(a)=y; name it a [∃E]. Since y∈f(B), there is b∈B with f(b)=y; name it b, a new name [∃E]. Then f(a)=y=f(b), so a=b because f is injective (Definition 1.4.3). Hence a∈B, so a∈A∩B, and y=f(a)∈f(A∩B), with witness a [∃I].

(⇒) Suppose f(A∩B)=f(A)∩f(B) for all A,B⊆X. Let x1,x2∈X with f(x1)=f(x2), and apply the hypothesis to A:={x1} and B:={x2}. Now f(x1)∈f(A), with witness x1, and f(x1)=f(x2)∈f(B), with witness x2. So f(x1)∈f(A)∩f(B)=f(A∩B). Hence there is c∈{x1}∩{x2} with f(c)=f(x1); name it c. Then c=x1 and c=x2, so x1=x2. Since x1,x2 were arbitrary, f is injective. This proves the theorem.

The proof of (⇒) is direct: it proves x1=x2 by pushing the one-point sets through the hypothesis, without supposing x1≠x2. Read contrapositively, the same sets give the witness of failure: whenever f(x1)=f(x2) with x1≠x2, the sets {x1} and {x2} have f({x1}∩{x2})=f(∅)=∅ while f({x1})∩f({x2})={f(x1)}. For the squaring map, x1=−1 and x2=1 is such a pair, and the intervals [−1,0] and [0,1] of the opening are a larger failure of the same kind.

Compare with Example (Two witnesses under one name). The false proof and the true one begin identically. The false one reuses a name and thereby assumes a=b; the true one keeps two names and proves a=b, from injectivity, on the one line where the hypothesis is used. That line is the whole difference between a theorem and a false statement.

1.6.8. There and back

What happens when we push a set forwards and pull it back, or the other way round? Part (d) of Example (Images and preimages of intervals under squaring) and the quick check after it gave one answer each for the squaring map: f−1(f([0,1]))=[−1,1] is bigger than [0,1], and f(f−1([−1,1]))=[0,1] is smaller than [−1,1]. In general, the round trip through Y can only grow a set, and the round trip through X can only shrink one.

Proposition 1.6.5 (Image and Preimage Round Trips)

Let f:X→Y be a function.

  • (a) A⊆f−1(f(A)) for every A⊆X. Equality holds for all A⊆X if and only if f is injective.
  • (b) f(f−1(B))=B∩f(X) for every B⊆Y; in particular f(f−1(B))⊆B. Equality f(f−1(B))=B holds for all B⊆Y if and only if f is surjective.

Idea. For (a), a point a∈A is sent into f(A), with itself as witness, so it lies in the preimage. A point x of the preimage has f(x)=f(a) for some a∈A, and it lies in A when x=a: that is injectivity again. For (b), a point of f(f−1(B)) is f(x) with f(x)∈B: so it lies in B, and it is a value of f. Those two conditions are all there is to it.

Proof.

  • (a) Let A⊆X and a∈A. Then a∈X, and f(a)∈f(A), with witness a. So a∈f−1(f(A)) by Definition 1.6.2. This proves A⊆f−1(f(A)).

    (⇐) Suppose f is injective, and let x∈f−1(f(A)). Then x∈X and f(x)∈f(A), so there is a∈A with f(a)=f(x); name it a [∃E]. Since f is injective (Definition 1.4.3), a=x, so x∈A. With the inclusion already proved, A=f−1(f(A)) by Proposition 1.1.1.

    (⇒) Suppose A=f−1(f(A)) for every A⊆X. Let x1,x2∈X with f(x1)=f(x2). Then f(x2)=f(x1)∈f({x1}), with witness x1, so x2∈f−1(f({x1})) by Definition 1.6.2. The hypothesis with A={x1}, a subset of X because x1∈X, gives f−1(f({x1}))={x1}, so x2∈{x1}. Hence x2=x1, and f is injective.

  • (b) Let B⊆Y. (⊆) Let y∈f(f−1(B)). There is x∈f−1(B) with f(x)=y; name it x. Then x∈X and f(x)∈B, so y∈B; and y∈f(X), with witness x. (⊇) Let y∈B∩f(X). Since y∈f(X), there is x∈X with f(x)=y; name it x. Then f(x)=y∈B, so x∈f−1(B), and y∈f(f−1(B)), with witness x. This proves f(f−1(B))=B∩f(X), and B∩f(X)⊆B.

For the last statement: if f is surjective (Definition 1.4.4), every y∈Y lies in f(X); since f(X)⊆Y by Definition 1.6.1, f(X)=Y by Proposition 1.1.1, and B∩f(X)=B∩Y=B for every B⊆Y, because B⊆Y. Conversely, if f(f−1(B))=B for every B⊆Y, take B=Y: since f−1(Y)=X, this says f(X)=Y, so every y∈Y is f(x) for some x∈X (Definition 1.6.1), and f is surjective (Definition 1.4.4). This proves the proposition.

So the two round trips measure the two failures of Section 1.4. Pushing forwards and pulling back adds to A the points that share a value with a point of A: nothing is added, for every A, exactly when f is injective. Pulling back and pushing forwards removes from B the points that are never hit: nothing is removed, for every B, exactly when f is surjective.

1.6.9. Two readings of the inverse symbol

Remark. The symbol f−1 now has two uses. For every function f:X→Y and every B⊆Y, f−1(B) is the preimage of Definition 1.6.2. For a bijection f, f−1:Y→X is also the inverse function of Definition 1.5.2, and then f−1(B) could also be read as the image of B under that function. The two readings give the same set. Write g for the inverse function; both sets are subsets of X. If x=g(b) with b∈B, then f(x)=f(g(b))=b∈B, since f∘g=idY, so x lies in the preimage. If x∈X and f(x)∈B, then x=g(f(x))∈g(B), since g∘f=idX. So the two readings name the same set, and the notation is never ambiguous. When f is not a bijection only the first reading exists.

For example, a(x)=3x−2 on R is a bijection with inverse a−1(y)=(y+2)/3 (Section 1.5). The preimage a−1([1,4]) is {x∈R:1≤3x−2≤4}=[1,2], and the image of [1,4] under the inverse function is {(y+2)/3:y∈[1,4]}=[1,2] as well.

1.6.10. Exercises

A. Check your understanding

Exercise (A1)

Parts (a)–(d) are about Theorem 1.6.1 and its proof.

  • (a) Suppose we tried to prove the image version of law (b), f(⋂i∈IAi)=⋂i∈If(Ai), by the same kind of chain. At which step would a witness have to be named, and why does the preimage version need none?
  • (b) Run law (b) on f(x)=x2 on R, with I={1,2}, B1=[0,4], and B2=[1,9]: compute both sides.
  • (c) What are both sides of law (b) when I=∅?
  • (d) State law (c) in symbols, for f:X→Y and B⊆Y.
  • (e) True or false, with a reason: for every A⊆X, f(X∩A)=f(A).

Solution.

  • (a) At the step that unwinds y∈⋂if(Ai) into “for every i∈I, y∈f(Ai)”, and then each y∈f(Ai) into “there is ai∈Ai with f(ai)=y”. The witnesses ai may differ from one i to another, and the left side needs one point in every Ai. In the preimage version, the corresponding step is “for every i, f(x)∈Bi”, a statement about the single point f(x) with no “there exists” in it, so nothing needs naming.

  • (b) B1∩B2=[1,4], so the left side is f−1([1,4])=[−2,−1]∪[1,2] (Example (Images and preimages of intervals under squaring) (b)). On the right, f−1([0,4])=[−2,2] and f−1([1,9])=[−3,−1]∪[1,3], whose intersection is [−2,−1]∪[1,2]. The two sides agree.

  • (c) Both are X. The left side is f−1(Y)=X, since the empty intersection in Y is Y; the right side is the empty intersection in X, which is X.

  • (d) f−1(Y∖B)=X∖f−1(B): a point of X is sent outside B exactly when it is not in the preimage of B.

  • (e) True. Since A⊆X, X∩A=A (each element of A lies in X), so the two sides are the image of the same set.

B. Practice

Exercise (B1: Computing images and preimages)

Compute each set, and prove each equality by two inclusions or by a chain of equivalences.

  • (a) For d:N×N→Z, d(m,n)=m−n: the image d({(m,n)∈N×N:m>n}) and the preimage d−1({0}).
  • (b) For 1[0,1]:R→{0,1}: the preimages of {1} and {0}, and the image of [2,3].
  • (c) For g:R→R, g(x)=x2−2x: the image g([0,3]) and the preimages g−1({0}) and g−1([−1,0]).

Solution.

  • (a) The image is Z>0. (⊆) If y=m−n with m>n, then y is an integer and y>0, so y∈Z>0. (⊇) Let k∈Z>0. The pair (k,0) lies in N×N, has k>0, and d(k,0)=k; so k is in the image. The preimage is d−1({0})={(m,n)∈N×N:m=n}={(n,n):n∈N}, since m−n=0 exactly when m=n.

  • (b) By the definition of the indicator (Section 1.4), 1[0,1](x)=1 for x∈[0,1] and 0 otherwise. So 1[0,1]−1({1})=[0,1] and 1[0,1]−1({0})=R∖[0,1], each a chain of one equivalence. The image 1[0,1]([2,3])={0}: every point of [2,3] lies outside [0,1] and is sent to 0, and 0 is hit, for instance by 2.

  • (c) Write g(x)=(x−1)2−1. The image is g([0,3])=[−1,3]. (⊆) If 0≤a≤3, then −1≤a−1≤2, so |a−1|≤2, and hence 0≤(a−1)2=|a−1|2≤4 by Logic and Proof, Theorem 2.4.5 applied to |a−1| and 2, and −1≤g(a)≤3. (⊇) Let −1≤y≤3, and take a:=1+y+1. Then 0≤y+1≤2, so a∈[1,3]⊆[0,3], and g(a)=(y+1)−1=y. For the preimages: g(x)=0⟺x(x−2)=0⟺x∈{0,2}, so g−1({0})={0,2}; and −1≤g(x)≤0⟺0≤(x−1)2≤1⟺|x−1|≤1⟺x∈[0,2], so g−1([−1,0])=[0,2].

Exercise (B2: Two laws, element by element)

Let f:X→Y be a function. Prove each law directly, by two inclusions or by a chain of equivalences at a point, tagging each step that names or exhibits a witness with [∃E] or [∃I].

  • (a) f(A∪B)=f(A)∪f(B) for A,B⊆X. (This is a case of Theorem 1.6.3; prove it without citing it.)
  • (b) f−1(C∖D)=f−1(C)∖f−1(D) for C,D⊆Y. (This is Theorem 1.6.1 (d); prove it without citing it.) Which steps, if any, need a tag?

Solution.

  • (a) (⊆) Let y∈f(A∪B). There is c∈A∪B with f(c)=y; name it c [∃E]. By Definition 1.2.1, c∈A or c∈B. Case 1: c∈A. Then y∈f(A), with witness c [∃I], so y∈f(A)∪f(B). Case 2: c∈B. Then y∈f(B), with witness c [∃I], so y∈f(A)∪f(B). (⊇) Let y∈f(A)∪f(B). Case 1: y∈f(A). There is a∈A with f(a)=y; name it a [∃E]. Then a∈A∪B, so y∈f(A∪B), with witness a [∃I]. Case 2: y∈f(B) is the same with B in place of A. In either case y∈f(A∪B).

  • (b) Both sides are subsets of X. For x∈X: x∈f−1(C∖D) if and only if f(x)∈C∖D (Definition 1.6.2) if and only if f(x)∈C and f(x)∉D (Definition 1.2.1) if and only if x∈f−1(C) and x∉f−1(D) (Definition 1.6.2, and Logic and Proof, Example (Negating both sides of an iff) for the second clause) if and only if x∈f−1(C)∖f−1(D). No step names or exhibits a witness, so no step carries a tag: this is the difference between (a) and (b).

Exercise (B3: The two readings of the inverse)

Let f:X→Y be a bijection, with inverse function f−1:Y→X, and let B⊆Y. Prove that the image of B under the function f−1 equals the preimage of B under f. To keep the readings apart, write g:=f−1 for the inverse function, and prove g(B)={x∈X:f(x)∈B}. The remark in “Two readings of the inverse symbol” gives the argument in brief; write it out as two inclusions, tagging each step that names or exhibits a witness with [∃E] or [∃I].

Solution. (⊆) Let x∈g(B). There is b∈B with g(b)=x; name it b [∃E]. Then x∈X, and f(x)=f(g(b))=b∈B, since f∘g=idY. So x lies in the preimage.

(⊇) Let x∈X with f(x)∈B. Then g(f(x))=x, since g∘f=idX. So x∈g(B), with witness f(x)∈B [∃I].

Hence g(B) equals the preimage of B under f: for a bijection, the two readings of f−1(B) name the same set. Both equations of Definition 1.5.2 were used, one in each inclusion.

C. Going deeper

Exercise (C1: Images and differences)

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

  • (a) Here are the first lines of a proof that f(A)∖f(B)⊆f(A∖B). Name the move, then complete it.

    Let y∈f(A)∖f(B). Then y∈f(A), so there is a∈A with f(a)=y; name it a [∃E]. Also y∉f(B).

  • (b) Show that the reverse inclusion can fail, with f(x)=x2 on R, A={−1,1}, and B={1}.

  • (c) Prove that f(A∖B)=f(A)∖f(B) holds for all A,B⊆X if and only if f is injective.

Solution.

  • (a) The move is element-chasing: unwind the membership of the hypothesis into its definition, and rewind into the definition of the goal. The goal is y∈f(A∖B), which needs a witness in A∖B, and the natural candidate is the a already named. We know a∈A; we need a∉B.

    Suppose a∈B. Then y=f(a)∈f(B), with witness a [∃I], which contradicts y∉f(B). Hence a∉B [¬I]. So a∈A∖B and f(a)=y, which gives y∈f(A∖B), with witness a [∃I].

  • (b) A∖B={−1}, so f(A∖B)={1}. But f(A)={1}=f(B), so f(A)∖f(B)=∅. The point 1 lies in f(A∖B) and not in f(A)∖f(B).

  • (c) (⇐) Suppose f is injective. By (a) it suffices to show f(A∖B)⊆f(A)∖f(B). Let y∈f(A∖B), and name a∈A∖B with f(a)=y. Then y∈f(A), with witness a. Suppose y∈f(B), and name b∈B with f(b)=y. Then f(a)=f(b), so a=b by injectivity, and a∈B, contradicting a∈A∖B. Hence y∉f(B), and y∈f(A)∖f(B).

(⇒) Suppose equality holds for all A,B⊆X. Let x1,x2∈X with f(x1)=f(x2), and take A:={x1}, B:={x2}. Then f(A)={f(x1)}=f(B), so f(A∖B)=f(A)∖f(B)=∅. Suppose x1≠x2. Then x1∈A∖B, so f(x1)∈f(A∖B)=∅, which is impossible. Hence x1=x2, by RAA (Logic and Proof, Definition 2.5.1), and f is injective.

Marking scheme. (10 points)

  • 3: (a) shows a∉B by deriving y∈f(B) from a∈B, and concludes y∈f(A∖B) with the witness a.
  • 2: (b) computes both sides for the given data.
  • 3: (c) (⇐) names two witnesses, a∈A∖B and b∈B, and uses injectivity to identify them.
  • 2: (c) (⇒) applies the hypothesis to one-point sets (or any sets that separate x1 from x2) and concludes x1=x2.

Fatal errors (0 for the step): using one name for the witnesses of y∈f(A∖B) and y∈f(B) (entry (N4) of Logic and Proof, Chapter 8’s catalogue); in (⇒), assuming injectivity to compute f(A∖B).

Exercise (C2: Find the error)

A student proves the following claim: if f:X→Y is injective and A⊆X, then f−1(f(A))⊆A.

  1. Let x∈f−1(f(A)). (2) By the definition of preimage, x∈X and f(x)∈f(A). (3) Since f(x)∈f(A), we have x∈A. (4) Since x was arbitrary, f−1(f(A))⊆A.
  • (a) Is the claim true?
  • (b) Which line fails, and which rule does it skip?
  • (c) Give a counterexample to the failing step, and repair the proof.

Solution.

  • (a) The claim is true: it is the (⇐) half of Proposition 1.6.5 (a).

  • (b) Line (3) fails. The statement f(x)∈f(A) says only that f(a)=f(x) for some a∈A (Definition 1.6.1). To use it, the proof must name that witness by ∃E, with a fresh name. Line (3) skips the ∃E and silently takes the witness to be x itself. The name x is already in use (line (1) introduced it), so the step breaks the fresh-name condition of ∃E (Logic and Proof, Section 5.6), the condition behind entry (N4) of the catalogue of Logic and Proof, Chapter 8. The tell is that injectivity, a hypothesis, is never used: an argument that ignores a necessary hypothesis cannot be right.

  • (c) A counterexample to the step “f(x)∈f(A), so x∈A” needs a non-injective function, since for injective ones the conclusion of the step is true. Take f(x)=x2 on R, A={1}, and x=−1. Then f(x)=1∈f(A), but x∉A.

Repair: replace (3) by “Since f(x)∈f(A), there is a∈A with f(a)=f(x); name it a. Since f is injective, a=x. Hence x∈A.”

Exercise (C3: Exit check: preimages)
  • (a) Let f:X→Y be a function and (Bi)i∈I a family of subsets of Y. Prove that f−1(⋂i∈IBi)=⋂i∈If−1(Bi), the intersections taken in Y and in X.
  • (b) Give a function f and sets A,B with f(A∩B)≠f(A)∩f(B), computing both sides.

Solution.

  • (a) We prove two inclusions.

    (⊆) Let x∈f−1(⋂i∈IBi). By Definition 1.6.2, x∈X and f(x)∈⋂i∈IBi. By Definition 1.2.4, f(x)∈Bi for every i∈I. Let i∈I. Then f(x)∈Bi and x∈X, so x∈f−1(Bi). Since i was arbitrary, x lies in every f−1(Bi), and since x∈X, x∈⋂i∈If−1(Bi).

    (⊇) Let x∈⋂i∈If−1(Bi). Then x∈X and x∈f−1(Bi) for every i∈I. Let i∈I. Then f(x)∈Bi by Definition 1.6.2. Since i was arbitrary, and f(x)∈Y, f(x)∈⋂i∈IBi. So x∈f−1(⋂i∈IBi).

    If I=∅, both sides are X, and the argument above covers this case: the “for every i” statements hold vacuously.

  • (b) Let f:{1,2}→{0} be the constant function, A={1}, B={2}. Then A∩B=∅, so f(A∩B)=∅. But f(A)={0}=f(B), so f(A)∩f(B)={0}≠∅. (The squaring map with A=[−1,0], B=[0,1] is another answer: {0} against [0,1].)

Marking scheme. (10 points)

  • 1: announces two inclusions (or a chain of equivalences at a point x∈X).
  • 3: (⊆) unwinds x∈f−1(⋂Bi) to “f(x)∈Bi for every i”, then rewinds to x∈f−1(Bi) for an arbitrary i.
  • 3: (⊇) the reverse chain, with i arbitrary.
  • 1: the ambient sets are named (x∈X, f(x)∈Y) or the case I=∅ is handled.
  • 2: a correct example, with both sides computed.

A single chain of equivalences, each step justified, earns the first seven points. Fatal errors (0 for the step): fixing one i and concluding for all i (entry (N1) of Logic and Proof, Chapter 8’s catalogue); stating the example’s two sides without checking an element that lies in one and not the other.

R. Review

Exercise (R1)

Here is a derivation of “if A⊆B, then P(A)⊆P(B)”. The steps “by def.” unwind or rewind Definition 1.1.2 and Definition 1.2.2.

1A⊆B
2∀x(x∈A→x∈B)def. 1
3S0S0∈P(A)
4S0⊆Adef. 3
5∀x(x∈S0→x∈A)def. 4
6x0x0∈S0
7x0∈S0→x0∈A∀E 5
8x0∈A→E 7, 6
9x0∈A→x0∈B∀E 2
10x0∈B→E 9, 8
11x0∈S0→x0∈B→I 6–10
12∀x(x∈S0→x∈B)∀I 6–11
13S0⊆Bdef. 12
14S0∈P(B)def. 13
15S0∈P(A)→S0∈P(B)→I 3–14
16∀S(S∈P(A)→S∈P(B))∀I 3–15
17P(A)⊆P(B)def. 16
18A⊆B→P(A)⊆P(B)→I 1–17

Write the proof as plain prose, the way a mathematician would. Then say which sentence of your proof carries each of the five boxes.

Solution. Proof. Suppose A⊆B. Let S∈P(A), so S⊆A. Let x∈S. Then x∈A, since S⊆A, and so x∈B, since A⊆B. Hence S⊆B, that is, S∈P(B). This proves P(A)⊆P(B).

The boxes. “Suppose A⊆B” opens the →I box 1–17; its closing line 18 is the silent frame of the whole proof. “Let S∈P(A)” opens two boxes at once: the ∀I box for S0 and the →I box 3–14 inside it. “Let x∈S” likewise opens the ∀I box for x0 and the →I box 6–10. “Hence S⊆B” closes the two inner boxes (lines 11 and 12) and rewinds the definition (line 13). “This proves P(A)⊆P(B)” closes the S boxes (lines 15, 16) and rewinds (line 17).

This is the passage from level 0 to level 3 of Logic and Proof, Section 8.3: each “let” carries a ∀I box together with the →I box of a subset statement, the ∀E and →E lines 7–10 become the two “since” clauses, the unwinding lines 2 and 5 go silent, line 4 becomes a “so” and line 14 a “that is”, and the rewinding lines 13 and 17 are the two conclusions the prose states.

Exercise (R2)

Decide whether A∖(B∖C)=(A∖B)∖C for all sets A,B,C, by a table of the eight possible memberships of a point x in A, B, C. If the two sides can differ, turn a row where they differ into a counterexample.

Solution. Write P, Q, R for the statements x∈A, x∈B, x∈C. By Definition 1.2.1, x∈A∖(B∖C) is P∧¬(Q∧¬R), and x∈(A∖B)∖C is (P∧¬Q)∧¬R. The table: PQRP∧¬(Q∧¬R)(P∧¬Q)∧¬RTTTTFTTFFFTFTTFTFFTTFTTFFFTFFFFFTFFFFFFF The columns differ in the first and third rows. Take the first row: put the point 1 in exactly the sets whose statement is true, all three, so A=B=C={1}. Then B∖C=∅, so A∖(B∖C)={1}; and A∖B=∅, so (A∖B)∖C=∅. The two sides differ, so the identity is false. (The third row gives A=C={1}, B=∅, with the same two answers.)

Why a table suffices: each side’s membership condition is a formula in P, Q, R, and a row with the two columns different gives sets directly, which are then checked by computing both sides, as above. The truth tables of Logic and Proof, Chapter 4 add one more thing: by Logic and Proof, Corollary 4.7.3, the first row shows that the sequent P∧¬(Q∧¬R)⊢(P∧¬Q)∧¬R is not derivable, so the propositional rules cannot carry a point of the left side into the right side.

Exercise (R3)

Derive (P∧¬Q)→R⊢P→(Q∨R). Then read the derivation as a proof that for sets A,B,C, if A∖B⊆C, then A⊆B∪C. Which step is classical?

Solution. The goal is an implication, so open a box on P with goal Q∨R. The premise can fire only on P∧¬Q, which needs ¬Q, and nothing gives ¬Q outright. So split on Q∨¬Q, by excluded middle (Logic and Proof, Proposition 2.5.3): in the case Q the goal is immediate, and in the case ¬Q the premise gives R.

1(P∧¬Q)→R
2P
3Q∨¬QLEM
4Q
5Q∨R∨I 4
6¬Q
7P∧¬Q∧I 2, 6
8R→E 1, 7
9Q∨R∨I 8
10Q∨R∨E 3, 4–5, 6–9
11P→(Q∨R)→I 2–10

As sets. Suppose A∖B⊆C, and let x∈A. Take P, Q, R to be x∈A, x∈B, x∈C. By Definition 1.1.2 and Definition 1.2.1, the hypothesis at this x is (P∧¬Q)→R, and the goal x∈B∪C is Q∨R. The derivation, used as a derived rule (Logic and Proof, Definition 2.3.1), gives P→(Q∨R), and with P it gives x∈B∪C. In prose: either x∈B, and then x∈B∪C; or x∉B, and then x∈A∖B⊆C, so x∈C⊆B∪C. Since x was arbitrary, A⊆B∪C.

The classical step is line 3, the case split “x∈B or x∉B” by excluded middle, which is derived with RAA (Logic and Proof, Definition 2.5.1).

Exercise (R4)

Show that there is no set that contains every singleton {x} as an element.

Solution. Suppose S were such a set. Let T:={s∈S:s is a singleton}, a set by specification (Definition 1.1.3); its elements are sets, since S may also contain numbers, and those are excluded. Consider the union ⋃T of the sets in T (Definition 1.2.4, the form ⋃S for a set S whose elements are sets). For every set x, the singleton {x} lies in S, hence in T, and x∈{x}; so x∈⋃T. Thus ⋃T is a set of which every set is an element, and Theorem 1.1.4 says there is no such set. This contradiction shows that no such S exists.

The tool, and the look-alike. The tool is Russell’s theorem, Theorem 1.1.4, applied not to S but to ⋃T. Applied to S directly, it says only that {z∈S:z∉z}∉S, and that does not contradict anything: S was supposed to contain singletons, not that set. The move that makes it work is the union, which turns “contains the singleton of every set” into “contains every set”. A direct diagonal construction inside S also works, but it repeats the proof of Theorem 1.1.4 instead of using it.