Farey Triangle & Cayley Transform
Hyperbolic Geometry · Number Theory · Modular Forms
by Wessen Getachew · Twitter @7dview
Transform Types Available
Standard Cayley: w = i(1+z)/(1-z)
The canonical conformal bijection mapping the Poincaré disk model |z| < 1 to the upper half-plane Im(w) > 0. This is the standard form used in hyperbolic geometry and modular forms theory.
Key mappings: z=0 → w=i, z=1 → w=∞, z=-1 → w=0, unit circle → real axis.
Inverse Cayley: w = i(1-z)/(1+z)
An alternative conformal map also taking disk to upper half-plane, but with reversed orientation along the real axis. Still preserves the hyperbolic metric but maps z=0 → w=i, z=1 → w=0, z=-1 → w=∞.
FTT Transform: w = (z-i)/(z+i)
This is the inverse of the standard Cayley transform. It maps the upper half-plane back to the unit disk. Specifically: upper half-plane Im(z) > 0 → unit disk interior |w| < 1, real axis Im(z) = 0 → unit circle |w| = 1.
Smith Chart: w = (z-1)/(z+1)
A disk-to-disk transformation (|z| < 1 → |w| < 1) widely used in RF/microwave engineering for impedance visualization. Maps the right half-plane to the unit disk, with the real axis mapping to the unit circle. Different fixed points than Cayley transforms.
Möbius (General): w = (az+b)/(cz+d) where ad-bc ≠ 0
The most general linear fractional transformation. These form a group under composition and represent all conformal automorphisms of the Riemann sphere. The constraint ad-bc ≠ 0 ensures invertibility. All other transforms above are special cases with specific (a,b,c,d) values.
Key Properties (Standard Cayley):
- Conformal: Preserves angles locally at every point
- Bijective: One-to-one correspondence between disk and upper half-plane
- Isometry: Maps hyperbolic geodesics to hyperbolic geodesics
- Boundary behavior: Unit circle |z|=1 maps to real axis Im(w)=0
- Interior/exterior: |z| < 1 → Im(w) > 0, |z| > 1 → Im(w) < 0
- Inverse formula: z = (w-i)/(w+i) or equivalently z = (i-w)/(i+w)
Relationships:
- Standard Cayley and FTT are functional inverses: Cayley(FTT(z)) = z
- All transforms preserve circles and lines (map them to circles or lines)
- Composition of Möbius transformations is a Möbius transformation
- The set of all Möbius transformations forms the group PSL(2,ℂ) ≅ Aut(ℂ̂)
Mathematical Overview
This visualization tool explores the profound connections between number theory, hyperbolic geometry, and complex analysis through conformal mappings and modular arithmetic. Four complementary perspectives reveal how rational numbers, prime distributions, and hyperbolic structures interrelate through the lens of the modular group PSL(2,ℤ).
Unit Disk Model (𝔻)
The Poincaré disk model of hyperbolic geometry: {z ∈ ℂ : |z| < 1}. Points from the Farey sequence F_n—the set of all reduced fractions p/q with 0 ≤ p ≤ q ≤ n ordered by value—are mapped to angles 2πp/q on the unit circle ∂𝔻. The Farey triangle connecting these boundary points has the mediant property: for adjacent fractions p/q and r/s in F_n, we have |ps - qr| = 1 (the determinant condition). Prime numbers are positioned at angles 2πp/m where p is prime and m is the modulus, revealing Dirichlet's theorem: primes are equidistributed among residue classes coprime to m, each with asymptotic density 1/φ(m).
Upper Half-Plane via Cayley (ℍ)
The Cayley transform w = i(1+z)/(1-z) provides a conformal equivalence between 𝔻 and the upper half-plane ℍ = {w ∈ ℂ : Im(w) > 0}. This is one of the fundamental isometries of hyperbolic geometry, preserving the hyperbolic metric ds² = |dz|²/(1-|z|²) on 𝔻 and ds² = |dw|²/Im(w)² on ℍ. Geodesics in ℍ appear as semicircles orthogonal to the real axis (or vertical lines). The modular group PSL(2,ℤ) = SL(2,ℤ)/{±I} acts on ℍ via Möbius transformations z → (az+b)/(cz+d) where a,b,c,d ∈ ℤ and ad-bc = 1. This group is generated by S(z) = -1/z and T(z) = z+1, and its quotient ℍ/PSL(2,ℤ) is the modular curve, fundamental to the theory of modular forms and elliptic curves.
Full Complex Plane (ℂ)
The fourth panel extends the Cayley transform to visualize the entire Riemann sphere ℂ̂ = ℂ ∪ {∞}. Since the transform is defined everywhere except at z = -1, we see the complete partition:
• Interior |z| < 1 → Upper half-plane Im(w) > 0
• Unit circle |z| = 1 → Real axis Im(w) = 0
• Exterior |z| > 1 → Lower half-plane Im(w) < 0
The point z = 1 maps to ∞, z = -1 is the pole (undefined), and z = ±i map to the real axis at w = -1 and w = 1 respectively. This complete picture shows how Möbius transformations act as conformal automorphisms of ℂ̂, forming the group PSL(2,ℂ).
Nested Rings Structure (⊚)
Concentric rings represent the structure of (ℤ/mℤ)× for moduli m from min to max. Each ring m displays all residue classes k ∈ {0,1,...,m-1} at angles 2πk/m. Points are colored by gcd(k,m), revealing the multiplicative structure. Gold points (gcd = 1) form the group of units (ℤ/mℤ)×, whose order is given by Euler's totient φ(m). The Chinese Remainder Theorem states that if gcd(m₁,m₂) = 1, then ℤ/(m₁m₂)ℤ ≅ ℤ/m₁ℤ × ℤ/m₂ℤ, visible in the coprime point patterns. Connection modes visualize lifts and transitions: in a modular sequence Mₙ = M₀·bⁿ, a residue r at level n lifts to {r, r+Mₙ, r+2Mₙ, ..., r+(b-1)Mₙ} at level n+1. If gcd(r,M₀) = gcd(r,b) = 1, then coprimality is preserved: gcd(r,Mₙ₊₁) = 1.
Core Mathematical Concepts
- Farey Sequence F_n: The ordered set {p/q : 0 ≤ p ≤ q ≤ n, gcd(p,q) = 1} of all irreducible fractions with denominator at most n. The sequence has exactly 1 + Σ_{k=1}^n φ(k) elements. Mediant property: If p/q and r/s are adjacent in F_n, then |ps - qr| = 1, and their mediant (p+r)/(q+s) first appears in F_{q+s}. The Farey sequence provides a natural parameterization of ℚ ∩ [0,1] and of rational points on the unit circle.
- Cayley Transform: The map w = i(1+z)/(1-z) is a biholomorphic (holomorphic bijection with holomorphic inverse) equivalence 𝔻 → ℍ. It's an isometry of hyperbolic spaces: the Poincaré disk metric ds² = 4|dz|²/(1-|z|²)² corresponds to the upper half-plane metric ds² = |dw|²/Im(w)². The inverse is z = (w-i)/(w+i). Under this map, straight lines in 𝔻 through the origin become vertical lines in ℍ, and circles in 𝔻 orthogonal to ∂𝔻 become semicircles in ℍ orthogonal to ℝ—these are the geodesics of hyperbolic geometry.
- Modular Group PSL(2,ℤ): The quotient SL(2,ℤ)/{±I} where SL(2,ℤ) = {[[a,b],[c,d]] : a,b,c,d ∈ ℤ, ad-bc = 1}. Acts on ℍ by fractional linear transformations γ·z = (az+b)/(cz+d). Generated by S: z ↦ -1/z (order 2) and T: z ↦ z+1 (infinite order), with the single relation (ST)³ = I. The fundamental domain is 𝒟 = {z ∈ ℍ : |z| ≥ 1, |Re(z)| ≤ 1/2}, and ℍ/PSL(2,ℤ) ≅ ℂ, with the quotient map being the j-invariant. This group is central to the theory of modular forms: functions f : ℍ → ℂ satisfying f((az+b)/(cz+d)) = (cz+d)^k f(z) for all [[a,b],[c,d]] ∈ SL(2,ℤ).
- Hyperbolic Geodesics: In the upper half-plane model ℍ, geodesics (paths of shortest hyperbolic distance) are semicircles perpendicular to ℝ, together with vertical rays. The hyperbolic distance between z₁, z₂ ∈ ℍ is d(z₁,z₂) = arccosh(1 + |z₁-z₂|²/(2·Im(z₁)·Im(z₂))). PSL(2,ℤ) acts by isometries, preserving this distance. In the disk model, geodesics are arcs of circles orthogonal to ∂𝔻 (and diameters).
- Dirichlet's Theorem on Primes in Arithmetic Progressions: If gcd(a,m) = 1, the arithmetic progression {a + km : k ≥ 0} contains infinitely many primes, with density 1/φ(m) among all primes. More precisely, π(x; m, a) ~ x/(φ(m) log x) as x → ∞, where π(x; m, a) counts primes p ≤ x with p ≡ a (mod m). This equidistribution is visible in the visualization: primes distribute uniformly among the φ(m) residue classes coprime to m.
- Euler's Totient Function: φ(n) = |{k : 1 ≤ k ≤ n, gcd(k,n) = 1}| counts integers up to n coprime to n. This is multiplicative: if gcd(m,n) = 1, then φ(mn) = φ(m)φ(n). For prime power p^k, we have φ(p^k) = p^k - p^{k-1} = p^{k-1}(p-1). The formula φ(n) = n·∏_{p|n}(1 - 1/p) expresses φ in terms of the prime factorization. The units (ℤ/nℤ)× form a group of order φ(n), and by Euler's theorem, if gcd(a,n) = 1, then a^{φ(n)} ≡ 1 (mod n).
- Möbius Transformations: Functions f(z) = (az+b)/(cz+d) where a,b,c,d ∈ ℂ and ad-bc ≠ 0. These are precisely the conformal automorphisms of the Riemann sphere ℂ̂. They form a group under composition: if f(z) = (az+b)/(cz+d) and g(z) = (ez+f)/(gz+h), then (f∘g)(z) = ((ae+bg)z + (af+bh))/((ce+dg)z + (cf+dh)). The group of Möbius transformations is isomorphic to PSL(2,ℂ) = SL(2,ℂ)/{±I}. Key property: Möbius transformations map circles and lines to circles and lines (where lines are considered circles through ∞).
- Ford Circles: For each rational p/q in lowest terms, the Ford circle C_{p/q} has center (p/q, 1/(2q²)) and radius 1/(2q²) in the upper half-plane. These circles are tangent to the real axis at p/q and are pairwise tangent or disjoint: C_{p/q} and C_{r/s} are tangent iff |ps - qr| = 1 (i.e., they're Farey neighbors). Ford circles provide a beautiful geometric illustration of the Farey sequence and the Stern-Brocot tree structure of rational numbers.
- Residue Lifts in Modular Sequences: Given a geometric sequence of moduli Mₙ = M₀·bⁿ where b ≥ 2, a residue r ∈ ℤ/Mₙℤ lifts to the set {r + kMₙ mod Mₙ₊₁ : k = 0, 1, ..., b-1} in ℤ/Mₙ₊₁ℤ. If gcd(r, M₀) = gcd(r, b) = 1, then coprimality is preserved under lifting: all b lifts satisfy gcd(r + kMₙ, Mₙ₊₁) = 1. This creates a self-similar fractal structure of coprime residues across scales. Gap-g transitions (k, k+g) lift to {(k+jMₙ, k+g+jMₙ) : j = 0,...,b-1}, preserving the gap structure. When combined with prime distribution (Dirichlet), this reveals how primes populate the modular tower.