Ok. So this is my first attempt to go through this topic. This might be wrong and comments/corrections are appreciated.
Yesterday, I read the book Basic Topology by M. A. Armstrong on the second chapter. The section introduced the concept of Peano curves, or more commonly known, space-filling curves.
The section introduced a sequence of function that maps [0,1] to Δ (Δ is the equilateral triangle with side length 1), which is recursively defined (in a weird way that I don't know how to explain).
Now, I want to go through the theory of space-filling curves once again, but rigorously prove that "The Hilbert curve maps [0,1] to [−1,1]×[−1,1] continuously with respect to the Euclidean norm in 1D and 2D".
Ahhh... Defining the Hilbert curve rigorously will be a pain, but I gonna give it a try.
Definition. (Hilbert curves of order n) Let us denote n-th order Hilbert curve as Hn, which we define as a function from [0,1] to [−1,1]×[−1,1]. We define H1 as
for all 0≤t≤1. Where R=(01−10) is the (90° counter-clockwise) rotation matrix, and each point is viewed as a column vector when multiplied by this matrix.
Now, we have the curves defined as in the following figure:
The uniform convergence
Recall the definition of uniform convergence (from the course I'm studying: MAA207)
Defintion. For a sequence of functions (fn)n where each function is defined on a subset S⊆R to R is said to be:
Pointwise convergent if for all x∈S, limn→∞fn(x) exists, and we denote by f the limit, i.e. f(x)=limn→∞fn(x).
Uniformly converges tof if for all ε>0 there exists N∈N such that for all n≥N, ∣fn(x)−f(x)∣<ε for all x∈S. In other words, (fn)n is uniformly convergent if and only if ∥fn−f∥∞n→∞0
It is proved in the course that if a sequence of functions (fn)n uniformly converges to f then it converges pointwise to f also.
Now, I'm going to extend the notion of uniform convergence from "functions from a subset of reals to reals" to "functions from a subset of normed vector space to normed vector space".
Definition. Let (E,NE) be a normed vector space, and let (F,NF) be another normed vector space. We say that a sequence of functions (fn)n where each function is defined from a subset Ω⊆E to F is said to be uniformly convergent if for all ε>0 there exists N∈N such that for all n≥N, for all x∈Ω, NF(fn(x)−f(x))<ε. In other words,
x∈ΩsupNF(fn(x)−f(x))n→∞0
Back to our case of Hilbert curves, we've already defined the sequence (Hn)n where Hn:[0,1]→[−1,1]×[−1,1] for all n≥1.
Now, let us define a norm on [−1,1]×[−1,1]. For the sake of simplicity, let us take the Euclidean norm ∥⋅∥2 defined by ∥(x,y)∥2=x2+y2. It is not hard to see that this is a norm, because
(Positivity) For any (x,y)∈R2, ∥(x,y)∥2=x2+y2≥0 is well-defined and nonnegative.
(Homogeneity) For any k∈R and any (x,y)∈R2, ∣k∣∥(x,y)∥2=∣k∣x2+y2=k2(x2+y2)=(kx)2+(ky)2=∥(kx,ky)∥2=∥k(x,y)∥2
(Definiteness) Suppose (x,y)∈R2 such that ∥(x,y)∥2=0 then we have x2+y2=0. This means x2+y2=0 also, but since x2≥0 and y2=0, we can deduce that x=y=0. This proves that the only solution to ∥u∥2=0 is u=0R2
(Triangle inequality) For any (x1,y1),(x2,y2)∈R2, we have ∥(x1,y1)−(x2,y2)∥22=∥(x1−x2,y1−y2)∥22=(x1−x2)2+(y1−y2)2=x12−2x1x2+x22+y12−2y1y2+y22≤x12+x22+y12+y22+2(x12+y12)(x22+y22)=(x12+y12+x22+y22)2=(∥(x1,y1)∥+∥(x2,y2)∥)2
This proves that ∥u+v∥2≤∥u∥2+∥v∥2 for all u,v∈R2.
Now, let us recall another important tool (from MAA207 but extended here, with some help from MAA202) to help with proving the uniform convergence.
Lemma. (Uniform Cauchy Criterion) Let (E,NE) and (F,NF) be normed vector spaces where F is complete, and let (fn)n be a sequence of functions from Ω⊆E to F. If for all ε>0 there exists N∈N such that for all n,m≥N, supx∈ΩNF(fn(x)−fm(x))<ε then (fn)n uniformly converges. The converse is also true.
Proof.(⇒) Suppose the sequence is Cauchy, i.e. for all ε>0 there exists N∈N such that for all n,n≥N, supx∈ΩNF(fn(x)−fm(x))<ε, then we have that for any x∈Ω, the numerical sequence (fn(x))n is also Cauchy. Since (F,NF) is complete, the numerical sequence converges to something in F, let us define f(x) to this convergent limit, then we have the pointwise convergence of (fn)n to f. Now, let us prove the uniform convergence. By the Cauchy assumption, we have that for any ε>0, there exists N∈N such that for all x∈Ω, NF(fn(x)−fm(x))<2ε for any n,m≥N. By the pointwise convergence at x, there exists N′∈N such that for all m≥N′, NF(fm(x)−f(x))<2ε. Fix n and let m≥max(N′,N) then NF(fn(x)−f(x))≤NF(fn(x)−fm(x))+NF(fm(x)−f(x))<2ε+2ε=ε
Note that N′ depends on x but not for N ! This means we can safely say that for any ε>0 there exists N∈N such that for all n≥N for all x∈Ω, NF(fn(x)−f(x))<ε. Hence, uniformly convergent. This completes the first half of the proof.
(⇐) Suppose (fn)n uniformly converges to f. Then let us prove that for all ε>0 there exists N∈N such that for all n,m≥N, for all x∈Ω, NF(fn(x)−fm(x))<ε. Let ε>0 be given, then by the uniform convergence, we can find N∈N such that for all n≥N, for all x∈Ω, NF(fn(x)−f(x))<2ε. The rest is easy because for any n,m≥N we have NF(fn(x)−fm(x))≤NF(fn(x)−f(x))+NF(f(x)−fm(x))<2ε+2ε=ε for any x∈Ω. This completes the proof. □
Now, the last piece of the jigsaw is to prove that F=[−1,1]×[−1,1] equipped with NF=∥⋅∥2 is a complete normed vector space, then for the rest of this piece of text, we will consider E=[0,1],NE=∣⋅∣ and F=[−1,1]×[−1,1],NF=∥⋅∥2 as our normed vector spaces.
Before that, consider the following lemma.
Lemma.((xn,yn))n∈([−1,1]×[−1,1])N with respect to the norm ∥⋅∥2 is convergent if and only if (xn)n and (yn)n are both convergent in (R,∣⋅∣). Moreover, n→∞lim(xn,yn)=(n→∞limxn,n→∞limyn)
Proof.(⇒) Suppose ((xn,yn))n converges to ((x⋆,y⋆)) then for any ε>0 there exists N∈N such that for all n≥N, ∥(xn,yn)−(x⋆,y⋆)∥2<ε. This means (xn−x⋆)2+(yn−y⋆)2<ε2. So (xn−x⋆)2<ε2 and (yn−y⋆)2<ε2. Hence, ∣xn−x⋆∣<ε and ∣yn−y⋆∣<ε. This means (xn)n and (yn)n both converges to x⋆ and y⋆ respectively, in (R,∣⋅∣).
(⇐) Suppose (xn)n converges to x⋆ and (yn)n converges to y⋆, in (R,∣⋅∣). Then for any ε>0 there exists Nx,Ny∈N such that for all n≥Nx, ∣xn−x⋆∣<2ε and for all n≥Ny, ∣yn−y⋆∣<2ε. This is enough to deduce that ∥(xn,yn)−(x⋆,y⋆)∥2=(xn−x⋆)2+(yn−y⋆)2<2ε2+2ε2=ε. Hence, ((xn,yn))n converges to (x⋆,y⋆) in ([−1,1]×[−1,1],∥⋅∥2)□
Now, the completeness of ([−1,1]×[−1,1],∥⋅∥2) follows directly.
Theorem.([−1,1]×[−1,1],∥⋅∥2) is a complete normed vector space.
Proof. Suppose a sequence ((xn,yn))n∈([−1,1]×[−1,1])N is Cauchy. That is, for all ε>0, there exists N∈N such that for all n,m≥N, ∥(xn,yn)−(xm,ym)∥2<ε. This means (xn−xm)2+(yn−ym)2<ε2, and so, ∣xn−xm∣<ε and ∣yn−ym∣<ε. This means (xn)n and (yn)n are both Cauchy, but (R,∣⋅∣) is complete, so they converge. By the previous lemma, we deduce that ((xn,yn))n also converges in ([−1,1]×[−1,1],∥⋅∥2). This concludes that all Cauchy sequences converge. Hence ([−1,1]×[−1,1],∥⋅∥2) is complete. □
Phew... that was quite long. What we've proved so far is that ([−1,1]×[−1,1],∥⋅∥2) is complete and so we can use the uniform Cauchy criterion to prove uniform continuity for any sequence of functions.
This, but now, the sequence of Hilbert curves
Lemma. For all x∈[0,1], for any n∈N≥2, ∥Hn(x)−Hn+1(x)∥≤2n−11
Proof. Now, this, in order to make a rigorous enough proof, is the real tedious process. Recall the definition of Hn (let's not rewrite it here otherwise it will be a big mess), we see that there are 7 cases, depending on n, we have the partition of [0,1] into 7 subsegments with the following 8 endpoints:
The following figure is a visualization of the subsegments. Row y=i shows the subsegments of Hi. Hence, in each row, there are 7 color bars. However, the connectors (orange, red and brown) become shorter rapidly.
Now, we observe easily that for a fixed n, any t∈[0,1]. If t is inside the blue, green, purple or pink subsegment of Hn, then it is also in the same colored subsegment of Hn+1. In mathematical terms, this is equivalent to saying that
t lies in the orange, red or brown subsegment of Hn+1. It follows immediately that ∥Hn(t)−Hn+1(t)∥2≤2n−11 because the length of the subsegment of the same color in Hn is 2n−11.
t lies in the other subsegments of Hn+1. This is harder. Take a look at the following figure, which shows H3 and H4 in the same plane.
We color the first quadrant with the "colorful" (same palette as before) and color the rest with gold and gray. Observe that any other t that is not in the orange, red nor brown subsegments of Hn+1 must be in the blue, green, purple or pink subsegment. This subsegment, in turn, is actually Hn but transformed. Using this process, we descend from comparing between Hn(t) and Hn+1(t) to 21Hn−1(t′) and 21Hn(t′). If it satisfies the first case, the distance must also be bounded by 2n−11.
Deducing these cases (let us call these "case 2.1") where it recursively matches some orange, red or brown subsegment, we are left with only simple cases (let us call these "case 2.2").
The points with the same color are clearly within Euclidean distance 1. Hence, by zooming from Hn vs Hn+1, the distance is bounded by 2n−11. □
Theorem.(Hn)n with Hn:[0,1]→[−1,1]×[−1,1] for each n∈N>0 is uniformly Cauchy with respect to ∥⋅∥2 norm.
Proof. Let ε>0 be given, then take N≥1+log2(4ε). We have that for all m>n≥N,
∥Hn(x)−Hm(x)∥≤k=n∑m−1∥Hk(x)−Hk+1(x)∥≤k=n∑m−12k−11=k=n−1∑m−22k1=k=n−1∑m−22m−22m−2−k=2m−2∑k=0m−n−12k=2m−22m−n−1=2n4−2m−21≤2N4<ε
holds for all x∈[0,1]. This completes the uniform Cauchy criterion and hence (Hn)n is uniformly Cauchy. □
Proposition. This is an easy observation, but Hn is continuous for all n∈N>0.
Proof. Check that the endpoints are continuous, then since each piece is continuous, the function is continuous. □
Now this is easy. A uniformly convergent sequence of continuous functions is also continuous. We can recall this theorem but let us reprove it here.
Theorem. Let (fn)n be a uniformly convergent sequence of continuous functions from Ω⊆E to F where we equip E with NE and F with NF as their corresponding norms (and the continuity is with respect to the norms). Suppose (fn)n converges to f then f is continuous.
Proof. Let us show that for any x0∈Ω, limx→x0f(x)=f(x0). In other words, for any ε>0 there exists δ>0 such that for all x∈Ω with NE(x−x0)<δ, NF(f(x)−f(x0))<ε. Take ε>0 to be any given value. Then, by uniform continuity, there exists N∈N such that supx∈ΩNF(fN(x)−f(x))<2ε. By continuity of fN, we have that for 2ε, there exists δ>0 such that for all x∈Ω with NE(x−x0)<δ, NF(fN(x)−fN(x0))<2ε.
Now, consider any x∈Ω with NE(x−x0)<δ, then NF(f(x)−f(x0))≤NF(f(x)−fN(x))+NF(fN(x)−fN(x0)) by the triangle inequality. But by uniform continuity, NF(f(x)−fN(x))<2ε. And by continuity of fN, NF(fN(x)−fN(x0))<2ε. This bounds NF(f(x)−f(x0)) strictly under ε, hence completes the proof. □
The mission is done
Since the final Hilbert curve is defined to be the limit of Hn as n tends to infinity, the goal (which is "The Hilbert curve maps [0,1] to [−1,1]×[−1,1] continuously with respect to the Euclidean norm in 1D and 2D") is done.
Now, onto the bonus (pun intended).
Corollary. The final Hilbert curve is surjective from [0,1] to [−1,1]×[−1,1].
Proof. Let (x,y)∈[−1,1]×[−1,1], then we will show that a preimage t∈[0,1] exists, such that H(t)=(x,y).
Let (rn)n≥1 be the sequence defined by rn:=sup{dHn([0,1])(z):z∈[−1,1]×[−1,1]} where dS is defined as dS:z↦infz′∈S∥z−z′∥2. Observe that dS is well-defined and continuous when S is compact. Furthermore, since both Hn([0,1]) and [−1,1]×[−1,1] are compact, the image of [−1,1]×[−1,1] by dHn([0,1]) is compact and so its supremum is well-defined. So rn≥0 is well-defined.
Now, it is enough to show that rn tends to 0 as n tends to ∞, since (along with axiom of choice) this implies for any (x,y)∈[−1,1]×[−1,1], one can select a sequence of points (zn)n such that ∥zn−(x,y)∥2=rn and zn∈Hn([0,1]) for all n≥1. This, by definition, says that (zn) converges to (x,y). Since Hn is injective by definition, and zn∈Hn([0,1]), the preimage wn∈[0,1] such that Hn(wn)=zn is uniquely well-defined. Now, since (wn)n is bounded, by Bolzano-Weierstrass theorem, it has a convergent subsequence. This means that there exists a strictly increasing function ϕ:N→N>0 such that (wϕ(n))n converges to t⋆∈[0,1]. Since H is continuous, then (H(wϕ(n)))n converges to H(t⋆). But H(wϕ(n))=zϕ(n) is a subsequence of (zn)n that converges to (x,y) already. So H(t⋆)=(x,y). i.e. there exists t⋆ as a preimage of (x,y) for any (x,y)∈[−1,1]×[−1,1].
The remaining part is easy to see, hard to prove formally. Observe that any point on [−1,1]×[−1,1] has distance from Hn no more than 2n2. This is because each curve Hn is defined with offset 2n1 to the walls [−1,1]×{−1,1}∪{−1,1}×[−1,1]. By the squeeze theorem, since 0≤rn≤2n2 for all n∈N>0 and limn→∞2n2=0, we conclude that rnn→∞0. This completes the proof. □
Conclusion
Corollary. There exists a continuous and onto function from any compact interval to any convex and compact subset of R2
Proof. (The case of empty domain is trivial and useless. Now consider the rest.) Any nonempty compact interval [a,b] can be mapped into [0,1] using the function f1:x↦b−ax−a. Now, any convex and compact subset can be mapped into from the unit circle. Pick a point (x0,y0) from the convex and compact subset. Then, for each point on the boundary of the convex and compact subset, draw a line segment joining from (x0,y0) to that point. Assign a "progress bar" to the line segment, giving a continuous, "uniform" and bijective map from [0,1] to the line segment. Take the inverse of this map, and union all of them into a function g from the convex and compact subset to [0,1]. Then (x,y)↦(g(x,y),atan2(y,x)) is a continuous and bijective mapping from the convex and compact subset to the polar coordinates [0,1]×[0,2π) describing the unit disk. Call the inverse of this map f3. The rest is easy. We map the filled square [−1,1]×[−1,1] to the unit disk using the inverse of [another map similar to f3] defined using the same method, and rename this map to f2. Then f3∘f2∘H∘f1 is a continuous and onto function from the compact interval to the convex and compact subset of R2. □
Next steps
How about a continuous and onto function from [0,1] to S2={(x,y,z)∈R3:x2+y2+z2=1}? How to construct this? (Ref: Basic Topology by M. A. Armstrong)
Note that Gun Kongarttagarn commented a solution, but I'll read study this later.