# The circle group: purely symbolic proofs

The unit circle $a^2+b^2=1$ with the operation

$$
(a,b)\cdot(c,d)=(ac-bd,\ ad+bc)
$$

is a group. This is a simple fact, but an excellent training ground. A single example shows how to **prove
theorems by symbolic computation**: every step ends with a check that the computer performs exactly, with no
approximation. It also shows how a sizable part of classical mathematics follows from one algebraic group:
Chebyshev polynomials, constructions of regular polygons, Pell's equation and a primality test for Mersenne
numbers. The starting point is a computation from class: the group law, checking closure in SymPy, and
comparing `Fraction` with `float`. The chapter has five parts:

* {doc}`o1_grupa` — the group axioms: polynomial identities and **certificates** from the equation of the
  circle, checked by nothing more than expanding brackets; exact powers in `Fraction` and drift in `float`;
  a parametrization of the rational points; a proof that the point $(3/5,4/5)$ has infinite order.
* {doc}`o2_czebyszew` — powers of the point $(a,b)$ define, by induction, the **Chebyshev polynomials** of
  both kinds. The group law yields the recurrence, Pell's equation for polynomials, the composition rule
  $T_m\circ T_n=T_{mn}$, the product formula, the derivative and Chebyshev's differential equation; every
  induction step is a single symbolic check.
* {doc}`o3_pierwiastki` — points of finite order: minimal polynomials of $\cos\frac{2\pi}{n}$ from the
  factorization of $T_n(x)-1$, the pentagon by a formula, the 15-gon by **multiplying points**, the 17-gon by
  Gaussian periods, the heptagon that cannot be constructed, and the list of constructible $n$-gons.
* {doc}`o4_dalej` — the same group elsewhere: the circle over $\mathbb{F}_p$, the hyperbola and Pell's
  equation (the same Chebyshev polynomials), the Lucas–Lehmer test, a preview of elliptic curves.
* {doc}`o5_lie` — **very advanced material**: the circle as a Lie group and as an algebraic group. The Lie
  algebra explains all the earlier properties; dual numbers ($\varepsilon^2=0$) make it possible to derive
  them in a completely formal way. New phenomena follow: Machin's formula for $\pi$, different forms of the
  same group, Frobenius in characteristic $p$. Exercises close the part.

```{admonition} Materials
:class: tip
[The “Circle group” applet](https://bnaskrecki.faculty.wmi.amu.edu.pl/math-comp/en/applets/grupa-okregu.html) —
regular polygons and their minimal polynomials, powers of a rational point that never return to $(1,0)$, and
the 15-gon as a product of points of the triangle and the pentagon.
```

## Map of examples

| Example | What it shows | Where |
|---|---|---|
| $P^{1000}$ in `float` drifts off the circle | exact arithmetic versus rounding | {doc}`o1_grupa`, §1 |
| `na_okregu` returns `False` | `==` in SymPy compares trees, not polynomials | §2 |
| $(ac-bd)^2+(ad+bc)^2=(a^2+b^2)(c^2+d^2)$ | closure as a polynomial identity | §2 |
| $w=h_1(a^2+b^2-1)+h_2(c^2+d^2-1)$ | a certificate: hard to find, easy to check | §3 |
| $s\oplus t=\frac{s+t}{1-st}$ | the group law in the parameter is the tangent addition formula | §5 |
| $A_n\equiv3\pmod5$ | induction with a symbolically checked step | §6 |
| $P^n=(T_n(a),\,bU_{n-1}(a))$ | Chebyshev polynomials defined by the group law | {doc}`o2_czebyszew` |
| $T_m\circ T_n=T_{mn}$ | $(P^n)^m=P^{mn}$ | {doc}`o2_czebyszew` |
| $(1-a^2)T_n''-aT_n'+n^2T_n=0$ | the derivative as motion along the circle | {doc}`o2_czebyszew` |
| $T_{12}(x)-1$ factored | points of order $d$ for $d\mid12$ | {doc}`o3_pierwiastki` |
| $\cos\frac{2\pi}{15}$ from $P_5^2\cdot P_3^{-1}$ | the group instead of a quartic equation | {doc}`o3_pierwiastki` |
| Gaussian periods for $17$ | three quadratic equations instead of degree 8 | {doc}`o3_pierwiastki` |
| the circle over $\mathbb{F}_p$ has $p\mp1$ points | the same group over a finite field | {doc}`o4_dalej` |
| $x^2-61y^2=1$ | Pell's equation and the same Chebyshev polynomials | {doc}`o4_dalej` |
| $s_{k+1}=s_k^2-2$ | the Lucas–Lehmer test as the composition $T_2\circ T_{2^k}$ | {doc}`o4_dalej` |
| $(1,\varepsilon v)\cdot(1,\varepsilon w)=(1,\varepsilon(v+w))$ | the Lie algebra from dual numbers | {doc}`o5_lie` |
| $T_n'=nU_{n-1}$ in one line | abstraction shortens a proof | {doc}`o5_lie` |
| $4\cdot\frac15\ominus\frac1{239}=1$ | the logarithm of the group gives Machin's formula for $\pi$ | {doc}`o5_lie` |
| $T_p(x)\equiv x^p\pmod p$ | in characteristic $p$ the differential of the power map vanishes | {doc}`o5_lie` |

## How to read this chapter

* Lecture 1 (SymPy, `Fraction`) and basic algebra are enough: group, polynomial, minimal polynomial. The
  certificates of part 1 are the same idea as ideal membership in Lecture 6 (§6.3), but they do not require
  Gröbner bases.
* Parts 1–4 can be read in order. Part 5 is much harder: it uses notions from outside the course (manifold,
  tangent space, Lie algebra) and requires extra time.
* Every result is computed when the site is built. Statements about results are guarded by hidden cells with
  `assert`, which stop the build if a computation no longer agrees with the text.
* You need SymPy, NumPy, Matplotlib and mpmath. Running the whole chapter takes a few seconds.
* Each part ends with exercises and a list of literature with links to books, original papers and
  interesting places on the web.

## Key literature

* D. Cox, J. Little, D. O'Shea, *Ideals, Varieties, and Algorithms*, 4th ed., Springer, 2015
  ([DOI](https://doi.org/10.1007/978-3-319-16721-3)) — certificates and ideals (part 1).
* T. J. Rivlin, *Chebyshev Polynomials: From Approximation Theory to Algebra and Number Theory*, 2nd ed.,
  Wiley, 1990 — Chebyshev polynomials (part 2).
* D. A. Cox, *Galois Theory*, 2nd ed., Wiley, 2012 ([DOI](https://doi.org/10.1002/9781118218457)) —
  Gaussian periods and constructions (part 3).
* F. Lemmermeyer, *Conics — a Poor Man's Elliptic Curves*,
  [arXiv:math/0311306](https://arxiv.org/abs/math/0311306) — conics as groups (part 4).
* J. Stillwell, *Naive Lie Theory*, Springer, 2008 ([DOI](https://doi.org/10.1007/978-0-387-78214-0))
  and W. C. Waterhouse, *Introduction to Affine Group Schemes*, Springer, 1979
  ([DOI](https://doi.org/10.1007/978-1-4612-6217-6)) — Lie groups and algebraic groups (part 5).
