Topic

Möbius maps

The maps z ↦ (az + b)/(cz + d) are the conformal bijections of the Riemann sphere. With complex rational coefficients they are exact: rational points go to rational points, circles to circles, and the cross-ratio of four points never changes.

const T = mobiusFrom([0, 1, infinity], ["i", 1, -1]);   // the one map sending three points to three
T.apply("1/2");                       // an exact complex rational
crossRatio(2, "i", 0, infinity);      // -2i
concyclic(1, "i", -1, "-i");          // true: the cross-ratio is real
mobius(1, 1, 1, 0).classify();        // "loxodromic"
circle(0, 1).map(cayley().inverse()); // the line y = 0, exactly

The maps

A Möbius map is given by a matrix (abcd)\begin{pmatrix} a & b \\ c & d\end{pmatrix} with ad−bc≠0ad - bc \ne 0, and composing maps multiplies matrices. Multiplying the matrix by a number gives the same map, so equals compares matrices up to a factor. The point at infinity is infinity: −d/c-d/c goes there, and it goes to a/ca/c.

Any three distinct points can be sent to any three by exactly one Möbius map. mobiusFrom builds it as Sw−1∘SzS_w^{-1} \circ S_z, where SzS_z sends z1,z2,z3z_1, z_2, z_3 to 0, 1, ∞ (any of them may be ∞).

The cross-ratio

(z1,z2;z3,z4)=(z1−z3)(z2−z4)(z2−z3)(z1−z4) (z_1, z_2; z_3, z_4) = \frac{(z_1 - z_3)(z_2 - z_4)}{(z_2 - z_3)(z_1 - z_4)}

is the image of z1z_1 under the map sending z2,z3,z4z_2, z_3, z_4 to 1, 0, ∞, and so every Möbius map keeps it. It is real exactly when the four points lie on one circle or line, which makes concyclic an exact test.

What kind of map

The number τ=(a+d)2/(ad−bc)\tau = (a + d)^2/(ad - bc) does not change when the matrix is scaled or the map is conjugated, and it decides what the map does near its fixed points:

  • parabolic, τ = 4: one fixed point, like z ↦ z + 1;
  • elliptic, τ real in [0, 4): a rotation about two fixed points, like z ↦ e^{iθ}z;
  • hyperbolic, τ real and greater than 4: a stretch from one fixed point towards the other, like z ↦ 2z;
  • loxodromic, otherwise: a stretch and a turn together.

With rational coefficients τ is a complex rational and the test is exact. The fixed points solve cz2+(d−a)z−b=0cz^2 + (d - a)z - b = 0. When the square root of the discriminant is a complex rational they are exact; otherwise they come back as certified rectangles, such as the golden ratio for z ↦ 1 + 1/z.

Circles and lines

Write a circle or a line as A∣z∣2+Bˉz+Bzˉ+C=0A|z|^2 + \bar B z + B\bar z + C = 0 with A and C rational and B a complex rational. When A ≠ 0 it is the circle with centre −B/A-B/A and radius² (∣B∣2−AC)/A2(|B|^2 - AC)/A^2, and when A = 0 it is a line. The form is a Hermitian matrix H, and a Möbius map M sends it to (M−1)∗HM−1(M^{-1})^* H M^{-1}, so the image of a circle is computed exactly, without sampling, and a circle through the pole becomes a line. circle(c, r2), lineThrough and circleThrough build them, and contains tests a point exactly.

callreturns
mobius(a, b, c, d), mobiusFrom(from, to)Mobius: apply, compose, inverse, equals, det, traceSquared, classify, fixedPoints, isSphereRotation, applyFloat
infinity, isInfinity(z)The point at infinity
crossRatio(z1, z2, z3, z4), concyclic(…)A Complex or infinity; a boolean
circle(center, r2), lineThrough(z1, z2), circleThrough(z1, z2, z3)GCircle: isLine, center, radius2, value, contains, equals, map(T)
Try itEdit the code and run it with @ratmath/complex and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.
Ctrl/⌘ + Enter runs