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∣ in a very small number of ways. It is never negative. It is zero only when x=y. It is the same from x to y as from y to x. 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∣, and the same ε games still work. That is a metric space. It lets us ask how close two vectors are, how close two functions are (“is sinx close to x−6x3 on [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 a to c, either directly or by way of a stop at b. Which statement is always true?
This is the triangle inequality of 1.2. Equality holds only when b lies between a and c. Everything in this chapter rests on it.Review: the triangle inequality
Quick checkFor the norm ∥x∥=(x,x) of 2.9 and a real number c, what is ∥cx∥?
A point is outside A∪B exactly when it is outside A and outside B. This is De Morgan's law, which we use to turn statements about open sets into statements about closed sets.Review: De Morgan's laws
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∣. A straight line costs x12+x22. A chess king moves one square in any of eight directions, so reaching (x1,x2) takes max(∣x1∣,∣x2∣) moves. The set of points within distance r of the centre is a diamond, a disc or a square. Three things to do in the picture:
Put x on an axis. All three distances agree, because only one coordinate is non-zero.
Put x near a corner of the square, such as (0.9,0.9) with r=1. It is inside the square, outside the disc and far outside the diamond. The three rules disagree about whether x is “close”.
Slide r 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 x
d1=∣x1∣+∣x2∣
d2=x12+x22
d∞=max(∣x1∣,∣x2∣)
(3,4)
7
5
4
(1,1)
2
2≈1.41
1
(5,0)
5
5
5
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
Never negative. Distances are lengths.
Zero only for equal points. Then “the distance between x and y is smaller than every ε>0” proves x=y. This is the last step of the uniqueness-of-limits proof in 1.2.
Symmetric. ”x is close to y” and ”y is close to x” are the same statement, so a ball around x and a ball around y can be compared.
Triangle inequality. You can reach z from x by way of y without saving distance. This is the property that lets you split a distance into two pieces and give each half of the budget ε (the 2ε 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 X together with a function d that gives a real number d(x,y) for every pair of points x,y∈X, such that for all x,y,z∈X:
(M1)d(x,y)≥0, and d(x,y)=0 if and only if x=y.
(M2)d(x,y)=d(y,x).
(M3)d(x,z)≤d(x,y)+d(y,z) (the triangle inequality).
The function d is the metric or distance. The elements of X are called points, whatever they really are.
In one lineA set X with a distance 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∣ exactly what the ε-proofs of Unit 1 used, so those proofs work for vectors, functions and bit strings.
The real line with 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∣.
Quick checkOn R define d(x,y)=∣x2−y2∣. Which axiom fails?
Symmetry holds because ∣a−b∣=∣b−a∣, and the triangle inequality holds because it is the real triangle inequality applied to x2,y2,z2. But two different points 1 and −1 are at distance 0. A distance must separate points.
Worked example
Show that d(x,y)=(x−y)2 is not a metric on R.
Solution. To show a rule is not a metric, we find one violated axiom and one instance where it fails.
Check (M1) and (M2).(x−y)2≥0 with equality iff x=y, and (x−y)2=(y−x)2. The first two axioms hold, so the failure, if any, is in the triangle inequality.
Look for a triangle that fails. Take x=0, y=1, z=2. Then d(0,2)=4, while d(0,1)+d(1,2)=1+1=2. Squaring makes large gaps count much more than small ones, so the stop at y=1 makes the journey “cheaper” than the direct trip. That is the opposite of the triangle inequality.
Conclude.4≤2 is false, so (M3) fails.
Answer.(x−y)2 is not a metric. Its square root, ∣x−y∣, is. ■
Worked example
Prove the reverse triangle inequality in a metric space: ∣d(x,z)−d(y,z)∣≤d(x,y).
Solution. An absolute value ∣a∣≤c means two things at once, a≤c and −a≤c. So we prove both.
First half. (M3) gives d(x,z)≤d(x,y)+d(y,z). Subtract d(y,z): d(x,z)−d(y,z)≤d(x,y). The detour through y is never shorter than the direct trip, so moving the term across is the same statement.
Second half. Swap the roles of x and y: d(y,z)−d(x,z)≤d(y,x)=d(x,y). The first half holds for any two points, so it holds with x and y exchanged. (M2) turns d(y,x) into d(x,y).
Combine. Both d(x,z)−d(y,z) and its negative are at most d(x,y). That is exactly what ∣d(x,z)−d(y,z)∣≤d(x,y) means.
Answer. The inequality holds. In words: if x and y are within ε of each other, their distances to any third point differ by at most ε. So the distance function is continuous. In a normed space, taking z=O gives ∥x∥−∥y∥≤∥x−y∥. ■
Definition B
Normed space
A normed space is a vector spaceV with a function ∥⋅∥ that gives a real number ∥x∥ for each x∈V, such that for all x,y∈V and every real c:
(N1)∥x∥≥0, and ∥x∥=0 if and only if x=O.
(N2)∥cx∥=∣c∣∥x∥.
(N3)∥x+y∥≤∥x∥+∥y∥.
The function is a norm. In 2.9 the norm (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∥ for every vector that is never negative, zero only for O, scales by ∣c∣, 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∣ under stretching.
Theorem BAbbott Sec. 3.1; Rudin ch. 2
A norm gives a metric
Let V be a normed space. Then d(x,y)=∥x−y∥ satisfies (M1), (M2) and (M3).
In one lineIf ∥⋅∥ is a norm on V, then d(x,y)=∥x−y∥ is a metric on V.
Why it is trueEach metric axiom is one norm axiom applied to x−y; the triangle inequality comes from splitting x−z as (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∥≥0, and it is 0 iff x−y=O, that is, iff x=y.
(N1) applied to the vector x−y. Also x−y=O exactly when x=y.
Write x−z as the sum of the two vectors x−y and y−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) in Rn define three lengths:
Also, on the vector space C[a,b] of continuous functions on [a,b] (an example of 2.1), define the sup norm∥f∥∞=maxa≤x≤b∣f(x)∣. The maximum exists because a continuous function on [a,b] attains its maximum, by the extreme value theorem of 1.3, and ∣f∣ is continuous.
(a) ∥⋅∥1, ∥⋅∥2 and ∥⋅∥∞ satisfy (N1) to (N3) on Rn. (b) The sup norm satisfies (N1) to (N3) on C[a,b].
In one line∥⋅∥1, ∥⋅∥2 and ∥⋅∥∞ are norms on Rn, and the sup norm is a norm on 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 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, and =0 iff every ∣xi∣=0, that is, x=O.
A sum of non-negative terms is 0 only if every term is 0.
1-norm (N2): ∥cx∥1=∑∣c∣∣xi∣=∣c∣∥x∥1.
∣cxi∣=∣c∣∣xi∣, then take the common factor ∣c∣ out of the sum.
The triangle inequality for numbers, for each i, then add over i.
Max-norm (N1), (N2): ∥x∥∞≥0, with 0 iff x=O, and ∥cx∥∞=∣c∣∥x∥∞.
A largest of non-negative numbers is 0 only if all of them are 0; and max(∣c∣∣xi∣)=∣c∣max∣xi∣ because ∣c∣≥0.
Max-norm (N3): ∥x+y∥∞≤∥x∥∞+∥y∥∞.
For each i: ∣xi+yi∣≤∣xi∣+∣yi∣≤∥x∥∞+∥y∥∞. A number that bounds every ∣xi+yi∣ also bounds their maximum.
Sup norm (N1), (N2): ∥f∥∞≥0, with ∥f∥∞=0 iff f(t)=0 for every t, that is, f=O; and ∥cf∥∞=∣c∣∥f∥∞.
A maximum of non-negative numbers ∣f(t)∣ is at least 0, and it is 0 only if every ∣f(t)∣=0. For (N2), ∣cf(t)∣=∣c∣∣f(t)∣ for every t and ∣c∣≥0, so the maximum scales by ∣c∣.
Sup norm (N3): ∥f+g∥∞≤∥f∥∞+∥g∥∞. ■
Same argument as for the max-norm, with the point t∈[a,b] in place of the index i: ∣f(t)+g(t)∣≤∣f(t)∣+∣g(t)∣≤∥f∥∞+∥g∥∞ for every t, so the maximum of the left side obeys the same bound.
By the previous theorem each gives a metric: d1, d2, d∞ on Rn, and on C[a,b] the sup metric.
Definition B
Sup metric
The sup metric on C[a,b] is d∞(f,g)=∥f−g∥∞=maxa≤x≤b∣f(x)−g(x)∣. It is the largest vertical distance between the graphs of f and g.
In one lineOn C[a,b], d∞(f,g)=maxa≤x≤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)=x and g(x)=x2 on [0,1] in the sup metric, and compare with the 2-distance.
Solution.
Form the gap function.h(x)=∣f(x)−g(x)∣=x−x2 on [0,1] (it is ≥0 there since x2≤x). The sup metric is the largest value of h, so we maximize h.
Find the maximum.h′(x)=1−2x=0 at x=21, where h=21−41=41. At the endpoints h(0)=h(1)=0. A continuous function on [0,1] attains its maximum at an endpoint or where the derivative is 0 (1.4).
The sup distance.d∞(f,g)=41. It is the height of the widest gap between the two graphs, at x=21.
The 2-distance, for comparison.∥f−g∥2=∫01(x−x2)2dx=31−21+51=301≈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)=41, and the 2-distance is 1/30≈0.183. The two ways to measure functions give different numbers. On [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. ■
Worked example
Find the 1-, 2- and ∞-distances between (1,−2,4) and (3,1,−2) in R3.
Solution.
Subtract.x−y=(1−3,−2−1,4−(−2))=(−2,−3,6). All three distances are the length of x−y (the norm-to-metric theorem), so we compute the difference once.
1-distance.∣−2∣+∣−3∣+∣6∣=2+3+6=11. Add the sizes of the entries.
2-distance.4+9+36=49=7. The usual length: square, add, root.
∞-distance.max(2,3,6)=6. Only the largest entry counts.
Answer.d1=11, d2=7, d∞=6. Note 6≤7≤11: the order d∞≤d2≤d1 is a theorem, proved below. ■
Your answerWhat is the 2-distance between (1,−2,4) and (3,1,−2) in R3?
Subtract the points entry by entry, square each entry, add, and take the square root.
The difference is (−2,−3,6), and 4+9+36=49, whose square root is 7.
Not every metric comes from a norm. The next two have no vectors to scale.
Definition B
Discrete metric
On any set X, the discrete metric is d(x,y)=0 when x=y and d(x,y)=1 when x=y.
In one lineOn any set X: d(x,y)=0 if x=y and d(x,y)=1 if x=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…an and b=b1…bn of bits (each 0 or 1), the Hamming distancedH(a,b) is the number of positions i where ai=bi. For example dH(10110,11100)=2: they differ in positions 2 and 4.
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 BHamming 1950; standard
The discrete metric and the Hamming distance are metrics
(a) The discrete metric on a set X is a metric. (b) The Hamming distance is a metric on the set of bit strings of length n.
In one lineThe discrete metric on any set, and dH on bit strings of length n, 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≥0 and d(x,y)=0 exactly when x=y. The definition does not mention the order of x and y.
(a) (M3), case x=z: d(x,z)=0≤d(x,y)+d(y,z).
If x=z, the left side is 0, and the right side is non-negative.
(a) (M3), case x=z: d(x,z)=1≤d(x,y)+d(y,z). ■
If y were equal to both x and z, then x=y=z, contradicting x=z. So y=x or y=z, and at least one term on the right is 1.
(b) (M1), (M2): immediate.
The count is a number of positions, so it is a whole number at least 0; it is 0 iff no position differs iff a=b. 'Differs' is a symmetric relation.
(b) (M3): D(a,c)⊆D(a,b)∪D(b,c).
Let D(a,b) be the set of positions where a and b differ. If ai=ci, then bi cannot equal both ai and ci, so i∈D(a,b) or i∈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). ■
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 with entries 0 and 1, then dH(a,b)=∥a−b∥1. The 1-distance counts the same positions.)
Quick checkIs the discrete metric on R given by a norm, that is, is d(x,y)=∥x−y∥ for some norm on R?
Norm axiom (N2) forces distances to scale when you stretch. The discrete metric is a genuine metric (the theorem above) but ignores size. So metric spaces are strictly more general than normed spaces.
Open balls, open sets, closed sets
Definition T
Open ball
In a metric space, the open ball of radius r>0 about x is B(x,r)={y∈X:d(x,y)<r}. (The strict inequality matters: the points at distance exactly r are not in it.)
In one lineB(x,r) is the set of all points whose distance from x is less than r: the points strictly within r of x.
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 with ∣x−y∣, B(x,r) is the interval (x−r,x+r). In R2 with d2 it is a disc without its rim, with d1 a diamond without its edge, with d∞ a square without its edge. In the discrete metric, B(x,r)={x} when r≤1 and B(x,r)=X when r>1. In Hamming distance the balls are sets of strings.
Worked example
List the open balls B(000,r) in the Hamming distance on bit strings of length 3, for r=1,2,3,4.
Solution.
Distances from 000.dH(000,s) is the number of 1s in s. 000 differs from s exactly where s has a 1.
Sort the 8 strings by distance. Distance 0: 000. Distance 1: 100,010,001. Distance 2: 110,101,011. Distance 3: 111. There are (k3) strings with k ones.
Apply “strictly less than r”.r=1: distance <1, so only 000. r=2: distance ≤1, so 000,100,010,001. r=3: distance ≤2, so 7 strings (all but 111). r=4: all 8 strings.
Answer.B(000,1)={000}, B(000,2) has 4 strings, B(000,3) has 7, B(000,4) has 8. ■
Your answerIn Hamming distance on bit strings of length 5, how many strings lie in the open ball B(00000,3)? (That is, how many have distance less than 3 from 00000.)
Count the strings with 0, 1 and 2 ones.
Distance less than 3 means at most 2 ones: (05)+(15)+(25)=1+5+10=16.
Quick checkIn the discrete metric on a set X with more than one point, what is the open ball B(x,1)?
B(x,1) contains the points at distance strictly less than 1. The only distance below 1 is 0, so only x itself. (But B(x,1.5)=X, since every distance is at most 1. The radius 1 is exactly where the ball jumps.)
Definition T
Open set
A subset U of a metric space X is open if for every x∈U there is an r>0 with B(x,r)⊆U. In symbols, ∀x∈U∃r>0:B(x,r)⊆U. The radius r may depend on x.
In one lineA set U is open if every point of U has an open ball around it that lies completely inside U.
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 F of a metric space X is closed if X∖F is open. (Here X∖F is the complement of F in X, the points of X not in F.)
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 TRudin Thm 2.19; Abbott Sec. 3.2
Open balls are open
For every x in a metric space and every r>0, the ball B(x,r) is open.
In one lineEvery open ball B(x,r) is an open set.
Why it is trueA point of the ball at distance d from the centre has a gap r−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), so d(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)>0.
This is positive because d(x,y)<r. It is the room between y and the rim.The idea: measure how far y is from the edge.
Let z∈B(y,s), so d(y,z)<s.
Take any z in the small ball.
d(x,z)≤d(x,y)+d(y,z)<d(x,y)+s=r.
Triangle inequality (M3) through y, then the choice of s.
So B(y,s)⊆B(x,r), and y has a ball inside B(x,r). Since y was arbitrary, B(x,r) is open. ■
That says z∈B(x,r). Every z in the small ball is in the big ball.
In the picture: the ball is a disc, the point y is somewhere inside it, and the small ball around y is a disc that touches the rim of the big one from inside when 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.
To prove a set is open we must treat an arbitrary point of it.
The room between y and the rim. It is positive because y is strictly inside.
You need the point y and the fact d(x,y)<r before you can define s from them.
We test every point of the small ball B(y,s).
The radius s must be defined before you can name the ball B(y,s).
The triangle inequality, then d(y,z)<s, then the definition of s.
You need the point z and its bound d(y,z)<s first.
Every point y of the ball has a ball around it inside the ball, which is the definition of open.
This conclusion needs the inequality d(x,z)<r for the arbitrary z.
Worked example
Show that (0,1) is open in R, that [0,1] is closed, and that [0,1) is neither.
Solution.
(0,1) is open. Take x∈(0,1) and let r=min(x,1−x)>0. Then B(x,r)=(x−r,x+r)⊆(0,1), because x−r≥0 and x+r≤1. The radius is the smaller of the distances to the two ends. It depends on x: near 0 or 1 it must be tiny.
[0,1] is closed. Its complement is (−∞,0)∪(1,∞). For x<0 the ball B(x,−x) stays below 0; for x>1 the ball B(x,x−1) stays above 1. So the complement is open. Closed means the complement is open, so we check the complement with the same radius trick.
[0,1) is not open. The point 0 belongs to it, but every ball B(0,r)=(−r,r) contains negative numbers, which are not in [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.
[0,1) is not closed. Its complement (−∞,0)∪[1,∞) contains 1, and every ball B(1,r)=(1−r,1+r) contains numbers less than 1 that are in [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) is open and not closed. [0,1] is closed and not open. [0,1) is neither. A set can be neither open nor closed, so “closed” does not mean “not open”. ■
Worked example MATH 375 Piazza, Nov 23
Classify as open, closed, both or neither in R: ∅, R, {0}, N, Q.
Solution.
∅ and R are both.∅ is open because there is no point to test, so the condition “for every point of the set” holds with nothing to check. 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∈∅” is true (0.1). These are the only two subsets of R that are both open and closed. That fact is called the connectedness of R, and we do not prove it here.
{0} is closed, not open. Its complement is (−∞,0)∪(0,∞), which is open (each point has a ball avoiding 0: radius ∣x∣). But every ball (−r,r) around 0 contains points other than 0. One point is closed in every metric space (a problem below), but in R it is not open.
N is closed, not open. Here N={1,2,3,…}. Take a real number y not in N. If y<1, the ball B(y,1−y) stays below 1. If y>1, then k<y<k+1 for some natural number k (the naturals are spaced 1 apart), and the ball B(y,r) with r=min(y−k,k+1−y)>0 lies strictly between k and k+1, so it contains no natural number. So the complement of 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 is not open: every ball around 1 contains non-integers.
Q is neither. Every ball (q−r,q+r) contains an irrational number (for example q+n2 with n large enough that n2<r, by the Archimedean property; it is irrational because if it were a rational p, then 2=n(p−q) would be rational), so Q is not open. Every ball around an irrational contains a rational (density, 1.1), so the complement is not open, and Q is not closed. The rationals and irrationals are tangled together at every scale.
In the discrete metric, every subset is open, and so every subset is closed.
Solution.
Pick any set U and a point x∈U. Take r=21. Any radius at most 1 will do in the discrete metric.
The ball is a single point.B(x,21)={x}⊆U. Only x has distance less than 1 from x.
So U is open. The complement X∖U is also a subset of X, so by the same argument it is open; hence U is closed. Closed means the complement is open, and the complement is another subset of X, 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. ■
Unions and intersections
Theorem TAbbott Sec. 3.2; Apostol 8.3 #5; Rudin Thm 2.24
Unions and finite intersections of open sets
In a metric space X: (a) ∅ and X are open. (b) If Uα is open for every α in some collection (finite or infinite), then ⋃αUα is open. (c) If U1,…,Um are open, then U1∩⋯∩Um is open.
In one line∅ and X 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) ∅ and X are open.
For ∅ there is no point to check. For X, any ball is a subset of X.
(b) Let x∈⋃Uα. Then x∈Uβ for some β.
Choose the set in the collection that contains x.
There is r>0 with B(x,r)⊆Uβ⊆⋃αUα. So the union is open.
Uβ is open, and Uβ⊆⋃Uα.
(c) Let x∈U1∩⋯∩Um. For each i there is ri>0 with B(x,ri)⊆Ui.
Each Ui is open and contains x, 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)>0.
A minimum of FINITELY many positive numbers is one of them, so it is positive. With infinitely many it could be 0 (or not exist).
B(x,r)⊆B(x,ri)⊆Ui for every i, so B(x,r)⊆U1∩⋯∩Um. ■
A ball of radius r≤ri is inside the ball of radius ri.
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+n1)=(0,1].
Solution.
Each set is open.(0,1+n1) is an open interval. An open interval is an open ball in R.
Which numbers lie in all of them? If 0<x≤1, then x<1+n1 for every n, so x is in every set. If x>1, pick n with n1<x−1 (Archimedean property); then x>1+n1, so x is missing from the n-th set. Numbers ≤0 are in none. An element of the intersection must pass every test, so one failing set removes it.
The intersection is (0,1], which is not open. The point 1 is in it, but every ball (1−r,1+r) contains numbers above 1. The minimum trick fails: the radii that fit around 1 in the n-th set are n1, and min of infinitely many of those is 0.
Answer. The intersection is (0,1], not open. The word “finite” in part (c) cannot be dropped. ■
Taking complements turns this theorem into one about closed sets. By De Morgan’s laws (0.3), X∖⋂Fα=⋃(X∖Fα) and X∖(F1∪⋯∪Fm)=⋂(X∖Fi).
Corollary TAbbott Sec. 3.2; Rudin Thm 2.24
Intersections and finite unions of closed sets
In a metric space: (a) ∅ and X are closed. (b) Any intersection of closed sets is closed. (c) A union of finitely many closed sets is closed.
In one line∅ and X 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 ∅ and X are X and ∅, which are open.
∅=X∖X and X=X∖∅, and both X and ∅ are open.
(b) X∖⋂Fα=⋃(X∖Fα) is open, so ⋂Fα is closed.
De Morgan: the complement of an intersection is the union of the complements. Each complement X∖Fα is open, and a union of open sets is open.
(c) X∖(F1∪⋯∪Fm)=⋂(X∖Fi) is open, so the finite union is closed. ■
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∞[n1,1]=(0,1], an infinite union of closed intervals that is not closed (its complement contains 0 but no ball around 0 stays out of (0,1]).
Quick checkWhich statement is correct?
A point of a union uses the ball of one set. A point of an intersection needs one ball that fits in every set, and infinitely many radii can shrink to 0: ⋂n(−n1,n1)={0} is not open.
Interior, limit points, closure, boundary
Take a set A and zoom in on a point x of the space. A small ball around x can do one of three things, and each gives a word.
Definition T
Interior
A point x∈A is an interior point of A if some ball B(x,r) lies inside A. The interior of A, written intA, is the set of its interior points.
In one lineThe interior of A is the set of points of A that have a ball around them inside A.
Why it existsIt strips off the edge of A and keeps the part where you could wiggle in any direction without leaving A.
Definition B
Limit point
A point x of the space (in A or not) is a limit point of A if for every r>0 the ball B(x,r) contains a point of A different from x. A point of A that is not a limit point of A is isolated: some ball around it contains no other point of A.
In one linex is a limit point of A if every ball around x contains a point of A other than x itself.
Why it existsIt describes the points that A crowds around. A limit point need not belong to A, and a point of A need not be a limit point.
Definition B
Closure
The closure of A, written A, is the set of points x such that B(x,r) contains a point of A for every r>0.
In one lineThe closure of A is every point whose every ball touches A: the set A together with its edge.
Why it existsIt adds to A the points it can be approached from, so it is the smallest closed set around A.
Definition T
Boundary
The boundary of A, written ∂A, is the set of points x such that every ball B(x,r) contains a point of A and a point of X∖A.
In one lineThe boundary of A is every point whose every ball touches both A and the complement of A: the edge of A.
Why it existsIt is where A stops. It separates the inside of A from the outside, and for a closed set it is the part that makes the set closed.
Zoom in on x. Either some ball around x lies inside A (then x is in the interior of A), or some ball around x lies inside the complement of A (then x is outside the closure), or every ball around x contains points of both A and its complement (then x is on the boundary). Exactly one of the three happens.
Theorem BRudin Thm 2.27; Abbott Sec. 3.2; Apostol Sec. 8.2
Interior, closure and boundary
For a subset A of a metric space X:
(a) intA is open, it is the largest open set contained in A, and A is open iff A=intA.
(b) X∖A=int(X∖A). Hence A is closed, it is the smallest closed set containing A, and A is closed iff A=A.
(c) A=A∪{limit points of A}.
(d) ∂A=A∖intA.
In one lineintA is the largest open set inside A; A is the smallest closed set containing A and equals A together with its limit points; ∂A=A∖intA.
Why it is trueA point is outside the closure exactly when some ball misses A, 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∈intA with B(x,r)⊆A, then every y∈B(x,r) is also an interior point of A. So B(x,r)⊆intA and intA is open.
Open balls are open (proved above): every y in B(x,r) has a ball around it inside B(x,r)⊆A.
If U is open and U⊆A, then U⊆intA: that is why intA is the largest. And A is open iff all its points are interior iff A=intA.
If U⊆A is open, each of its points has a ball inside U⊆A, so it is an interior point of A.
(b) x∈/A⟺∃r:B(x,r)∩A=∅⟺x∈int(X∖A). So X∖A=int(X∖A).
x∈/A means: some ball B(x,r) contains no point of A. That is the same as B(x,r)⊆X∖A, which is the definition of x∈int(X∖A) (the point x is automatically in X∖A, since it is in its own ball).
So A is closed and is inside every closed set containing A. If A is closed it is one of those sets, so A⊆A; also A⊆A (a point of A is in every one of its balls). Hence A is closed iff A=A.
By (a), int(X∖A) is open, so its complement A is closed. If F is closed and contains A, then X∖F is open and inside X∖A, so inside int(X∖A)=X∖A. Taking complements, A⊆F.
(c) A∪{limit points}⊆A.
A point x∈A is in A because x itself is in every ball around x. A limit point has a point of A in every ball, so it is in A.
Conversely, if x∈A, then x∈A or x is a limit point of A.
If x∈A and x∈/A, every ball around x contains a point of A, and that point cannot be x because x∈/A. So x is a limit point.
(d) x∈A∖intA iff every ball meets A and every ball meets X∖A, which is the definition of x∈∂A. ■
x∈A says every ball meets A. x∈/intA says no ball lies inside A, that is, every ball contains a point outside A (this holds also for x∈/A, since then x itself is outside A and in every ball).
In the picture: the interior is the part of A 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 A.
Worked example
Find the interior, limit points, closure and boundary of A=(0,1]∪{2} in R.
Solution.
Interior. Each point of (0,1) has a ball inside A (shrink toward the nearer end). The point 1 does not: every ball (1−r,1+r) contains numbers above 1. The point 2 does not: every ball around it contains other numbers. So intA=(0,1). The interior throws out every point of A that sits on an edge or alone.
Limit points. Every point of [0,1] is a limit point: every ball around it contains other points of (0,1]. The point 0 qualifies although 0∈/A. The point 2 is not: B(2,21) contains no other point of A, so 2 is isolated. No other number is a limit point. A limit point needs other points of A crowding around it.
Closure.A=A∪{limit points}=[0,1]∪{2} (by part (c) of the theorem). Add the missing edge 0 and keep the isolated point 2.
Boundary.∂A=A∖intA={0,1,2}. Part (d). The three edge points are the places where a small ball sees both A and the outside.
Answer.intA=(0,1); limit points [0,1]; A=[0,1]∪{2}; ∂A={0,1,2}. Note that 2∈∂A though it is an isolated point of A. ■
Quick checkLet A={1,21,31,41,…} in R. Which points are limit points of A?
Any ball around 0 contains n1 for large n, and 0∈/A, so 0 is a limit point outside A. A ball around n1 of radius smaller than the gap to its neighbours contains no other term, so every n1 is isolated, not a limit point. The closure is A∪{0}.
Theorem BAbbott Sec. 3.2; Rudin ch. 2
A closed set contains its limit points
A subset A of a metric space is closed if and only if it contains all of its limit points.
In one lineA set A is closed if and only if every limit point of A belongs to A.
Why it is trueA limit point outside A 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 A.
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 A be closed, let x be a limit point of A, and suppose x∈/A.
Closed means the complement X∖A is open.
There is r>0 with B(x,r)⊆X∖A, so B(x,r) contains no point of A.
Then x∈X∖A, which is open, so x has a ball inside it.
Contradiction, so x∈A.
This contradicts the definition of a limit point: every ball around x must contain a point of A.
(⇐) Suppose A contains all its limit points, and let x∈X∖A.
To show A is closed we show that X∖A is open: take an arbitrary point of it.
So x is not a limit point of A: some ball B(x,r) contains no point of A other than x.
If x were a limit point of A it would be in A by assumption, but x∈/A.
Hence B(x,r)∩A=∅, that is, B(x,r)⊆X∖A. So X∖A is open and A is closed. ■
x∈/A, so x is not a point of A 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.
Let A be closed and let x be a limit point of A. Suppose, for contradiction, that x∈/A.
Then x lies in the complement X∖A.
There is r>0 with B(x,r)⊆X∖A.
So B(x,r) contains no point of A.
This contradicts that x is a limit point, so x∈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 and ∥⋅∥b on a vector space V are equivalent if there are constants 0<m≤M with
m∥x∥a≤∥x∥b≤M∥x∥afor all x∈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 BAbbott Sec. 3.1 exercises; standard
Comparing the 1-, 2- and max-norms
For every x∈Rn,
∥x∥∞≤∥x∥2≤∥x∥1≤n∥x∥2≤n∥x∥∞.
So the three norms are equivalent, with constants depending only on n.
In one lineFor every x∈Rn: ∥x∥∞≤∥x∥2≤∥x∥1≤n∥x∥2≤n∥x∥∞.
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; 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. Take square roots.
The largest of the ∣xj∣ is one of them, call it ∣xi∣. Its square is one term of the sum of squares, and the other terms are ≥0.
(2) ∥x∥12=∑jxj2+2∑j<k∣xj∣∣xk∣≥∑jxj2=∥x∥22. Take square roots.
Expand (∣x1∣+⋯+∣xn∣)2: the squares xj2, plus the cross terms 2∣xj∣∣xk∣ for j<k, which are ≥0.
(3) ∥x∥1=u⋅v≤∥u∥2∥v∥2=n∥x∥2.
Cauchy–Schwarz (2.9) for u=(∣x1∣,…,∣xn∣) and v=(1,…,1). We have ∥u∥2=∥x∥2 and ∥v∥2=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, so ∥x∥2≤n∥x∥∞ and n∥x∥2≤n∥x∥∞. ■
Each xj2≤∥x∥∞2, and there are n terms.
Worked example
Check the chain of inequalities for x=(3,−4,12) in R3, and find vectors where the ends of the chain are attained.
Solution.
Compute the three norms.∥x∥1=3+4+12=19, ∥x∥2=9+16+144=169=13, ∥x∥∞=12. Add the sizes, root of the sum of squares, largest size.
The other two links.n∥x∥2=3⋅13≈22.5 and n∥x∥∞=3⋅12=36. The chain needs n∥x∥2 and n∥x∥∞ as well.
Check the chain.12≤13≤19≤22.5≤36. Every link holds.
Where the chain is tight. For x=(1,0,0) all three norms are 1, so the left links are equalities. For x=(1,1,1): ∥x∥∞=1, ∥x∥2=3, ∥x∥1=3=3⋅3=n⋅1, so the right links are equalities. The constants n and n 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≤36, with both ends of the chain attained by suitable vectors. ■
Your answerFor x=(3,−4,12), what is ∥x∥2?
Square each entry, add, take the square root.
9+16+144=169 and 169=13. (This is the same Pythagorean-style triple as (3,4,12,13).)
Worked example
In R2, which of the points (0.8,0.5) and (0.5,0.5) lie in the open unit ball for d1, d2 and d∞? What is the area of each ball?
Solution.
Compute the three distances from the origin. For (0.8,0.5): d1=1.3, d2=0.64+0.25=0.89≈0.943, d∞=0.8. For (0.5,0.5): d1=1, d2=0.5≈0.707, d∞=0.5. The ball of radius 1 about the origin is every point whose distance is below 1, so we need the distance in each rule.
Compare with the radius, strictly.(0.8,0.5) is in the disc and the square, not in the diamond. (0.5,0.5) is in the disc and the square, and it is NOT in the diamond, because d1=1 is not less than 1: it sits on the edge. The open ball uses strict inequality, so the edge is left out.
Areas. The square (−1,1)2 has area 2×2=4. The disc has area π≈3.14. The diamond has vertices (±1,0), (0,±1): it is two triangles of base 2 and height 1, area 2⋅21⋅2⋅1=2. Diamond, disc and square nest, so the areas must increase: 2≤π≤4.
Answer. Both points are in the disc and the square, neither is in the diamond. The areas are 2, π and 4. ■
What the chain says about the balls: if ∥y∥1<r then ∥y∥2<r, and then ∥y∥∞<r. In balls, around any centre,
B1(x,r)⊆B2(x,r)⊆B∞(x,r)⊆B1(x,nr).
The last inclusion uses ∥y∥1≤n∥y∥∞. In the plane, a diamond of radius r is inside the disc of radius r, which is inside the square of radius r, which is inside the diamond of radius 2r. That is the nesting you saw in the visualizer.
Theorem Bstandard
Equivalent norms give the same open sets
Let ∥⋅∥a and ∥⋅∥b be norms on V with m∥x∥a≤∥x∥b≤M∥x∥a. Then a set U⊆V is open for the metric da if and only if it is open for db.
In one lineIf two norms on V 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 m and M.
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 U be open for da and x∈U, so Ba(x,r)⊆U for some r>0.
Write Ba and Bb for balls in the two metrics. We show Bb(x,mr)⊆Ba(x,r).
If ∥y−x∥b<mr, then m∥y−x∥a≤∥y−x∥b<mr, so ∥y−x∥a<r.
From m∥y−x∥a≤∥y−x∥b.
Hence Bb(x,mr)⊆Ba(x,r)⊆U, and U is open for db.
So the b-ball of radius mr is inside the a-ball of radius r, which is inside U.
The converse follows by swapping the two norms, with M1 in place of m. ■
The same argument with the roles swapped, using ∥y−x∥b≤M∥y−x∥a: if ∥y−x∥a<Mr then ∥y−x∥b<r, so Ba(x,Mr)⊆Bb(x,r).
So on Rn 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 is equivalent. The proof needs compactness (a closed bounded set of Rn 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 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] take fn(x)=xn. Then ∥fn∥∞=1 for every n, but ∥fn∥2=∫01x2ndx=2n+11→0. If ∥f∥∞≤M∥f∥2 held for a fixed M, we would get 1≤2n+1M for all n, which is false for large n. So the sup norm and the 2-norm are not equivalent on 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∣ by d(x,a) in the ε-δ definition of 1.3 and you have continuity of a function between metric spaces: f is continuous at a if for every ε>0 there is δ>0 with dY(f(x),f(a))<ε whenever dX(x,a)<δ. 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 3. Then the open balls B(c,2) of radius 2 around the codewords (all strings at distance ≤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=16 codewords with minimum distance 3 between any two. Each ball of radius 1 contains 1+7=8 strings, and 16×8=128=27, so the 16 balls cover all 128 strings of length 7 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)?
Count the string itself and the strings that differ from it in exactly one position.
The string itself, plus one string for each of the 7 positions you could flip: 1+7=8. Sixteen such balls, one per codeword of the (7,4) code, account for 16×8=128=27 strings, all of them.
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 ε around the image: no pixel moves by more than ε. A common benchmark setting for 32×32 colour images (CIFAR-10), used for example by the RobustBench leaderboard, is ε=2558 with pixel values scaled to run from 0 to 1. The image has n=32⋅32⋅3=3072 numbers. The corner of that cube, where every number moves by the full ε, has 2-norm 25583072≈1.74. So a change of at most about 3% per number can have a Euclidean length as large as 1.74. That is the factor n≈55 from the comparison theorem acting on a 3072-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 0, which is why an ℓ1 penalty (the lasso) produces sparse models. The three balls are three different modelling choices.
Your answerA CIFAR-10 image has n=3072 numbers. If every one changes by exactly ε=2558, what is the 2-norm of the change? (Give a decimal.)
All entries have the same size, so the 2-norm is that size times the square root of the number of entries.
The change vector has 3072 entries, each of size 2558≈0.0314. Its 2-norm is 25583072≈0.0314×55.4≈1.74, which is n times its max-norm, the largest ratio the comparison theorem allows.
Traps
Watch out· Open is not the opposite of closed
A set can be both (∅, the whole space, or any set in the discrete metric), or neither ([0,1) and Q in 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 (⋂(−n1,n1)={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 0.
Watch out· Interior and boundary depend on the space around the set
The interval [0,1] has interior (0,1) as a subset of R. The same segment [0,1]×{0} in the plane has empty interior, because no disc fits inside a segment. “Open” and “boundary” always mean “inside the metric space X you are working in”. In the same way, the open interval (0,1) is open in R but, viewed as the segment (0,1)×{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} and the open ball is {y:d(x,y)<r}. In Rn 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}, whose closure is {x}, while the closed ball of radius 1 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={n1}, 0 is a limit point outside A. Each n1 is in A but not a limit point. The closure is the union of the two kinds. In the proof, the phrase “other than x itself” is not decoration: without it every point of A 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 d2 only. What does hold for every metric is that balls are open sets.
Problems
check
Find d1, d2 and d∞ between (2,0,−1) and (−1,4,−1), and check d∞≤d2≤d1.
Solution
The difference is (3,−4,0). So d1=3+4+0=7, d2=9+16+0=5, d∞=max(3,4,0)=4. And 4≤5≤7.
check
In the discrete metric on R, what are B(3,21), B(3,1) and B(3,2)?
Solution
B(3,21)={3} and B(3,1)={3} (the only distance below 1 is 0). B(3,2)=R, because every distance is at most 1<2.
check
Is Z open in R? Is it closed?
Solution
Not open: every ball (n−r,n+r) around an integer contains non-integers. Closed: its complement is ⋃n(n,n+1), a union of open intervals, hence open.
check
Write the negation of ”U is open” using quantifiers.
Solution
∃x∈U∀r>0:B(x,r)⊆U. That is, some point of U has no ball around it inside U, which is what we showed for the point 0 in [0,1).
use
Find the interior, closure and boundary of A=(0,1)∪(1,2)∪{3} in R.
Solution
Interior: (0,1)∪(1,2) (the point 3 is isolated, so has no ball inside A). Limit points: [0,2] (the point 1 is a limit point though not in A). Closure: [0,2]∪{3}. Boundary: closure minus interior ={0,1,2,3}.
use
In R2 find the area of the open ball of radius 1 about the origin for d1, d2, d∞. Which of the points (0.6,0.6) and (0.5,0.5) lie in each ball?
Solution
d1: the diamond with vertices (±1,0),(0,±1) has area 2. d2: area π. d∞: the square (−1,1)2 has area 4. The point (0.6,0.6) has d1=1.2, d2≈0.85, d∞=0.6, so it is in the disc and the square but not the diamond. The point (0.5,0.5) has d1=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) around a fixed string a? How many strings are at distance exactly 3?
Solution
Distance less than 3 means at most 2 flips: (06)+(16)+(26)=1+6+15=22. Exactly 3 flips: (36)=20.
use
Use the comparison theorem to show that if ∥x∥∞<101 for x∈R4, then ∥x∥1<0.4 and ∥x∥2<0.2.
Solution
∥x∥1≤n∥x∥∞=4⋅∥x∥∞<0.4. And ∥x∥2≤n∥x∥∞=2∥x∥∞<0.2.
prove
Use the reverse triangle inequality to prove that for any four points x,y,w,z of a metric space, ∣d(x,y)−d(w,z)∣≤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 x to w: ∣d(x,y)−d(w,y)∣≤d(x,w). Change the second point from y to z: ∣d(w,y)−d(w,z)∣≤d(y,z). Now ∣d(x,y)−d(w,z)∣≤∣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). ■ (This is what makes d a continuous function of both of its inputs, used in 4.2.)
proveMATH 375 HW 11 (Apostol 8.3 #4a)
Prove: if A is open and x∈A, then A∖{x} is open. (Work in any metric space.)
Solution
Plan. A point y of A∖{x} has a ball inside A; shrink it so that it also misses x.
Let y∈A∖{x}. Since A is open, B(y,r)⊆A for some r>0. Since y=x, d(x,y)>0 by (M1). Let r′=min(r,d(x,y)). Then B(y,r′)⊆B(y,r)⊆A, and x∈/B(y,r′) because d(y,x)=d(x,y)≥r′. So B(y,r′)⊆A∖{x}. ■
prove
Prove that the closed ball {y:d(x,y)≤r} is a closed set.
Solution
Plan. Show the complement {y:d(x,y)>r} is open, by the same idea as open balls are open.
Let z satisfy d(x,z)>r, and let s=d(x,z)−r>0. If d(z,y)<s, then by (M3), d(x,z)≤d(x,y)+d(y,z), so d(x,y)≥d(x,z)−d(y,z)>d(x,z)−s=r. So B(z,s) lies in the complement, which is open. Hence the closed ball is closed. ■
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} is closed: for y=x, the ball B(y,d(x,y)) does not contain x (the distance from y to x is not less than d(x,y)), so it lies in X∖{x}, which is therefore open. A finite set is a finite union of singletons, hence closed by the corollary on finite unions. ■
proveAbbott Sec. 3.2 style; new
Prove that A=A if A is closed, and that A is always closed, using only the definition of closure (every ball around the point meets A).
Solution
Plan. Show the complement of A is open directly, with the open-ball proposition.
Closedness of A: let x∈/A. Some ball B(x,r) misses A. Every y∈B(x,r) has a ball B(y,s)⊆B(x,r) (open balls are open), and B(y,s) misses A too, so y∈/A. So B(x,r)⊆X∖A, which is open, and A is closed. If A is closed and x∈/A, then X∖A is open, so some ball around x misses A, so x∈/A. Thus A⊆A, and always A⊆A. ■
stretch
Prove that d(x,y)=1+∣x−y∣∣x−y∣ is a metric on R. (Hint: f(t)=1+tt is increasing, and f(a+b)≤f(a)+f(b) for a,b≥0.)
Solution
Plan. (M1) and (M2) are easy. For (M3), apply the increasing function f to the real triangle inequality and then split.
(M1): f(t)≥0 with equality iff t=0, and ∣x−y∣=0 iff x=y. (M2): ∣x−y∣=∣y−x∣. (M3): f is increasing because f(t)=1−1+t1. With a=∣x−y∣, b=∣y−z∣ we have ∣x−z∣≤a+b, so d(x,z)=f(∣x−z∣)≤f(a+b). Then f(a+b)=1+a+ba+b=1+a+ba+1+a+bb≤1+aa+1+bb=d(x,y)+d(y,z), since each denominator on the left is at least as large as the one on the right. ■ (This metric never exceeds 1 but has the same open sets as ∣x−y∣; only the ball sizes change.)
stretch
Show that the open 1-ball of radius r in Rn has volume cnrn with cn=n!2n, while the max-ball has volume 2nrn. For n=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 rn, so write vol=cnrn (for n=1, c1=2). Slicing at height t∈(−r,r) in the last coordinate leaves an (n−1)-dimensional diamond of radius r−∣t∣, of volume cn−1(r−∣t∣)n−1. So cnrn=2∫0rcn−1(r−t)n−1dt=2cn−1nrn, giving cn=n2cn−1, hence cn=n!2n. The cube (−r,r)n has volume (2r)n. The ratio is n!1, which for n=10 is 36288001≈2.8×10−7. In ten dimensions the diamond fills almost none of the cube it is inscribed in, so “being close” in d1 is a far more demanding requirement than in d∞.
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 ε-proofs of Unit 1 used.
A norm (never negative, zero only at O, scales by ∣c∣, triangle inequality) gives a metric ∥x−y∥. The 1-, 2- and max-norms on Rn and the sup norm on C[a,b] are norms. The discrete metric and Hamming distance are metrics that come from no norm.
The open ballB(x,r) is the points at distance strictly less than r. It is a diamond, disc or square for d1, d2, d∞.
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 (⋂(−n1,n1)={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}, ∂A=A∖intA, and A is closed iff it contains its limit points.
∥x∥∞≤∥x∥2≤∥x∥1≤n∥x∥2≤n∥x∥∞, so on Rn 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.
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.