Survey of Mathematics

4.1 Metric and normed spaces; open and closed sets

Every ε-proof of Unit 1 used the distance |x − y| through only four properties. Any rule of distance with those four properties gives a metric space, and then open balls, open and closed sets, interior, closure and boundary make sense for vectors, functions and bit strings with the same proofs.

Taught in 375/376Beyond the courseAbbott, Understanding Analysis, ch. 3 (sections 3.1 and 3.2)Rudin, Principles of Mathematical Analysis, ch. 2Apostol Vol. 2, sections 8.2 and 8.3

In 1.2 and 1.3 every proof about closeness used the number ∣x−y∣|x - y| in a very small number of ways. It is never negative. It is zero only when x=yx = y. It is the same from xx to yy as from yy to xx. And it obeys the triangle inequality. Nothing else about the real line entered the proofs: no addition, no multiplication, no order. So any rule that measures distance and has those four properties can be put in the place of ∣x−y∣|x - y|, and the same ε\varepsilon games still work. That is a metric space. It lets us ask how close two vectors are, how close two functions are (“is sin⁡x\sin x close to x−x36x - \frac{x^3}{6} on [0,1][0, 1]?”) and how close two bit strings are, with one theory. This chapter builds the words of that theory: balls, open sets, closed sets, interior, closure, boundary. Chapter 4.2 adds convergence and completeness.

Before you start

1.2: the triangle inequality. 2.9: the norm of a vector and its properties. 0.3: unions, intersections and complements of sets, and De Morgan’s laws.

Quick checkA traveller on the number line goes from aa to cc, either directly or by way of a stop at bb. Which statement is always true?
Quick checkFor the norm ∥x∥=(x,x)\lVert x \rVert = \sqrt{(x, x)} of 2.9 and a real number cc, what is ∥cx∥\lVert cx \rVert?
Quick checkWhat is the complement of A∪BA \cup B?

The picture: who counts as close?

On the plane there is more than one sensible way to measure how far a point is from the centre. Walking along city blocks costs ∣x1∣+∣x2∣|x_1| + |x_2|. A straight line costs x12+x22\sqrt{x_1^2 + x_2^2}. A chess king moves one square in any of eight directions, so reaching (x1,x2)(x_1, x_2) takes max⁡(∣x1∣,∣x2∣)\max(|x_1|, |x_2|) moves. The set of points within distance rr of the centre is a diamond, a disc or a square. Three things to do in the picture:

  1. Put xx on an axis. All three distances agree, because only one coordinate is non-zero.
  2. Put xx near a corner of the square, such as (0.9,0.9)(0.9, 0.9) with r=1r = 1. It is inside the square, outside the disc and far outside the diamond. The three rules disagree about whether xx is “close”.
  3. Slide rr and watch the nesting. The diamond stays inside the disc and the disc stays inside the square. Later we prove why, and use it to show that the three rules still agree about which sets are open.
Point xxd1=∣x1∣+∣x2∣d_1 = \lvert x_1 \rvert + \lvert x_2 \rvertd2=x12+x22d_2 = \sqrt{x_1^2 + x_2^2}d∞=max⁡(∣x1∣,∣x2∣)d_\infty = \max(\lvert x_1 \rvert, \lvert x_2 \rvert)
(3,4)(3, 4)775544
(1,1)(1, 1)222≈1.41\sqrt 2 \approx 1.4111
(5,0)(5, 0)555555
Where this came from· Fréchet and Hausdorff: one theory of closeness

Before 1900, “distance” meant distance on a line, in the plane or in space. Around 1900 analysts began to study sets of functions and had to say when one function is close to another, for example when a sequence of curves settles down to a limit curve. Maurice Fréchet’s doctoral thesis of 1906, Sur quelques points du calcul fonctionnel, listed the few properties of distance that the convergence proofs actually use, and studied any set that carries a distance with those properties. The name “metric space” (metrischer Raum) comes from Felix Hausdorff’s book Grundzüge der Mengenlehre (1914). The book also set out spaces defined only by which sets count as open, with no distance at all. That is the start of topology, the subject of MATH 551. The problem both men solved was to write the theory of closeness once, and have it serve numbers, vectors and functions.

The idea, in words

A distance on a set is a rule that gives every two points a number. It earns the name if it has four properties, and each property is there for a reason.

Why· Why exactly these four properties
  1. Never negative. Distances are lengths.
  2. Zero only for equal points. Then “the distance between xx and yy is smaller than every ε>0\varepsilon > 0” proves x=yx = y. This is the last step of the uniqueness-of-limits proof in 1.2.
  3. Symmetric. ”xx is close to yy” and ”yy is close to xx” are the same statement, so a ball around xx and a ball around yy can be compared.
  4. Triangle inequality. You can reach zz from xx by way of yy without saving distance. This is the property that lets you split a distance into two pieces and give each half of the budget ε\varepsilon (the ε2\frac\varepsilon2 trick). Without it, “close to something close” would not be “close”.

Notice what is not demanded: you need not be able to add points, multiply them, or order them. Bit strings and cities have distances but no sum.

A normed space adds structure: the points are vectors, and the distance comes from a length of vectors. Every normed space is a metric space, but not the other way round.

Definitions and theorems

Definition B

Metric space

A metric space is a set XX together with a function dd that gives a real number d(x,y)d(x, y) for every pair of points x,y∈Xx, y \in X, such that for all x,y,z∈Xx, y, z \in X:

  • (M1) d(x,y)≥0d(x, y) \ge 0, and d(x,y)=0d(x, y) = 0 if and only if x=yx = y.
  • (M2) d(x,y)=d(y,x)d(x, y) = d(y, x).
  • (M3) d(x,z)≤d(x,y)+d(y,z)d(x, z) \le d(x, y) + d(y, z) (the triangle inequality).

The function dd is the metric or distance. The elements of XX are called points, whatever they really are.

In one lineA set XX with a distance d(x,y)d(x, y) for each pair of points, never negative, zero only for equal points, symmetric, and obeying the triangle inequality.

Why it existsIt keeps from ∣x−y∣|x - y| exactly what the ε\varepsilon-proofs of Unit 1 used, so those proofs work for vectors, functions and bit strings.

The real line with d(x,y)=∣x−y∣d(x, y) = |x - y| is a metric space: (M1) and (M2) are properties of absolute value, and (M3) is the triangle inequality of 1.2 in the form ∣x−z∣≤∣x−y∣+∣y−z∣|x - z| \le |x - y| + |y - z|.

Quick checkOn R\mathbb R define d(x,y)=∣x2−y2∣d(x, y) = |x^2 - y^2|. Which axiom fails?
Worked example
Show that d(x,y)=(x−y)2d(x, y) = (x - y)^2 is not a metric on R\mathbb R.

Solution. To show a rule is not a metric, we find one violated axiom and one instance where it fails.

  1. Check (M1) and (M2). (x−y)2≥0(x - y)^2 \ge 0 with equality iff x=yx = y, and (x−y)2=(y−x)2(x - y)^2 = (y - x)^2. The first two axioms hold, so the failure, if any, is in the triangle inequality.
  2. Look for a triangle that fails. Take x=0x = 0, y=1y = 1, z=2z = 2. Then d(0,2)=4d(0, 2) = 4, while d(0,1)+d(1,2)=1+1=2d(0, 1) + d(1, 2) = 1 + 1 = 2. Squaring makes large gaps count much more than small ones, so the stop at y=1y = 1 makes the journey “cheaper” than the direct trip. That is the opposite of the triangle inequality.
  3. Conclude. 4≤24 \le 2 is false, so (M3) fails.

Answer. (x−y)2(x - y)^2 is not a metric. Its square root, ∣x−y∣|x - y|, is. ■\blacksquare

Worked example
Prove the reverse triangle inequality in a metric space: ∣d(x,z)−d(y,z)∣≤d(x,y)|d(x, z) - d(y, z)| \le d(x, y).

Solution. An absolute value ∣a∣≤c|a| \le c means two things at once, a≤ca \le c and −a≤c-a \le c. So we prove both.

  1. First half. (M3) gives d(x,z)≤d(x,y)+d(y,z)d(x, z) \le d(x, y) + d(y, z). Subtract d(y,z)d(y, z): d(x,z)−d(y,z)≤d(x,y)d(x, z) - d(y, z) \le d(x, y). The detour through yy is never shorter than the direct trip, so moving the term across is the same statement.
  2. Second half. Swap the roles of xx and yy: d(y,z)−d(x,z)≤d(y,x)=d(x,y)d(y, z) - d(x, z) \le d(y, x) = d(x, y). The first half holds for any two points, so it holds with xx and yy exchanged. (M2) turns d(y,x)d(y, x) into d(x,y)d(x, y).
  3. Combine. Both d(x,z)−d(y,z)d(x, z) - d(y, z) and its negative are at most d(x,y)d(x, y). That is exactly what ∣d(x,z)−d(y,z)∣≤d(x,y)|d(x, z) - d(y, z)| \le d(x, y) means.

Answer. The inequality holds. In words: if xx and yy are within ε\varepsilon of each other, their distances to any third point differ by at most ε\varepsilon. So the distance function is continuous. In a normed space, taking z=Oz = O gives ∣ ∥x∥−∥y∥ ∣≤∥x−y∥\big|\,\lVert x \rVert - \lVert y \rVert\,\big| \le \lVert x - y \rVert. ■\blacksquare

Definition B

Normed space

A normed space is a vector space VV with a function ∥⋅∥\lVert \cdot \rVert that gives a real number ∥x∥\lVert x \rVert for each x∈Vx \in V, such that for all x,y∈Vx, y \in V and every real cc:

  • (N1) ∥x∥≥0\lVert x \rVert \ge 0, and ∥x∥=0\lVert x \rVert = 0 if and only if x=Ox = O.
  • (N2) ∥cx∥=∣c∣ ∥x∥\lVert cx \rVert = |c|\,\lVert x \rVert.
  • (N3) ∥x+y∥≤∥x∥+∥y∥\lVert x + y \rVert \le \lVert x \rVert + \lVert y \rVert.

The function is a norm. In 2.9 the norm (x,x)\sqrt{(x, x)} came from an inner product, and the theorem “Properties of the norm” proved (N1) to (N3) for it. Here we turn those three properties into the definition, so norms need not come from inner products.

In one lineA vector space with a length ∥x∥\lVert x \rVert for every vector that is never negative, zero only for OO, scales by ∣c∣\lvert c \rvert, and obeys the triangle inequality.

Why it existsIt is the setting where distance and the vector operations fit together, so that distance is unchanged by sliding and scales by ∣c∣|c| under stretching.

Theorem B Abbott Sec. 3.1; Rudin ch. 2

A norm gives a metric

Let VV be a normed space. Then d(x,y)=∥x−y∥d(x, y) = \lVert x - y \rVert satisfies (M1), (M2) and (M3).

In one lineIf ∥⋅∥\lVert \cdot \rVert is a norm on VV, then d(x,y)=∥x−y∥d(x, y) = \lVert x - y \rVert is a metric on VV.

Why it is trueEach metric axiom is one norm axiom applied to x−yx - y; the triangle inequality comes from splitting x−zx - z as (x−y)+(y−z)(x - y) + (y - z).

Proofstandard
The idea: Translate each axiom: M1 is N1 for the vector x − y, M2 is N2 with c = −1, M3 is N3 for the two vectors x − y and y − z, which add to x − z.
(M1) d(x,y)=∥x−y∥≥0d(x, y) = \lVert x - y \rVert \ge 0, and it is 00 iff x−y=Ox - y = O, that is, iff x=yx = y.
(N1) applied to the vector x−yx - y. Also x−y=Ox - y = O exactly when x=yx = y.
(M2) d(y,x)=∥y−x∥=∥−(x−y)∥=∥x−y∥=d(x,y)d(y, x) = \lVert y - x \rVert = \lVert -(x - y) \rVert = \lVert x - y \rVert = d(x, y).
(N2) with c=−1c = -1: ∥−v∥=∣−1∣ ∥v∥=∥v∥\lVert -v \rVert = |-1|\,\lVert v \rVert = \lVert v \rVert.
(M3) d(x,z)=∥(x−y)+(y−z)∥≤∥x−y∥+∥y−z∥=d(x,y)+d(y,z)d(x, z) = \lVert (x - y) + (y - z) \rVert \le \lVert x - y \rVert + \lVert y - z \rVert = d(x, y) + d(y, z). ■\blacksquare
Write x−zx - z as the sum of the two vectors x−yx - y and y−zy - z, then use (N3).Where the idea comes from: a detour through y is the same as adding two displacement vectors.

Now the standard examples. For x=(x1,…,xn)x = (x_1, \dots, x_n) in Rn\mathbb R^n define three lengths:

∥x∥1=∣x1∣+⋯+∣xn∣,∥x∥2=x12+⋯+xn2,∥x∥∞=max⁡(∣x1∣,…,∣xn∣).\lVert x \rVert_1 = |x_1| + \dots + |x_n|, \qquad \lVert x \rVert_2 = \sqrt{x_1^2 + \dots + x_n^2}, \qquad \lVert x \rVert_\infty = \max(|x_1|, \dots, |x_n|).

Also, on the vector space C[a,b]C[a, b] of continuous functions on [a,b][a, b] (an example of 2.1), define the sup norm ∥f∥∞=max⁡a≤x≤b∣f(x)∣\lVert f \rVert_\infty = \max_{a \le x \le b} |f(x)|. The maximum exists because a continuous function on [a,b][a, b] attains its maximum, by the extreme value theorem of 1.3, and ∣f∣|f| is continuous.

Theorem B Rudin ch. 2 and ch. 7; Apostol Vol. 2 ch. 1

The standard norms are norms

(a) ∥⋅∥1\lVert \cdot \rVert_1, ∥⋅∥2\lVert \cdot \rVert_2 and ∥⋅∥∞\lVert \cdot \rVert_\infty satisfy (N1) to (N3) on Rn\mathbb R^n. (b) The sup norm satisfies (N1) to (N3) on C[a,b]C[a, b].

In one line∥⋅∥1\lVert \cdot \rVert_1, ∥⋅∥2\lVert \cdot \rVert_2 and ∥⋅∥∞\lVert \cdot \rVert_\infty are norms on Rn\mathbb R^n, and the sup norm is a norm on C[a,b]C[a, b].

Why it is trueFor each one, (N1) and (N2) are quick computations, and (N3) reduces to the triangle inequality for single real numbers.

ProofRudin ch. 7
The idea: The 2-norm is the norm of 2.9. For the 1-norm and the max-norm, check each axiom coordinate by coordinate, using |x_i + y_i| ≤ |x_i| + |y_i| for numbers. The sup norm is the max-norm with a point x in [a, b] in place of the coordinate i.
The 2-norm is x⋅x\sqrt{x \cdot x} from the dot product, so (N1) to (N3) hold.
The theorem 'Properties of the norm' in 2.9, which used Cauchy–Schwarz.
1-norm (N1): ∥x∥1≥0\lVert x \rVert_1 \ge 0, and =0= 0 iff every ∣xi∣=0|x_i| = 0, that is, x=Ox = O.
A sum of non-negative terms is 00 only if every term is 00.
1-norm (N2): ∥cx∥1=∑∣c∣∣xi∣=∣c∣ ∥x∥1\lVert cx \rVert_1 = \sum |c||x_i| = |c|\,\lVert x \rVert_1.
∣cxi∣=∣c∣∣xi∣|cx_i| = |c||x_i|, then take the common factor ∣c∣|c| out of the sum.
1-norm (N3): ∑∣xi+yi∣≤∑(∣xi∣+∣yi∣)=∥x∥1+∥y∥1\sum |x_i + y_i| \le \sum (|x_i| + |y_i|) = \lVert x \rVert_1 + \lVert y \rVert_1.
The triangle inequality for numbers, for each ii, then add over ii.
Max-norm (N1), (N2): ∥x∥∞≥0\lVert x \rVert_\infty \ge 0, with 00 iff x=Ox = O, and ∥cx∥∞=∣c∣ ∥x∥∞\lVert cx \rVert_\infty = |c|\,\lVert x \rVert_\infty.
A largest of non-negative numbers is 00 only if all of them are 00; and max⁡(∣c∣∣xi∣)=∣c∣max⁡∣xi∣\max (|c||x_i|) = |c| \max |x_i| because ∣c∣≥0|c| \ge 0.
Max-norm (N3): ∥x+y∥∞≤∥x∥∞+∥y∥∞\lVert x + y \rVert_\infty \le \lVert x \rVert_\infty + \lVert y \rVert_\infty.
For each ii: ∣xi+yi∣≤∣xi∣+∣yi∣≤∥x∥∞+∥y∥∞|x_i + y_i| \le |x_i| + |y_i| \le \lVert x \rVert_\infty + \lVert y \rVert_\infty. A number that bounds every ∣xi+yi∣|x_i + y_i| also bounds their maximum.
Sup norm (N1), (N2): ∥f∥∞≥0\lVert f \rVert_\infty \ge 0, with ∥f∥∞=0\lVert f \rVert_\infty = 0 iff f(t)=0f(t) = 0 for every tt, that is, f=Of = O; and ∥cf∥∞=∣c∣ ∥f∥∞\lVert cf \rVert_\infty = |c|\,\lVert f \rVert_\infty.
A maximum of non-negative numbers ∣f(t)∣|f(t)| is at least 00, and it is 00 only if every ∣f(t)∣=0|f(t)| = 0. For (N2), ∣cf(t)∣=∣c∣ ∣f(t)∣|cf(t)| = |c|\,|f(t)| for every tt and ∣c∣≥0|c| \ge 0, so the maximum scales by ∣c∣|c|.
Sup norm (N3): ∥f+g∥∞≤∥f∥∞+∥g∥∞\lVert f + g \rVert_\infty \le \lVert f \rVert_\infty + \lVert g \rVert_\infty. ■\blacksquare
Same argument as for the max-norm, with the point t∈[a,b]t \in [a, b] in place of the index ii: ∣f(t)+g(t)∣≤∣f(t)∣+∣g(t)∣≤∥f∥∞+∥g∥∞|f(t) + g(t)| \le |f(t)| + |g(t)| \le \lVert f \rVert_\infty + \lVert g \rVert_\infty for every tt, so the maximum of the left side obeys the same bound.

By the previous theorem each gives a metric: d1d_1, d2d_2, d∞d_\infty on Rn\mathbb R^n, and on C[a,b]C[a, b] the sup metric.

Definition B

Sup metric

The sup metric on C[a,b]C[a, b] is d∞(f,g)=∥f−g∥∞=max⁡a≤x≤b∣f(x)−g(x)∣d_\infty(f, g) = \lVert f - g \rVert_\infty = \max_{a \le x \le b} |f(x) - g(x)|. It is the largest vertical distance between the graphs of ff and gg.

In one lineOn C[a,b]C[a, b], d∞(f,g)=max⁡a≤x≤b∣f(x)−g(x)∣d_\infty(f, g) = \max_{a \le x \le b} |f(x) - g(x)|: the largest vertical gap between the graphs.

Why it existsTwo functions are close in this metric when one graph fits inside a thin tube around the other, which is exactly the picture of uniform convergence in 1.6.

Worked example
Find the distance between f(x)=xf(x) = x and g(x)=x2g(x) = x^2 on [0,1][0, 1] in the sup metric, and compare with the 2-distance.

Solution.

  1. Form the gap function. h(x)=∣f(x)−g(x)∣=x−x2h(x) = |f(x) - g(x)| = x - x^2 on [0,1][0, 1] (it is ≥0\ge 0 there since x2≤xx^2 \le x). The sup metric is the largest value of hh, so we maximize hh.
  2. Find the maximum. h′(x)=1−2x=0h'(x) = 1 - 2x = 0 at x=12x = \frac12, where h=12−14=14h = \frac12 - \frac14 = \frac14. At the endpoints h(0)=h(1)=0h(0) = h(1) = 0. A continuous function on [0,1][0, 1] attains its maximum at an endpoint or where the derivative is 00 (1.4).
  3. The sup distance. d∞(f,g)=14d_\infty(f, g) = \frac14. It is the height of the widest gap between the two graphs, at x=12x = \frac12.
  4. The 2-distance, for comparison. ∥f−g∥2=∫01(x−x2)2 dx=13−12+15=130≈0.183\lVert f - g \rVert_2 = \sqrt{\int_0^1 (x - x^2)^2\,dx} = \sqrt{\frac13 - \frac12 + \frac15} = \sqrt{\frac1{30}} \approx 0.183. This is the length of 2.9 for functions: it averages the squared gap over the interval, so a narrow spike counts for little. The sup metric counts the worst point only.

Answer. d∞(x,x2)=14d_\infty(x, x^2) = \frac14, and the 2-distance is 1/30≈0.183\sqrt{1/30} \approx 0.183. The two ways to measure functions give different numbers. On [0,1][0, 1] the 2-distance is never larger than the sup distance, but the sup distance cannot be bounded by a constant times the 2-distance, as the box on equivalent norms below shows. ■\blacksquare

Worked example
Find the 1-, 2- and ∞-distances between (1,−2,4)(1, -2, 4) and (3,1,−2)(3, 1, -2) in R3\mathbb R^3.

Solution.

  1. Subtract. x−y=(1−3, −2−1, 4−(−2))=(−2,−3,6)x - y = (1 - 3,\ -2 - 1,\ 4 - (-2)) = (-2, -3, 6). All three distances are the length of x−yx - y (the norm-to-metric theorem), so we compute the difference once.
  2. 1-distance. ∣−2∣+∣−3∣+∣6∣=2+3+6=11|-2| + |-3| + |6| = 2 + 3 + 6 = 11. Add the sizes of the entries.
  3. 2-distance. 4+9+36=49=7\sqrt{4 + 9 + 36} = \sqrt{49} = 7. The usual length: square, add, root.
  4. ∞-distance. max⁡(2,3,6)=6\max(2, 3, 6) = 6. Only the largest entry counts.

Answer. d1=11d_1 = 11, d2=7d_2 = 7, d∞=6d_\infty = 6. Note 6≤7≤116 \le 7 \le 11: the order d∞≤d2≤d1d_\infty \le d_2 \le d_1 is a theorem, proved below. ■\blacksquare

Your answerWhat is the 2-distance between (1,−2,4)(1, -2, 4) and (3,1,−2)(3, 1, -2) in R3\mathbb R^3?

Not every metric comes from a norm. The next two have no vectors to scale.

Definition B

Discrete metric

On any set XX, the discrete metric is d(x,y)=0d(x, y) = 0 when x=yx = y and d(x,y)=1d(x, y) = 1 when x≠yx \ne y.

In one lineOn any set XX: d(x,y)=0d(x, y) = 0 if x=yx = y and d(x,y)=1d(x, y) = 1 if x≠yx \ne y.

Why it existsIt is the extreme case where no two points are close, which makes it a test case for every definition: it shows what each idea means when nothing is near anything.

Definition B

Hamming distance

For two strings a=a1…ana = a_1 \dots a_n and b=b1…bnb = b_1 \dots b_n of bits (each 00 or 11), the Hamming distance dH(a,b)d_H(a, b) is the number of positions ii where ai≠bia_i \ne b_i. For example dH(10110,11100)=2d_H(10110, 11100) = 2: they differ in positions 22 and 44.

In one lineFor two bit strings of the same length, the number of positions where they differ.

Why it existsFlipping a bit is the basic error in a message, so the number of positions that differ counts how many errors turn one string into the other.

Theorem B Hamming 1950; standard

The discrete metric and the Hamming distance are metrics

(a) The discrete metric on a set XX is a metric. (b) The Hamming distance is a metric on the set of bit strings of length nn.

In one lineThe discrete metric on any set, and dHd_H on bit strings of length nn, satisfy (M1), (M2) and (M3).

Why it is trueFor both, a detour through a third point cannot make two different points closer, because the third point cannot agree with both.

Proofstandard
The idea: (M1) and (M2) are read off the definitions. For (M3) in both cases: if a and c differ somewhere, the middle point b cannot agree with both of them there, so b differs from a or from c at that place.
(a) (M1), (M2): immediate.
By definition d≥0d \ge 0 and d(x,y)=0d(x, y) = 0 exactly when x=yx = y. The definition does not mention the order of xx and yy.
(a) (M3), case x=zx = z: d(x,z)=0≤d(x,y)+d(y,z)d(x, z) = 0 \le d(x, y) + d(y, z).
If x=zx = z, the left side is 00, and the right side is non-negative.
(a) (M3), case x≠zx \ne z: d(x,z)=1≤d(x,y)+d(y,z)d(x, z) = 1 \le d(x, y) + d(y, z). ■\blacksquare
If yy were equal to both xx and zz, then x=y=zx = y = z, contradicting x≠zx \ne z. So y≠xy \ne x or y≠zy \ne z, and at least one term on the right is 11.
(b) (M1), (M2): immediate.
The count is a number of positions, so it is a whole number at least 00; it is 00 iff no position differs iff a=ba = b. 'Differs' is a symmetric relation.
(b) (M3): D(a,c)⊆D(a,b)∪D(b,c)D(a, c) \subseteq D(a, b) \cup D(b, c).
Let D(a,b)D(a, b) be the set of positions where aa and bb differ. If ai≠cia_i \ne c_i, then bib_i cannot equal both aia_i and cic_i, so i∈D(a,b)i \in D(a, b) or i∈D(b,c)i \in D(b, c).Where the idea comes from: this is the same 'cannot agree with both' as the discrete metric, now once per position.
So dH(a,c)=∣D(a,c)∣≤∣D(a,b)∣+∣D(b,c)∣=dH(a,b)+dH(b,c)d_H(a, c) = |D(a, c)| \le |D(a, b)| + |D(b, c)| = d_H(a, b) + d_H(b, c). ■\blacksquare
A set inside a union has at most as many elements as the union, and a union has at most as many elements as the sum of the sizes.

(If you read a bit string as a vector in Rn\mathbb R^n with entries 00 and 11, then dH(a,b)=∥a−b∥1d_H(a, b) = \lVert a - b \rVert_1. The 1-distance counts the same positions.)

Quick checkIs the discrete metric on R\mathbb R given by a norm, that is, is d(x,y)=∥x−y∥d(x, y) = \lVert x - y \rVert for some norm on R\mathbb R?

Open balls, open sets, closed sets

Definition T

Open ball

In a metric space, the open ball of radius r>0r > 0 about xx is B(x,r)={y∈X:d(x,y)<r}B(x, r) = \{y \in X : d(x, y) < r\}. (The strict inequality matters: the points at distance exactly rr are not in it.)

In one lineB(x,r)B(x, r) is the set of all points whose distance from xx is less than rr: the points strictly within rr of xx.

Why it existsThe ball is the unit of 'nearby'. Every later definition says that a ball around a point fits in, or touches, a set.

In R\mathbb R with ∣x−y∣|x - y|, B(x,r)B(x, r) is the interval (x−r,x+r)(x - r, x + r). In R2\mathbb R^2 with d2d_2 it is a disc without its rim, with d1d_1 a diamond without its edge, with d∞d_\infty a square without its edge. In the discrete metric, B(x,r)={x}B(x, r) = \{x\} when r≤1r \le 1 and B(x,r)=XB(x, r) = X when r>1r > 1. In Hamming distance the balls are sets of strings.

Worked example
List the open balls B(000,r)B(000, r) in the Hamming distance on bit strings of length 3, for r=1,2,3,4r = 1, 2, 3, 4.

Solution.

  1. Distances from 000000. dH(000,s)d_H(000, s) is the number of 11s in ss. 000000 differs from ss exactly where ss has a 11.
  2. Sort the 8 strings by distance. Distance 00: 000000. Distance 11: 100,010,001100, 010, 001. Distance 22: 110,101,011110, 101, 011. Distance 33: 111111. There are (3k)\binom3k strings with kk ones.
  3. Apply “strictly less than rr”. r=1r = 1: distance <1< 1, so only 000000. r=2r = 2: distance ≤1\le 1, so 000,100,010,001000, 100, 010, 001. r=3r = 3: distance ≤2\le 2, so 7 strings (all but 111111). r=4r = 4: all 8 strings.

Answer. B(000,1)={000}B(000, 1) = \{000\}, B(000,2)B(000, 2) has 4 strings, B(000,3)B(000, 3) has 7, B(000,4)B(000, 4) has 8. ■\blacksquare

Your answerIn Hamming distance on bit strings of length 5, how many strings lie in the open ball B(00000,3)B(00000, 3)? (That is, how many have distance less than 3 from 0000000000.)
Quick checkIn the discrete metric on a set XX with more than one point, what is the open ball B(x,1)B(x, 1)?
Definition T

Open set

A subset UU of a metric space XX is open if for every x∈Ux \in U there is an r>0r > 0 with B(x,r)⊆UB(x, r) \subseteq U. In symbols, ∀x∈U ∃r>0: B(x,r)⊆U\forall x \in U\ \exists r > 0:\ B(x, r) \subseteq U. The radius rr may depend on xx.

In one lineA set UU is open if every point of UU has an open ball around it that lies completely inside UU.

Why it existsOpen sets are the sets with no edge in them: every point has room to move in every direction while staying in the set. This is where derivatives, and also limits, make sense.

Definition T

Closed set

A subset FF of a metric space XX is closed if X∖FX \setminus F is open. (Here X∖FX \setminus F is the complement of FF in XX, the points of XX not in FF.)

In one lineA set is closed if its complement is open.

Why it existsClosed sets are the sets that contain their own edge, so a sequence inside one cannot escape through the edge. 4.2 turns this into the statement that limits of sequences in a closed set stay in it.

Proposition T Rudin Thm 2.19; Abbott Sec. 3.2

Open balls are open

For every xx in a metric space and every r>0r > 0, the ball B(x,r)B(x, r) is open.

In one lineEvery open ball B(x,r)B(x, r) is an open set.

Why it is trueA point of the ball at distance dd from the centre has a gap r−dr - d to the rim, and a small ball of that radius fits inside, by the triangle inequality.

ProofRudin 2.19
The idea: Take a point y in the ball. The distance from y to the rim of the ball is r − d(x, y), which is positive. A ball around y of that radius stays inside, because going from x to a point of it by way of y cannot exceed d(x, y) plus that radius.
Let y∈B(x,r)y \in B(x, r), so d(x,y)<rd(x, y) < r.
We must give every point of the ball a smaller ball that fits inside it. So start with an arbitrary point.
Let s=r−d(x,y)>0s = r - d(x, y) > 0.
This is positive because d(x,y)<rd(x, y) < r. It is the room between yy and the rim.The idea: measure how far y is from the edge.
Let z∈B(y,s)z \in B(y, s), so d(y,z)<sd(y, z) < s.
Take any zz in the small ball.
d(x,z)≤d(x,y)+d(y,z)<d(x,y)+s=rd(x, z) \le d(x, y) + d(y, z) < d(x, y) + s = r.
Triangle inequality (M3) through yy, then the choice of ss.
So B(y,s)⊆B(x,r)B(y, s) \subseteq B(x, r), and yy has a ball inside B(x,r)B(x, r). Since yy was arbitrary, B(x,r)B(x, r) is open. ■\blacksquare
That says z∈B(x,r)z \in B(x, r). Every zz in the small ball is in the big ball.

In the picture: the ball is a disc, the point yy is somewhere inside it, and the small ball around yy is a disc that touches the rim of the big one from inside when s=r−d(x,y)s = r - d(x, y). In the visualizer this is the diamond, disc or square: pick any point inside, and the shorter distance to the edge is the radius you may use.

Proof workshopRebuild the proof that open balls are open

Tap the lines in the order a proof would write them. Each line can only use what is already above it.

    Worked example
    Show that (0,1)(0, 1) is open in R\mathbb R, that [0,1][0, 1] is closed, and that [0,1)[0, 1) is neither.

    Solution.

    1. (0,1)(0, 1) is open. Take x∈(0,1)x \in (0, 1) and let r=min⁡(x,1−x)>0r = \min(x, 1 - x) > 0. Then B(x,r)=(x−r,x+r)⊆(0,1)B(x, r) = (x - r, x + r) \subseteq (0, 1), because x−r≥0x - r \ge 0 and x+r≤1x + r \le 1. The radius is the smaller of the distances to the two ends. It depends on xx: near 00 or 11 it must be tiny.
    2. [0,1][0, 1] is closed. Its complement is (−∞,0)∪(1,∞)(-\infty, 0) \cup (1, \infty). For x<0x < 0 the ball B(x,−x)B(x, -x) stays below 00; for x>1x > 1 the ball B(x,x−1)B(x, x - 1) stays above 11. So the complement is open. Closed means the complement is open, so we check the complement with the same radius trick.
    3. [0,1)[0, 1) is not open. The point 00 belongs to it, but every ball B(0,r)=(−r,r)B(0, r) = (-r, r) contains negative numbers, which are not in [0,1)[0, 1). A single point of the set with no ball inside it is enough to show a set is not open. This is the negation of the definition.
    4. [0,1)[0, 1) is not closed. Its complement (−∞,0)∪[1,∞)(-\infty, 0) \cup [1, \infty) contains 11, and every ball B(1,r)=(1−r,1+r)B(1, r) = (1 - r, 1 + r) contains numbers less than 11 that are in [0,1)[0, 1), so not in the complement. So the complement is not open. Each end of the interval is “missing” on one side, and that spoils one of the two tests.

    Answer. (0,1)(0, 1) is open and not closed. [0,1][0, 1] is closed and not open. [0,1)[0, 1) is neither. A set can be neither open nor closed, so “closed” does not mean “not open”. ■\blacksquare

    Worked example MATH 375 Piazza, Nov 23
    Classify as open, closed, both or neither in R\mathbb R: ∅\varnothing, R\mathbb R, {0}\{0\}, N\mathbb N, Q\mathbb Q.

    Solution.

    1. ∅\varnothing and R\mathbb R are both. ∅\varnothing is open because there is no point to test, so the condition “for every point of the set” holds with nothing to check. R\mathbb R is open because every ball is inside it. Each is the complement of the other, so each is also closed. A statement “for every x∈∅x \in \varnothing” is true (0.1). These are the only two subsets of R\mathbb R that are both open and closed. That fact is called the connectedness of R\mathbb R, and we do not prove it here.
    2. {0}\{0\} is closed, not open. Its complement is (−∞,0)∪(0,∞)(-\infty, 0) \cup (0, \infty), which is open (each point has a ball avoiding 00: radius ∣x∣|x|). But every ball (−r,r)(-r, r) around 00 contains points other than 00. One point is closed in every metric space (a problem below), but in R\mathbb R it is not open.
    3. N\mathbb N is closed, not open. Here N={1,2,3,… }\mathbb N = \{1, 2, 3, \dots\}. Take a real number yy not in N\mathbb N. If y<1y < 1, the ball B(y,1−y)B(y, 1 - y) stays below 11. If y>1y > 1, then k<y<k+1k < y < k + 1 for some natural number kk (the naturals are spaced 11 apart), and the ball B(y,r)B(y, r) with r=min⁡(y−k, k+1−y)>0r = \min(y - k,\ k + 1 - y) > 0 lies strictly between kk and k+1k + 1, so it contains no natural number. So the complement of N\mathbb N is open. Each point outside has a positive gap to the nearest natural number on each side, and the smaller gap is a safe radius. And N\mathbb N is not open: every ball around 11 contains non-integers.
    4. Q\mathbb Q is neither. Every ball (q−r,q+r)(q - r, q + r) contains an irrational number (for example q+2nq + \frac{\sqrt2}{n} with nn large enough that 2n<r\frac{\sqrt2}n < r, by the Archimedean property; it is irrational because if it were a rational pp, then 2=n(p−q)\sqrt 2 = n(p - q) would be rational), so Q\mathbb Q is not open. Every ball around an irrational contains a rational (density, 1.1), so the complement is not open, and Q\mathbb Q is not closed. The rationals and irrationals are tangled together at every scale.

    Answer. ∅\varnothing, R\mathbb R: both. {0}\{0\}, N\mathbb N: closed only. Q\mathbb Q: neither. ■\blacksquare

    Worked example
    In the discrete metric, every subset is open, and so every subset is closed.

    Solution.

    1. Pick any set UU and a point x∈Ux \in U. Take r=12r = \frac12. Any radius at most 11 will do in the discrete metric.
    2. The ball is a single point. B(x,12)={x}⊆UB(x, \frac12) = \{x\} \subseteq U. Only xx has distance less than 11 from xx.
    3. So UU is open. The complement X∖UX \setminus U is also a subset of XX, so by the same argument it is open; hence UU is closed. Closed means the complement is open, and the complement is another subset of XX, to which the argument we just made applies.

    Answer. In the discrete metric every set is both open and closed. This is why it is a good test case: it shows how much the words depend on the metric. ■\blacksquare

    Unions and intersections

    Theorem T Abbott Sec. 3.2; Apostol 8.3 #5; Rudin Thm 2.24

    Unions and finite intersections of open sets

    In a metric space XX: (a) ∅\varnothing and XX are open. (b) If UαU_\alpha is open for every α\alpha in some collection (finite or infinite), then ⋃αUα\bigcup_\alpha U_\alpha is open. (c) If U1,…,UmU_1, \dots, U_m are open, then U1∩⋯∩UmU_1 \cap \dots \cap U_m is open.

    In one line∅\varnothing and XX are open; any union of open sets is open; the intersection of finitely many open sets is open.

    Why it is trueFor a union, a point sits in one of the sets and uses its ball. For a finite intersection, take the smallest of finitely many radii, which is still positive. With infinitely many radii the smallest could be zero.

    ProofAbbott Sec. 3.2
    The idea: (b): a point of the union lies in one U_α, whose ball is also inside the union. (c): a point of the intersection lies in each U_i with its own radius r_i; the smallest r_i works for all of them at once, and a smallest of finitely many positive numbers is positive.
    (a) ∅\varnothing and XX are open.
    For ∅\varnothing there is no point to check. For XX, any ball is a subset of XX.
    (b) Let x∈⋃Uαx \in \bigcup U_\alpha. Then x∈Uβx \in U_\beta for some β\beta.
    Choose the set in the collection that contains xx.
    There is r>0r > 0 with B(x,r)⊆Uβ⊆⋃αUαB(x, r) \subseteq U_\beta \subseteq \bigcup_\alpha U_\alpha. So the union is open.
    UβU_\beta is open, and Uβ⊆⋃UαU_\beta \subseteq \bigcup U_\alpha.
    (c) Let x∈U1∩⋯∩Umx \in U_1 \cap \dots \cap U_m. For each ii there is ri>0r_i > 0 with B(x,ri)⊆UiB(x, r_i) \subseteq U_i.
    Each UiU_i is open and contains xx, so it gives its own radius.The radius is allowed to differ for each set; that is why we need a minimum.
    Let r=min⁡(r1,…,rm)>0r = \min(r_1, \dots, r_m) > 0.
    A minimum of FINITELY many positive numbers is one of them, so it is positive. With infinitely many it could be 00 (or not exist).
    B(x,r)⊆B(x,ri)⊆UiB(x, r) \subseteq B(x, r_i) \subseteq U_i for every ii, so B(x,r)⊆U1∩⋯∩UmB(x, r) \subseteq U_1 \cap \dots \cap U_m. ■\blacksquare
    A ball of radius r≤rir \le r_i is inside the ball of radius rir_i.
    Worked example MATH 375 HW 11 (Apostol 8.3 #5)
    Show that an infinite intersection of open sets need not be open: ⋂n=1∞(0,1+1n)=(0,1]\bigcap_{n=1}^\infty (0, 1 + \tfrac1n) = (0, 1].

    Solution.

    1. Each set is open. (0,1+1n)(0, 1 + \frac1n) is an open interval. An open interval is an open ball in R\mathbb R.
    2. Which numbers lie in all of them? If 0<x≤10 < x \le 1, then x<1+1nx < 1 + \frac1n for every nn, so xx is in every set. If x>1x > 1, pick nn with 1n<x−1\frac1n < x - 1 (Archimedean property); then x>1+1nx > 1 + \frac1n, so xx is missing from the nn-th set. Numbers ≤0\le 0 are in none. An element of the intersection must pass every test, so one failing set removes it.
    3. The intersection is (0,1](0, 1], which is not open. The point 11 is in it, but every ball (1−r,1+r)(1 - r, 1 + r) contains numbers above 11. The minimum trick fails: the radii that fit around 11 in the nn-th set are 1n\frac1n, and min⁡\min of infinitely many of those is 00.

    Answer. The intersection is (0,1](0, 1], not open. The word “finite” in part (c) cannot be dropped. ■\blacksquare

    Taking complements turns this theorem into one about closed sets. By De Morgan’s laws (0.3), X∖⋂Fα=⋃(X∖Fα)X \setminus \bigcap F_\alpha = \bigcup (X \setminus F_\alpha) and X∖(F1∪⋯∪Fm)=⋂(X∖Fi)X \setminus (F_1 \cup \dots \cup F_m) = \bigcap (X \setminus F_i).

    Corollary T Abbott Sec. 3.2; Rudin Thm 2.24

    Intersections and finite unions of closed sets

    In a metric space: (a) ∅\varnothing and XX are closed. (b) Any intersection of closed sets is closed. (c) A union of finitely many closed sets is closed.

    In one line∅\varnothing and XX are closed; any intersection of closed sets is closed; the union of finitely many closed sets is closed.

    Why it is trueTake complements of the open-set theorem: De Morgan swaps unions with intersections.

    ProofAbbott Sec. 3.2
    The idea: Apply the previous theorem to the complements, and use De Morgan's laws to move complements across unions and intersections.
    (a) The complements of ∅\varnothing and XX are XX and ∅\varnothing, which are open.
    ∅=X∖X\varnothing = X \setminus X and X=X∖∅X = X \setminus \varnothing, and both XX and ∅\varnothing are open.
    (b) X∖⋂Fα=⋃(X∖Fα)X \setminus \bigcap F_\alpha = \bigcup (X \setminus F_\alpha) is open, so ⋂Fα\bigcap F_\alpha is closed.
    De Morgan: the complement of an intersection is the union of the complements. Each complement X∖FαX \setminus F_\alpha is open, and a union of open sets is open.
    (c) X∖(F1∪⋯∪Fm)=⋂(X∖Fi)X \setminus (F_1 \cup \dots \cup F_m) = \bigcap (X \setminus F_i) is open, so the finite union is closed. ■\blacksquare
    De Morgan: the complement of a union is the intersection of the complements, and a FINITE intersection of open sets is open.

    The word “finite” cannot be dropped here either: ⋃n=2∞[1n,1]=(0,1]\bigcup_{n=2}^\infty [\frac1n, 1] = (0, 1], an infinite union of closed intervals that is not closed (its complement contains 00 but no ball around 00 stays out of (0,1](0, 1]).

    Quick checkWhich statement is correct?

    Interior, limit points, closure, boundary

    Take a set AA and zoom in on a point xx of the space. A small ball around xx can do one of three things, and each gives a word.

    Definition T

    Interior

    A point x∈Ax \in A is an interior point of AA if some ball B(x,r)B(x, r) lies inside AA. The interior of AA, written int⁡A\operatorname{int} A, is the set of its interior points.

    In one lineThe interior of AA is the set of points of AA that have a ball around them inside AA.

    Why it existsIt strips off the edge of AA and keeps the part where you could wiggle in any direction without leaving AA.

    Definition B

    Limit point

    A point xx of the space (in AA or not) is a limit point of AA if for every r>0r > 0 the ball B(x,r)B(x, r) contains a point of AA different from xx. A point of AA that is not a limit point of AA is isolated: some ball around it contains no other point of AA.

    In one linexx is a limit point of AA if every ball around xx contains a point of AA other than xx itself.

    Why it existsIt describes the points that AA crowds around. A limit point need not belong to AA, and a point of AA need not be a limit point.

    Definition B

    Closure

    The closure of AA, written A‾\overline A, is the set of points xx such that B(x,r)B(x, r) contains a point of AA for every r>0r > 0.

    In one lineThe closure of AA is every point whose every ball touches AA: the set AA together with its edge.

    Why it existsIt adds to AA the points it can be approached from, so it is the smallest closed set around AA.

    Definition T

    Boundary

    The boundary of AA, written ∂A\partial A, is the set of points xx such that every ball B(x,r)B(x, r) contains a point of AA and a point of X∖AX \setminus A.

    In one lineThe boundary of AA is every point whose every ball touches both AA and the complement of AA: the edge of AA.

    Why it existsIt is where AA stops. It separates the inside of AA from the outside, and for a closed set it is the part that makes the set closed.

    Zoom in on xx. Either some ball around xx lies inside AA (then xx is in the interior of AA), or some ball around xx lies inside the complement of AA (then xx is outside the closure), or every ball around xx contains points of both AA and its complement (then xx is on the boundary). Exactly one of the three happens.

    Theorem B Rudin Thm 2.27; Abbott Sec. 3.2; Apostol Sec. 8.2

    Interior, closure and boundary

    For a subset AA of a metric space XX:

    (a) int⁡A\operatorname{int} A is open, it is the largest open set contained in AA, and AA is open iff A=int⁡AA = \operatorname{int} A.

    (b) X∖A‾=int⁡(X∖A)X \setminus \overline A = \operatorname{int}(X \setminus A). Hence A‾\overline A is closed, it is the smallest closed set containing AA, and AA is closed iff A=A‾A = \overline A.

    (c) A‾=A∪{limit points of A}\overline A = A \cup \{\text{limit points of } A\}.

    (d) ∂A=A‾∖int⁡A\partial A = \overline A \setminus \operatorname{int} A.

    In one lineint⁡A\operatorname{int} A is the largest open set inside AA; A‾\overline A is the smallest closed set containing AA and equals AA together with its limit points; ∂A=A‾∖int⁡A\partial A = \overline A \setminus \operatorname{int} A.

    Why it is trueA point is outside the closure exactly when some ball misses AA, that is, when some ball lies inside the complement. So closure and interior of the complement are complements of each other.

    ProofRudin 2.27
    The idea: Everything comes from one fact: a point is outside the closure iff some ball misses A iff some ball lies inside the complement. Open balls are open (the previous proposition) gives (a); (b), (c), (d) are rewordings of the definitions.
    (a) If x∈int⁡Ax \in \operatorname{int} A with B(x,r)⊆AB(x, r) \subseteq A, then every y∈B(x,r)y \in B(x, r) is also an interior point of AA. So B(x,r)⊆int⁡AB(x, r) \subseteq \operatorname{int} A and int⁡A\operatorname{int} A is open.
    Open balls are open (proved above): every yy in B(x,r)B(x, r) has a ball around it inside B(x,r)⊆AB(x, r) \subseteq A.
    If UU is open and U⊆AU \subseteq A, then U⊆int⁡AU \subseteq \operatorname{int} A: that is why int⁡A\operatorname{int} A is the largest. And AA is open iff all its points are interior iff A=int⁡AA = \operatorname{int} A.
    If U⊆AU \subseteq A is open, each of its points has a ball inside U⊆AU \subseteq A, so it is an interior point of AA.
    (b) x∉A‾  ⟺  ∃r: B(x,r)∩A=∅  ⟺  x∈int⁡(X∖A)x \notin \overline A \iff \exists r:\ B(x, r) \cap A = \varnothing \iff x \in \operatorname{int}(X \setminus A). So X∖A‾=int⁡(X∖A)X \setminus \overline A = \operatorname{int}(X \setminus A).
    x∉A‾x \notin \overline A means: some ball B(x,r)B(x, r) contains no point of AA. That is the same as B(x,r)⊆X∖AB(x, r) \subseteq X \setminus A, which is the definition of x∈int⁡(X∖A)x \in \operatorname{int}(X \setminus A) (the point xx is automatically in X∖AX \setminus A, since it is in its own ball).
    So A‾\overline A is closed and is inside every closed set containing AA. If AA is closed it is one of those sets, so A‾⊆A\overline A \subseteq A; also A⊆A‾A \subseteq \overline A (a point of AA is in every one of its balls). Hence AA is closed iff A=A‾A = \overline A.
    By (a), int⁡(X∖A)\operatorname{int}(X \setminus A) is open, so its complement A‾\overline A is closed. If FF is closed and contains AA, then X∖FX \setminus F is open and inside X∖AX \setminus A, so inside int⁡(X∖A)=X∖A‾\operatorname{int}(X \setminus A) = X \setminus \overline A. Taking complements, A‾⊆F\overline A \subseteq F.
    (c) A∪{limit points}⊆A‾A \cup \{\text{limit points}\} \subseteq \overline A.
    A point x∈Ax \in A is in A‾\overline A because xx itself is in every ball around xx. A limit point has a point of AA in every ball, so it is in A‾\overline A.
    Conversely, if x∈A‾x \in \overline A, then x∈Ax \in A or xx is a limit point of AA.
    If x∈A‾x \in \overline A and x∉Ax \notin A, every ball around xx contains a point of AA, and that point cannot be xx because x∉Ax \notin A. So xx is a limit point.
    (d) x∈A‾∖int⁡Ax \in \overline A \setminus \operatorname{int} A iff every ball meets AA and every ball meets X∖AX \setminus A, which is the definition of x∈∂Ax \in \partial A. ■\blacksquare
    x∈A‾x \in \overline A says every ball meets AA. x∉int⁡Ax \notin \operatorname{int} A says no ball lies inside AA, that is, every ball contains a point outside AA (this holds also for x∉Ax \notin A, since then xx itself is outside AA and in every ball).

    In the picture: the interior is the part of AA with room all around, the closure adds the edge it touches, and the boundary is the strip between them, the points where every small disc shows both the inside and the outside of AA.

    Worked example
    Find the interior, limit points, closure and boundary of A=(0,1]∪{2}A = (0, 1] \cup \{2\} in R\mathbb R.

    Solution.

    1. Interior. Each point of (0,1)(0, 1) has a ball inside AA (shrink toward the nearer end). The point 11 does not: every ball (1−r,1+r)(1 - r, 1 + r) contains numbers above 11. The point 22 does not: every ball around it contains other numbers. So int⁡A=(0,1)\operatorname{int} A = (0, 1). The interior throws out every point of AA that sits on an edge or alone.
    2. Limit points. Every point of [0,1][0, 1] is a limit point: every ball around it contains other points of (0,1](0, 1]. The point 00 qualifies although 0∉A0 \notin A. The point 22 is not: B(2,12)B(2, \frac12) contains no other point of AA, so 22 is isolated. No other number is a limit point. A limit point needs other points of AA crowding around it.
    3. Closure. A‾=A∪{limit points}=[0,1]∪{2}\overline A = A \cup \{\text{limit points}\} = [0, 1] \cup \{2\} (by part (c) of the theorem). Add the missing edge 00 and keep the isolated point 22.
    4. Boundary. ∂A=A‾∖int⁡A={0,1,2}\partial A = \overline A \setminus \operatorname{int} A = \{0, 1, 2\}. Part (d). The three edge points are the places where a small ball sees both AA and the outside.

    Answer. int⁡A=(0,1)\operatorname{int} A = (0, 1); limit points [0,1][0, 1]; A‾=[0,1]∪{2}\overline A = [0, 1] \cup \{2\}; ∂A={0,1,2}\partial A = \{0, 1, 2\}. Note that 2∈∂A2 \in \partial A though it is an isolated point of AA. ■\blacksquare

    Quick checkLet A={1,12,13,14,… }A = \{1, \frac12, \frac13, \frac14, \dots\} in R\mathbb R. Which points are limit points of AA?
    Theorem B Abbott Sec. 3.2; Rudin ch. 2

    A closed set contains its limit points

    A subset AA of a metric space is closed if and only if it contains all of its limit points.

    In one lineA set AA is closed if and only if every limit point of AA belongs to AA.

    Why it is trueA limit point outside AA would be a point of the complement with no room, so the complement would not be open; conversely, a point of the complement that is not a limit point has a ball that misses AA.

    ProofAbbott Sec. 3.2
    The idea: (⇒) Contrapositive-style: if a limit point x were outside a closed A, the open complement would have a ball around x missing A, contradicting that x is a limit point. (⇐) A point of the complement is not a limit point, so some ball around it has no point of A other than possibly itself, and it is not in A, so the ball misses A.
    (⇒) Let AA be closed, let xx be a limit point of AA, and suppose x∉Ax \notin A.
    Closed means the complement X∖AX \setminus A is open.
    There is r>0r > 0 with B(x,r)⊆X∖AB(x, r) \subseteq X \setminus A, so B(x,r)B(x, r) contains no point of AA.
    Then x∈X∖Ax \in X \setminus A, which is open, so xx has a ball inside it.
    Contradiction, so x∈Ax \in A.
    This contradicts the definition of a limit point: every ball around xx must contain a point of AA.
    (⇐) Suppose AA contains all its limit points, and let x∈X∖Ax \in X \setminus A.
    To show AA is closed we show that X∖AX \setminus A is open: take an arbitrary point of it.
    So xx is not a limit point of AA: some ball B(x,r)B(x, r) contains no point of AA other than xx.
    If xx were a limit point of AA it would be in AA by assumption, but x∉Ax \notin A.
    Hence B(x,r)∩A=∅B(x, r) \cap A = \varnothing, that is, B(x,r)⊆X∖AB(x, r) \subseteq X \setminus A. So X∖AX \setminus A is open and AA is closed. ■\blacksquare
    x∉Ax \notin A, so xx is not a point of AA either.
    Proof workshopRebuild the proof that a closed set contains its limit points (the forward direction)

    Each line of the proof is shown in order. Choose the reason that justifies it, then press Check.

    1. Let AA be closed and let xx be a limit point of AA. Suppose, for contradiction, that x∉Ax \notin A.
    2. Then xx lies in the complement X∖AX \setminus A.
    3. There is r>0r > 0 with B(x,r)⊆X∖AB(x, r) \subseteq X \setminus A.
    4. So B(x,r)B(x, r) contains no point of AA.
    5. This contradicts that xx is a limit point, so x∈Ax \in A.

    Equivalent norms: do the three distances agree?

    The picture showed three shapes of ball. Do they define the same open sets? We compare the lengths with two-sided inequalities.

    Definition B

    Equivalent norms

    Two norms ∥⋅∥a\lVert \cdot \rVert_a and ∥⋅∥b\lVert \cdot \rVert_b on a vector space VV are equivalent if there are constants 0<m≤M0 < m \le M with

    m ∥x∥a≤∥x∥b≤M ∥x∥afor all x∈V.m\,\lVert x \rVert_a \le \lVert x \rVert_b \le M\,\lVert x \rVert_a \qquad \text{for all } x \in V.

    In one lineTwo norms on the same vector space are equivalent if each is at most a constant multiple of the other.

    Why it existsIt is the precise condition under which two lengths measure 'close' in the same way, even though they give different numbers.

    Theorem B Abbott Sec. 3.1 exercises; standard

    Comparing the 1-, 2- and max-norms

    For every x∈Rnx \in \mathbb R^n,

    ∥x∥∞≤∥x∥2≤∥x∥1≤n ∥x∥2≤n ∥x∥∞.\lVert x \rVert_\infty \le \lVert x \rVert_2 \le \lVert x \rVert_1 \le \sqrt n\,\lVert x \rVert_2 \le n\,\lVert x \rVert_\infty.

    So the three norms are equivalent, with constants depending only on nn.

    In one lineFor every x∈Rnx \in \mathbb R^n: ∥x∥∞≤∥x∥2≤∥x∥1≤n ∥x∥2≤n ∥x∥∞\lVert x \rVert_\infty \le \lVert x \rVert_2 \le \lVert x \rVert_1 \le \sqrt n\,\lVert x \rVert_2 \le n\,\lVert x \rVert_\infty.

    Why it is trueThe largest term is one of the terms of the sum of squares; squaring the 1-norm adds cross terms to the sum of squares; Cauchy–Schwarz against the vector of ones gives the factor n\sqrt n; and every term is at most the largest.

    Proofstandard
    The idea: Four small inequalities, one per link in the chain: bound a term by a sum, expand a square, use Cauchy–Schwarz with the all-ones vector, and bound every term by the largest.
    (1) ∥x∥∞2=xi2≤x12+⋯+xn2=∥x∥22\lVert x \rVert_\infty^2 = x_i^2 \le x_1^2 + \dots + x_n^2 = \lVert x \rVert_2^2. Take square roots.
    The largest of the ∣xj∣|x_j| is one of them, call it ∣xi∣|x_i|. Its square is one term of the sum of squares, and the other terms are ≥0\ge 0.
    (2) ∥x∥12=∑jxj2+2∑j<k∣xj∣∣xk∣≥∑jxj2=∥x∥22\lVert x \rVert_1^2 = \sum_j x_j^2 + 2\sum_{j<k} |x_j||x_k| \ge \sum_j x_j^2 = \lVert x \rVert_2^2. Take square roots.
    Expand (∣x1∣+⋯+∣xn∣)2(|x_1| + \dots + |x_n|)^2: the squares xj2x_j^2, plus the cross terms 2∣xj∣∣xk∣2|x_j||x_k| for j<kj < k, which are ≥0\ge 0.
    (3) ∥x∥1=u⋅v≤∥u∥2 ∥v∥2=n ∥x∥2\lVert x \rVert_1 = u \cdot v \le \lVert u \rVert_2\,\lVert v \rVert_2 = \sqrt n\,\lVert x \rVert_2.
    Cauchy–Schwarz (2.9) for u=(∣x1∣,…,∣xn∣)u = (|x_1|, \dots, |x_n|) and v=(1,…,1)v = (1, \dots, 1). We have ∥u∥2=∥x∥2\lVert u \rVert_2 = \lVert x \rVert_2 and ∥v∥2=n\lVert v \rVert_2 = \sqrt n.Where the idea comes from: a sum of n numbers is the dot product with the all-ones vector.
    (4) ∥x∥22≤n ∥x∥∞2\lVert x \rVert_2^2 \le n\,\lVert x \rVert_\infty^2, so ∥x∥2≤n ∥x∥∞\lVert x \rVert_2 \le \sqrt n\,\lVert x \rVert_\infty and n ∥x∥2≤n ∥x∥∞\sqrt n\,\lVert x \rVert_2 \le n\,\lVert x \rVert_\infty. ■\blacksquare
    Each xj2≤∥x∥∞2x_j^2 \le \lVert x \rVert_\infty^2, and there are nn terms.
    Worked example
    Check the chain of inequalities for x=(3,−4,12)x = (3, -4, 12) in R3\mathbb R^3, and find vectors where the ends of the chain are attained.

    Solution.

    1. Compute the three norms. ∥x∥1=3+4+12=19\lVert x \rVert_1 = 3 + 4 + 12 = 19, ∥x∥2=9+16+144=169=13\lVert x \rVert_2 = \sqrt{9 + 16 + 144} = \sqrt{169} = 13, ∥x∥∞=12\lVert x \rVert_\infty = 12. Add the sizes, root of the sum of squares, largest size.
    2. The other two links. n ∥x∥2=3⋅13≈22.5\sqrt n\,\lVert x \rVert_2 = \sqrt3 \cdot 13 \approx 22.5 and n ∥x∥∞=3⋅12=36n\,\lVert x \rVert_\infty = 3 \cdot 12 = 36. The chain needs n∥x∥2\sqrt n \lVert x \rVert_2 and n∥x∥∞n \lVert x \rVert_\infty as well.
    3. Check the chain. 12≤13≤19≤22.5≤3612 \le 13 \le 19 \le 22.5 \le 36. Every link holds.
    4. Where the chain is tight. For x=(1,0,0)x = (1, 0, 0) all three norms are 11, so the left links are equalities. For x=(1,1,1)x = (1, 1, 1): ∥x∥∞=1\lVert x \rVert_\infty = 1, ∥x∥2=3\lVert x \rVert_2 = \sqrt3, ∥x∥1=3=3⋅3=n⋅1\lVert x \rVert_1 = 3 = \sqrt3 \cdot \sqrt3 = n \cdot 1, so the right links are equalities. The constants n\sqrt n and nn cannot be improved. They are largest for vectors with all entries equal, and the gap grows with the dimension.

    Answer. 12≤13≤19≤22.5≤3612 \le 13 \le 19 \le 22.5 \le 36, with both ends of the chain attained by suitable vectors. ■\blacksquare

    Your answerFor x=(3,−4,12)x = (3, -4, 12), what is ∥x∥2\lVert x \rVert_2?
    Worked example
    In R2\mathbb R^2, which of the points (0.8,0.5)(0.8, 0.5) and (0.5,0.5)(0.5, 0.5) lie in the open unit ball for d1d_1, d2d_2 and d∞d_\infty? What is the area of each ball?

    Solution.

    1. Compute the three distances from the origin. For (0.8,0.5)(0.8, 0.5): d1=1.3d_1 = 1.3, d2=0.64+0.25=0.89≈0.943d_2 = \sqrt{0.64 + 0.25} = \sqrt{0.89} \approx 0.943, d∞=0.8d_\infty = 0.8. For (0.5,0.5)(0.5, 0.5): d1=1d_1 = 1, d2=0.5≈0.707d_2 = \sqrt{0.5} \approx 0.707, d∞=0.5d_\infty = 0.5. The ball of radius 11 about the origin is every point whose distance is below 11, so we need the distance in each rule.
    2. Compare with the radius, strictly. (0.8,0.5)(0.8, 0.5) is in the disc and the square, not in the diamond. (0.5,0.5)(0.5, 0.5) is in the disc and the square, and it is NOT in the diamond, because d1=1d_1 = 1 is not less than 11: it sits on the edge. The open ball uses strict inequality, so the edge is left out.
    3. Areas. The square (−1,1)2(-1, 1)^2 has area 2×2=42 \times 2 = 4. The disc has area π≈3.14\pi \approx 3.14. The diamond has vertices (±1,0)(\pm 1, 0), (0,±1)(0, \pm 1): it is two triangles of base 22 and height 11, area 2⋅12⋅2⋅1=22 \cdot \frac12 \cdot 2 \cdot 1 = 2. Diamond, disc and square nest, so the areas must increase: 2≤π≤42 \le \pi \le 4.

    Answer. Both points are in the disc and the square, neither is in the diamond. The areas are 22, π\pi and 44. ■\blacksquare

    What the chain says about the balls: if ∥y∥1<r\lVert y \rVert_1 < r then ∥y∥2<r\lVert y \rVert_2 < r, and then ∥y∥∞<r\lVert y \rVert_\infty < r. In balls, around any centre,

    B1(x,r)⊆B2(x,r)⊆B∞(x,r)⊆B1(x,nr).B_1(x, r) \subseteq B_2(x, r) \subseteq B_\infty(x, r) \subseteq B_1(x, nr).

    The last inclusion uses ∥y∥1≤n ∥y∥∞\lVert y \rVert_1 \le n\,\lVert y \rVert_\infty. In the plane, a diamond of radius rr is inside the disc of radius rr, which is inside the square of radius rr, which is inside the diamond of radius 2r2r. That is the nesting you saw in the visualizer.

    Theorem B standard

    Equivalent norms give the same open sets

    Let ∥⋅∥a\lVert \cdot \rVert_a and ∥⋅∥b\lVert \cdot \rVert_b be norms on VV with m ∥x∥a≤∥x∥b≤M ∥x∥am\,\lVert x \rVert_a \le \lVert x \rVert_b \le M\,\lVert x \rVert_a. Then a set U⊆VU \subseteq V is open for the metric dad_a if and only if it is open for dbd_b.

    In one lineIf two norms on VV are equivalent, a set is open for one iff it is open for the other, so they also have the same closed sets, interiors, closures and boundaries.

    Why it is trueA ball for one norm contains a smaller ball for the other, with the radius changed by the constants mm and MM.

    Proofstandard
    The idea: Show that every a-ball contains a b-ball with the same centre and the other way round. Then a ball inside U for one norm gives a ball inside U for the other.
    Let UU be open for dad_a and x∈Ux \in U, so Ba(x,r)⊆UB_a(x, r) \subseteq U for some r>0r > 0.
    Write BaB_a and BbB_b for balls in the two metrics. We show Bb(x,mr)⊆Ba(x,r)B_b(x, mr) \subseteq B_a(x, r).
    If ∥y−x∥b<mr\lVert y - x \rVert_b < mr, then m ∥y−x∥a≤∥y−x∥b<mrm\,\lVert y - x \rVert_a \le \lVert y - x \rVert_b < mr, so ∥y−x∥a<r\lVert y - x \rVert_a < r.
    From m ∥y−x∥a≤∥y−x∥bm\,\lVert y - x \rVert_a \le \lVert y - x \rVert_b.
    Hence Bb(x,mr)⊆Ba(x,r)⊆UB_b(x, mr) \subseteq B_a(x, r) \subseteq U, and UU is open for dbd_b.
    So the bb-ball of radius mrmr is inside the aa-ball of radius rr, which is inside UU.
    The converse follows by swapping the two norms, with 1M\frac1M in place of mm. ■\blacksquare
    The same argument with the roles swapped, using ∥y−x∥b≤M ∥y−x∥a\lVert y - x \rVert_b \le M\,\lVert y - x \rVert_a: if ∥y−x∥a<rM\lVert y - x \rVert_a < \frac rM then ∥y−x∥b<r\lVert y - x \rVert_b < r, so Ba(x,rM)⊆Bb(x,r)B_a(x, \frac rM) \subseteq B_b(x, r).

    So on Rn\mathbb R^n the diamond, disc and square all give the same open sets, closed sets, interiors, closures and boundaries. We may use whichever norm makes a computation easiest. In fact every pair of norms on Rn\mathbb R^n is equivalent. The proof needs compactness (a closed bounded set of Rn\mathbb R^n contains a convergent subsequence of any sequence in it, as in Bolzano–Weierstrass). We do not prove it here.

    Beyond the course: for understanding· All norms on R^n are equivalent, and all of this fails for functions

    Fact (stated, not proved here). Any two norms on Rn\mathbb R^n are equivalent. The standard proof shows that every norm is a continuous function of the coordinates, and that a continuous function on the unit sphere (closed and bounded) attains a positive minimum and a finite maximum. Compactness is the tool, and MATH 521 proves it.

    The statement is false for functions. On C[0,1]C[0, 1] take fn(x)=xnf_n(x) = x^n. Then ∥fn∥∞=1\lVert f_n \rVert_\infty = 1 for every nn, but ∥fn∥2=∫01x2n dx=12n+1→0\lVert f_n \rVert_2 = \sqrt{\int_0^1 x^{2n}\,dx} = \frac{1}{\sqrt{2n + 1}} \to 0. If ∥f∥∞≤M ∥f∥2\lVert f \rVert_\infty \le M\,\lVert f \rVert_2 held for a fixed MM, we would get 1≤M2n+11 \le \frac{M}{\sqrt{2n+1}} for all nn, which is false for large nn. So the sup norm and the 2-norm are not equivalent on C[0,1]C[0, 1], and they give different open sets and, as 4.2 shows, different convergent sequences. In infinite dimensions the choice of norm matters.

    Where it is used

    Used inside maths· Inside maths: continuity, derivatives and topology all run on balls

    Replace ∣x−a∣|x - a| by d(x,a)d(x, a) in the ε\varepsilon-δ\delta definition of 1.3 and you have continuity of a function between metric spaces: ff is continuous at aa if for every ε>0\varepsilon > 0 there is δ>0\delta > 0 with dY(f(x),f(a))<εd_Y(f(x), f(a)) < \varepsilon whenever dX(x,a)<δd_X(x, a) < \delta. The same statement says that the preimage of every open set is open, which MATH 551 takes as the definition of continuity and builds a whole subject on. The derivative in many variables (Unit 5) is defined at an interior point of a set: the ball inside the set is what lets you approach the point from every direction. Chapter 4.2 uses completeness and balls to prove that equations have solutions.

    Used in the real world· Error-correcting codes: Hamming balls that do not overlap

    A message is sent as a string of bits, and noise flips some of them. The Hamming distance counts how many flips separate two strings. A code is a chosen set of strings (the codewords), picked so that two codewords are at Hamming distance at least 33. Then the open balls B(c,2)B(c, 2) of radius 22 around the codewords (all strings at distance ≤1\le 1) do not overlap. If one bit is flipped in transmission, the received string is inside the ball of the sent codeword and in no other, so the receiver decodes by picking the nearest codeword and recovers the message.

    The Hamming (7,4) code has 7-bit strings and 24=162^4 = 16 codewords with minimum distance 33 between any two. Each ball of radius 11 contains 1+7=81 + 7 = 8 strings, and 16×8=128=2716 \times 8 = 128 = 2^7, so the 16 balls cover all 128128 strings of length 77 without overlap. (We checked this by listing all 16 codewords by computer.) Every 7-bit string is a codeword or exactly one bit away from exactly one codeword.

    Your answerIn Hamming distance on bit strings of length 7, how many strings are within distance 1 of a given string (the string itself included)?
    Where this came from· Hamming at Bell Labs

    Richard Hamming published Error detecting and error correcting codes in the Bell System Technical Journal in April 1950. He worked at Bell Telephone Laboratories, and his stated concern was large computing machines in which long calculations had to finish without a single error in the result. He measured how far apart two bit strings are by the number of positions in which they differ, and showed how to choose codewords far enough apart that one flipped bit can be both detected and corrected. The “distance” that now carries his name is the metric of this chapter, and “balls do not overlap” is the whole design principle.

    Used in the real world· Machine learning: which ball is the perturbation allowed to live in?

    An image classifier is attacked by changing every pixel by a small amount. The usual rule is to allow any change inside the max-norm ball of radius ε\varepsilon around the image: no pixel moves by more than ε\varepsilon. A common benchmark setting for 32×3232 \times 32 colour images (CIFAR-10), used for example by the RobustBench leaderboard, is ε=8255\varepsilon = \frac{8}{255} with pixel values scaled to run from 00 to 11. The image has n=32⋅32⋅3=3072n = 32 \cdot 32 \cdot 3 = 3072 numbers. The corner of that cube, where every number moves by the full ε\varepsilon, has 2-norm 82553072≈1.74\frac8{255}\sqrt{3072} \approx 1.74. So a change of at most about 3%3\% per number can have a Euclidean length as large as 1.741.74. That is the factor n≈55\sqrt n \approx 55 from the comparison theorem acting on a 30723072-dimensional vector: the corner of the square is far from the centre in the 2-distance. The diamond tells a different story: minimizing a loss over a 1-norm ball tends to land on a corner of the diamond, where many coordinates are exactly 00, which is why an ℓ1\ell_1 penalty (the lasso) produces sparse models. The three balls are three different modelling choices.

    Your answerA CIFAR-10 image has n=3072n = 3072 numbers. If every one changes by exactly ε=8255\varepsilon = \frac{8}{255}, what is the 2-norm of the change? (Give a decimal.)

    Traps

    Watch out· Open is not the opposite of closed

    A set can be both (∅\varnothing, the whole space, or any set in the discrete metric), or neither ([0,1)[0, 1) and Q\mathbb Q in R\mathbb R). To prove a set is closed you show the complement is open; showing the set is “not open” proves nothing about closedness.

    Watch out· Finite versus infinite intersections

    Finite intersections of open sets are open; infinite ones need not be (⋂(−1n,1n)={0}\bigcap (-\frac1n, \frac1n) = \{0\}). Dually, finite unions of closed sets are closed; infinite ones need not be. The proof uses a minimum of radii, and infinitely many positive radii can have minimum 00.

    Watch out· Interior and boundary depend on the space around the set

    The interval [0,1][0, 1] has interior (0,1)(0, 1) as a subset of R\mathbb R. The same segment [0,1]×{0}[0, 1] \times \{0\} in the plane has empty interior, because no disc fits inside a segment. “Open” and “boundary” always mean “inside the metric space XX you are working in”. In the same way, the open interval (0,1)(0, 1) is open in R\mathbb R but, viewed as the segment (0,1)×{0}(0, 1) \times \{0\} of the plane, it is not open there.

    Watch out· The closed ball is not always the closure of the open ball

    The closed ball is {y:d(x,y)≤r}\{y : d(x, y) \le r\} and the open ball is {y:d(x,y)<r}\{y : d(x, y) < r\}. In Rn\mathbb R^n the closure of the open ball is the closed ball, but not in every metric space. In the discrete metric on a set with at least two points, B(x,1)={x}B(x, 1) = \{x\}, whose closure is {x}\{x\}, while the closed ball of radius 11 is the whole space.

    Watch out· A limit point need not be in the set, and a point of the set need not be a limit point

    For A={1n}A = \{\frac1n\}, 00 is a limit point outside AA. Each 1n\frac1n is in AA but not a limit point. The closure is the union of the two kinds. In the proof, the phrase “other than xx itself” is not decoration: without it every point of AA would count.

    Watch out· Balls are not always round

    The ball of the max-distance is a square and of the 1-distance a diamond. A statement like “a ball has a smooth edge” or “a ball is convex and round” is a fact about d2d_2 only. What does hold for every metric is that balls are open sets.

    Problems

    check

    Find d1d_1, d2d_2 and d∞d_\infty between (2,0,−1)(2, 0, -1) and (−1,4,−1)(-1, 4, -1), and check d∞≤d2≤d1d_\infty \le d_2 \le d_1.

    Solution

    The difference is (3,−4,0)(3, -4, 0). So d1=3+4+0=7d_1 = 3 + 4 + 0 = 7, d2=9+16+0=5d_2 = \sqrt{9 + 16 + 0} = 5, d∞=max⁡(3,4,0)=4d_\infty = \max(3, 4, 0) = 4. And 4≤5≤74 \le 5 \le 7.

    check

    In the discrete metric on R\mathbb R, what are B(3,12)B(3, \frac12), B(3,1)B(3, 1) and B(3,2)B(3, 2)?

    Solution

    B(3,12)={3}B(3, \frac12) = \{3\} and B(3,1)={3}B(3, 1) = \{3\} (the only distance below 11 is 00). B(3,2)=RB(3, 2) = \mathbb R, because every distance is at most 1<21 < 2.

    check

    Is Z\mathbb Z open in R\mathbb R? Is it closed?

    Solution

    Not open: every ball (n−r,n+r)(n - r, n + r) around an integer contains non-integers. Closed: its complement is ⋃n(n,n+1)\bigcup_n (n, n + 1), a union of open intervals, hence open.

    check

    Write the negation of ”UU is open” using quantifiers.

    Solution

    ∃x∈U ∀r>0: B(x,r)⊈U\exists x \in U\ \forall r > 0:\ B(x, r) \not\subseteq U. That is, some point of UU has no ball around it inside UU, which is what we showed for the point 00 in [0,1)[0, 1).

    use

    Find the interior, closure and boundary of A=(0,1)∪(1,2)∪{3}A = (0, 1) \cup (1, 2) \cup \{3\} in R\mathbb R.

    Solution

    Interior: (0,1)∪(1,2)(0, 1) \cup (1, 2) (the point 33 is isolated, so has no ball inside AA). Limit points: [0,2][0, 2] (the point 11 is a limit point though not in AA). Closure: [0,2]∪{3}[0, 2] \cup \{3\}. Boundary: closure minus interior ={0,1,2,3}= \{0, 1, 2, 3\}.

    use

    In R2\mathbb R^2 find the area of the open ball of radius 11 about the origin for d1d_1, d2d_2, d∞d_\infty. Which of the points (0.6,0.6)(0.6, 0.6) and (0.5,0.5)(0.5, 0.5) lie in each ball?

    Solution

    d1d_1: the diamond with vertices (±1,0),(0,±1)(\pm 1, 0), (0, \pm 1) has area 22. d2d_2: area π\pi. d∞d_\infty: the square (−1,1)2(-1, 1)^2 has area 44. The point (0.6,0.6)(0.6, 0.6) has d1=1.2d_1 = 1.2, d2≈0.85d_2 \approx 0.85, d∞=0.6d_\infty = 0.6, so it is in the disc and the square but not the diamond. The point (0.5,0.5)(0.5, 0.5) has d1=1d_1 = 1 exactly, so it is not in the open diamond (strict inequality) but it is in the other two.

    use

    How many bit strings of length 6 are in the Hamming open ball B(a,3)B(a, 3) around a fixed string aa? How many strings are at distance exactly 33?

    Solution

    Distance less than 33 means at most 22 flips: (60)+(61)+(62)=1+6+15=22\binom60 + \binom61 + \binom62 = 1 + 6 + 15 = 22. Exactly 33 flips: (63)=20\binom63 = 20.

    use

    Use the comparison theorem to show that if ∥x∥∞<110\lVert x \rVert_\infty < \frac{1}{10} for x∈R4x \in \mathbb R^4, then ∥x∥1<0.4\lVert x \rVert_1 < 0.4 and ∥x∥2<0.2\lVert x \rVert_2 < 0.2.

    Solution

    ∥x∥1≤n ∥x∥∞=4⋅∥x∥∞<0.4\lVert x \rVert_1 \le n\,\lVert x \rVert_\infty = 4 \cdot \lVert x \rVert_\infty < 0.4. And ∥x∥2≤n ∥x∥∞=2 ∥x∥∞<0.2\lVert x \rVert_2 \le \sqrt n\,\lVert x \rVert_\infty = 2\,\lVert x \rVert_\infty < 0.2.

    prove

    Use the reverse triangle inequality to prove that for any four points x,y,w,zx, y, w, z of a metric space, ∣d(x,y)−d(w,z)∣≤d(x,w)+d(y,z)|d(x, y) - d(w, z)| \le d(x, w) + d(y, z).

    Solution

    Plan. Move one endpoint at a time, using the reverse triangle inequality from the example above.

    Change the first point from xx to ww: ∣d(x,y)−d(w,y)∣≤d(x,w)|d(x, y) - d(w, y)| \le d(x, w). Change the second point from yy to zz: ∣d(w,y)−d(w,z)∣≤d(y,z)|d(w, y) - d(w, z)| \le d(y, z). Now ∣d(x,y)−d(w,z)∣≤∣d(x,y)−d(w,y)∣+∣d(w,y)−d(w,z)∣|d(x, y) - d(w, z)| \le |d(x, y) - d(w, y)| + |d(w, y) - d(w, z)| by the triangle inequality for absolute values of real numbers, and the right side is at most d(x,w)+d(y,z)d(x, w) + d(y, z). ■\blacksquare (This is what makes dd a continuous function of both of its inputs, used in 4.2.)

    proveMATH 375 HW 11 (Apostol 8.3 #4a)

    Prove: if AA is open and x∈Ax \in A, then A∖{x}A \setminus \{x\} is open. (Work in any metric space.)

    Solution

    Plan. A point yy of A∖{x}A \setminus \{x\} has a ball inside AA; shrink it so that it also misses xx.

    Let y∈A∖{x}y \in A \setminus \{x\}. Since AA is open, B(y,r)⊆AB(y, r) \subseteq A for some r>0r > 0. Since y≠xy \ne x, d(x,y)>0d(x, y) > 0 by (M1). Let r′=min⁡(r,d(x,y))r' = \min(r, d(x, y)). Then B(y,r′)⊆B(y,r)⊆AB(y, r') \subseteq B(y, r) \subseteq A, and x∉B(y,r′)x \notin B(y, r') because d(y,x)=d(x,y)≥r′d(y, x) = d(x, y) \ge r'. So B(y,r′)⊆A∖{x}B(y, r') \subseteq A \setminus \{x\}. ■\blacksquare

    prove

    Prove that the closed ball {y:d(x,y)≤r}\{y : d(x, y) \le r\} is a closed set.

    Solution

    Plan. Show the complement {y:d(x,y)>r}\{y : d(x, y) > r\} is open, by the same idea as open balls are open.

    Let zz satisfy d(x,z)>rd(x, z) > r, and let s=d(x,z)−r>0s = d(x, z) - r > 0. If d(z,y)<sd(z, y) < s, then by (M3), d(x,z)≤d(x,y)+d(y,z)d(x, z) \le d(x, y) + d(y, z), so d(x,y)≥d(x,z)−d(y,z)>d(x,z)−s=rd(x, y) \ge d(x, z) - d(y, z) > d(x, z) - s = r. So B(z,s)B(z, s) lies in the complement, which is open. Hence the closed ball is closed. ■\blacksquare

    prove

    Prove that every finite set in a metric space is closed.

    Solution

    Plan. A single point is closed; a finite union of closed sets is closed.

    A single point {x}\{x\} is closed: for y≠xy \ne x, the ball B(y,d(x,y))B(y, d(x, y)) does not contain xx (the distance from yy to xx is not less than d(x,y)d(x, y)), so it lies in X∖{x}X \setminus \{x\}, which is therefore open. A finite set is a finite union of singletons, hence closed by the corollary on finite unions. ■\blacksquare

    proveAbbott Sec. 3.2 style; new

    Prove that A‾=A\overline A = A if AA is closed, and that A‾\overline A is always closed, using only the definition of closure (every ball around the point meets AA).

    Solution

    Plan. Show the complement of A‾\overline A is open directly, with the open-ball proposition.

    Closedness of A‾\overline A: let x∉A‾x \notin \overline A. Some ball B(x,r)B(x, r) misses AA. Every y∈B(x,r)y \in B(x, r) has a ball B(y,s)⊆B(x,r)B(y, s) \subseteq B(x, r) (open balls are open), and B(y,s)B(y, s) misses AA too, so y∉A‾y \notin \overline A. So B(x,r)⊆X∖A‾B(x, r) \subseteq X \setminus \overline A, which is open, and A‾\overline A is closed. If AA is closed and x∉Ax \notin A, then X∖AX \setminus A is open, so some ball around xx misses AA, so x∉A‾x \notin \overline A. Thus A‾⊆A\overline A \subseteq A, and always A⊆A‾A \subseteq \overline A. ■\blacksquare

    stretch

    Prove that d(x,y)=∣x−y∣1+∣x−y∣d(x, y) = \dfrac{|x - y|}{1 + |x - y|} is a metric on R\mathbb R. (Hint: f(t)=t1+tf(t) = \frac{t}{1 + t} is increasing, and f(a+b)≤f(a)+f(b)f(a + b) \le f(a) + f(b) for a,b≥0a, b \ge 0.)

    Solution

    Plan. (M1) and (M2) are easy. For (M3), apply the increasing function ff to the real triangle inequality and then split.

    (M1): f(t)≥0f(t) \ge 0 with equality iff t=0t = 0, and ∣x−y∣=0|x - y| = 0 iff x=yx = y. (M2): ∣x−y∣=∣y−x∣|x - y| = |y - x|. (M3): ff is increasing because f(t)=1−11+tf(t) = 1 - \frac1{1 + t}. With a=∣x−y∣a = |x - y|, b=∣y−z∣b = |y - z| we have ∣x−z∣≤a+b|x - z| \le a + b, so d(x,z)=f(∣x−z∣)≤f(a+b)d(x, z) = f(|x - z|) \le f(a + b). Then f(a+b)=a+b1+a+b=a1+a+b+b1+a+b≤a1+a+b1+b=d(x,y)+d(y,z)f(a + b) = \frac{a + b}{1 + a + b} = \frac{a}{1 + a + b} + \frac{b}{1 + a + b} \le \frac{a}{1 + a} + \frac{b}{1 + b} = d(x, y) + d(y, z), since each denominator on the left is at least as large as the one on the right. ■\blacksquare (This metric never exceeds 11 but has the same open sets as ∣x−y∣|x - y|; only the ball sizes change.)

    stretch

    Show that the open 1-ball of radius rr in Rn\mathbb R^n has volume cnrnc_n r^n with cn=2nn!c_n = \frac{2^n}{n!}, while the max-ball has volume 2nrn2^n r^n. For n=10n = 10, what fraction of the cube does the diamond fill?

    Solution

    Plan. Slice the diamond by the last coordinate and use induction.

    The volume scales as rnr^n, so write vol⁡=cnrn\operatorname{vol} = c_n r^n (for n=1n = 1, c1=2c_1 = 2). Slicing at height t∈(−r,r)t \in (-r, r) in the last coordinate leaves an (n−1)(n-1)-dimensional diamond of radius r−∣t∣r - |t|, of volume cn−1(r−∣t∣)n−1c_{n-1}(r - |t|)^{n-1}. So cnrn=2∫0rcn−1(r−t)n−1 dt=2cn−1rnnc_n r^n = 2\int_0^r c_{n-1}(r - t)^{n-1}\,dt = 2c_{n-1}\frac{r^n}{n}, giving cn=2ncn−1c_n = \frac{2}{n}c_{n-1}, hence cn=2nn!c_n = \frac{2^n}{n!}. The cube (−r,r)n(-r, r)^n has volume (2r)n(2r)^n. The ratio is 1n!\frac1{n!}, which for n=10n = 10 is 13628800≈2.8×10−7\frac{1}{3628800} \approx 2.8 \times 10^{-7}. In ten dimensions the diamond fills almost none of the cube it is inscribed in, so “being close” in d1d_1 is a far more demanding requirement than in d∞d_\infty.

    Summary

    • A metric space is a set with a distance that is non-negative, zero only for equal points, symmetric, and obeys the triangle inequality. These four properties are all the ε\varepsilon-proofs of Unit 1 used.
    • A norm (never negative, zero only at OO, scales by ∣c∣|c|, triangle inequality) gives a metric ∥x−y∥\lVert x - y \rVert. The 1-, 2- and max-norms on Rn\mathbb R^n and the sup norm on C[a,b]C[a, b] are norms. The discrete metric and Hamming distance are metrics that come from no norm.
    • The open ball B(x,r)B(x, r) is the points at distance strictly less than rr. It is a diamond, disc or square for d1d_1, d2d_2, d∞d_\infty.
    • Open means every point has a ball inside. Closed means the complement is open. Unions of open sets and finite intersections of open sets are open; the word “finite” is needed (⋂(−1n,1n)={0}\bigcap (-\frac1n, \frac1n) = \{0\}).
    • Interior, closure, boundary: a ball around a point sits inside the set, touches it, or touches both it and its complement. A‾=A∪{limit points}\overline A = A \cup \{\text{limit points}\}, ∂A=A‾∖int⁡A\partial A = \overline A \setminus \operatorname{int} A, and AA is closed iff it contains its limit points.
    • ∥x∥∞≤∥x∥2≤∥x∥1≤n ∥x∥2≤n ∥x∥∞\lVert x \rVert_\infty \le \lVert x \rVert_2 \le \lVert x \rVert_1 \le \sqrt n\,\lVert x \rVert_2 \le n\,\lVert x \rVert_\infty, so on Rn\mathbb R^n the three norms have the same open sets. On function spaces the norms need not be equivalent.
    • Hamming balls that do not overlap are an error-correcting code; max-norm balls are the perturbations allowed in adversarial robustness.

    Where this sits

    Comes from
    1.2 Sequences and limits, from zero
    1.3 Limits and continuity with epsilon and delta
    2.9 Inner products, orthogonality, Gram–Schmidt, projection
    Leads to
    4.2 Convergence, completeness and the contraction mapping theorem
    Same idea elsewhere
    MATH 375: Lecture 19 and Apostol 8.2 define the ball $B_r(a)$, interior, exterior and boundary points and open sets in $\mathbb R^n$ with the usual length. This chapter proves the same facts for any distance, so the 375 proofs ('take the smaller radius') are the general ones.
    MATH 521: 521 starts with metric spaces: open and closed sets, closure, and equivalence of norms. Everything here is its first two weeks.
    MATH 551: Topology keeps only the open sets and forgets the distance. The theorems on unions and finite intersections below become the axioms of a topology.
    CS 240 / coding: Hamming distance counts the positions where two bit strings differ. Error-correcting codes are sets of bit strings chosen so that the Hamming balls around them do not overlap.