{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f2d2bd0b",
   "metadata": {},
   "source": [
    "# Part 5. Going deeper: the circle as a Lie group and an algebraic group\n",
    "\n",
    "```{admonition} Very advanced material\n",
    ":class: warning\n",
    "This part goes beyond the course syllabus. It uses the notions of a manifold, a tangent space and a Lie\n",
    "algebra, and in its second half algebraic groups over an arbitrary ring. Reading it and doing the exercises\n",
    "take extra time. You can skip it without loss for the rest of the chapter, but it is here that you see **why**\n",
    "all the earlier computations worked.\n",
    "```\n",
    "\n",
    "In parts 1–4 we proved each property of the circle by a separate computation: closure by an identity, the\n",
    "composition of Chebyshev polynomials by induction, the derivative formula by induction with the Leibniz rule,\n",
    "minimal polynomials by factorization. These facts are not independent, however. They all follow from a single\n",
    "structure: the unit circle is a **Lie group**, that is, a group that is also a smooth manifold, with smooth\n",
    "group operations. Every Lie group has its **Lie algebra**: the tangent space at the identity element. For the\n",
    "circle this is the line $\\R$, and the exponential map\n",
    "\n",
    "$$\n",
    "\\exp\\colon \\R\\to S^1,\\qquad \\theta\\mapsto(\\cos\\theta,\\ \\sin\\theta)\n",
    "$$\n",
    "\n",
    "is a group homomorphism: addition in the Lie algebra turns into multiplication of points. This fact is deep,\n",
    "because **all** the key properties of the circle become its simple consequences.\n",
    "\n",
    "The second idea of this part is even more interesting. The circle is defined by polynomials: the equation\n",
    "$a^2+b^2=1$ and the formula for the operation. So it is an **algebraic group**, and the analytic notions — the\n",
    "tangent space, a vector field, the derivative — can be replaced by pure algebra. It is enough to compute with\n",
    "**dual numbers** $a+\\varepsilon a'$, where $\\varepsilon^2=0$. Then all the properties that followed from the\n",
    "circle being a Lie group can be derived in a completely formal way, without limits and without real numbers.\n",
    "The computer checks such a computation exactly as in part 1."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f891b1f5",
   "metadata": {},
   "outputs": [],
   "source": [
    "from fractions import Fraction\n",
    "\n",
    "import mpmath\n",
    "import sympy as sp\n",
    "\n",
    "a, b, c, d = sp.symbols(\"a b c d\")\n",
    "u, v, w, s, t, x = sp.symbols(\"u v w s t x\")\n",
    "eps = sp.Symbol(\"epsilon\")\n",
    "\n",
    "\n",
    "def m(P, Q):\n",
    "    \"\"\"Prawo grupowe okręgu (część 1).\"\"\"\n",
    "    a, b = P\n",
    "    c, d = Q\n",
    "    return (a * c - b * d, a * d + b * c)\n",
    "\n",
    "\n",
    "def obetnij(w):\n",
    "    \"\"\"Rachunek na liczbach dualnych: odrzucamy wyrazy z ε², ε³, …\"\"\"\n",
    "    return sp.expand(sp.expand(w).series(eps, 0, 2).removeO())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e91fc5b3",
   "metadata": {},
   "source": [
    "## Dictionary: the Lie group and parts 1–4\n",
    "\n",
    "Before we turn to computations, let us collect how the earlier facts look in the language of Lie groups.\n",
    "The point $P=\\exp(\\theta)$ is the rotation by the angle $\\theta$, and the power $P^n$ is $\\exp(n\\theta)$:\n",
    "taking powers in the group corresponds to **multiplication by $n$ in the Lie algebra**.\n",
    "\n",
    "| Fact from parts 1–4 | In the language of Lie groups |\n",
    "|---|---|\n",
    "| $P^n=(T_n(a),\\ bU_{n-1}(a))$, that is, $T_n(\\cos\\theta)=\\cos n\\theta$ | $\\exp(\\theta)^n=\\exp(n\\theta)$ |\n",
    "| $T_m\\circ T_n=T_{mn}$ | $m(n\\theta)=(mn)\\theta$ |\n",
    "| $T_n'=nU_{n-1}$ | the differential of the power map $P\\mapsto P^n$ at $e$ is multiplication by $n$ |\n",
    "| Chebyshev's equation $(1-a^2)T_n''-aT_n'+n^2T_n=0$ | $\\cos n\\theta$ is an eigenfunction of the operator $\\frac{d^2}{d\\theta^2}$ |\n",
    "| points of order $n$: $\\cos\\frac{2\\pi k}{n}$ | the kernel of $\\exp$ is $2\\pi\\Z$, so the points whose order divides $n$ are $\\exp\\bigl(\\frac{2\\pi}{n}\\Z\\bigr)$ |\n",
    "| the parameter $t$ and the operation $\\frac{s+t}{1-st}$ | a local coordinate at $e$; the logarithm is $\\operatorname{arctg}$ |\n",
    "\n",
    "The strongest theorem behind this table says that a connected commutative Lie group is the quotient of its\n",
    "Lie algebra by a discrete subgroup: $S^1\\cong\\R/2\\pi\\Z$. In this way a group “written crookedly” in the plane\n",
    "becomes ordinary addition of numbers modulo $2\\pi$. Analytic proofs of these facts are given by Stillwell\n",
    "(*Naive Lie Theory*) and Hall (*Lie Groups, Lie Algebras, and Representations*); see the literature at the end.\n",
    "\n",
    "## The tangent space without analysis: dual numbers\n",
    "\n",
    "Take the ring of dual numbers $\\Q[\\varepsilon]/(\\varepsilon^2)$ and look for points of the circle “infinitely\n",
    "close” to the identity element, that is, of the form $(1+\\varepsilon u,\\ \\varepsilon v)$. The equation of the\n",
    "circle gives a condition on $u$ and $v$:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "590125dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"(1 + εu)² + (εv)² - 1 =\", obetnij((1 + eps * u)**2 + (eps * v)**2 - 1))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ec9d9073",
   "metadata": {},
   "source": [
    "Hence $2u=0$, that is, $u=0$ (over a field of characteristic different from $2$), while $v$ is arbitrary. The\n",
    "points $(1,\\varepsilon v)$ form the **tangent space** at $e=(1,0)$: a line parametrized by a single number $v$.\n",
    "This definition requires neither limits nor real numbers, and it works over every field. Let us check how\n",
    "such points multiply:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "04299c5a",
   "metadata": {},
   "outputs": [],
   "source": [
    "iloczyn = m((1, eps * v), (1, eps * w))\n",
    "print(\"(1, εv)·(1, εw) =\", tuple(obetnij(z) for z in iloczyn))\n",
    "Q = (sp.Integer(1), sp.Integer(0))\n",
    "for _ in range(7):\n",
    "    Q = tuple(obetnij(z) for z in m(Q, (1, eps * v)))\n",
    "print(\"(1, εv)^7 =\", Q)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "adbb34db",
   "metadata": {},
   "source": [
    "Multiplying tangent points is **adding** the vectors, $v+w$, and the $n$-th power is multiplication by $n$.\n",
    "This is the Lie algebra of the circle: the space $\\Q$ (or $\\R$, or $\\F_p$) with the Lie bracket equal to zero,\n",
    "because the group is commutative.\n",
    "\n",
    "## The invariant field is the field $D$ from part 2\n",
    "\n",
    "Let us move an arbitrary point $P=(a,b)$ by an infinitesimal rotation $(1,\\varepsilon)$:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "243b8c91",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"P·(1, ε) =\", m((a, b), (1, eps)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d1f1a205",
   "metadata": {},
   "source": [
    "We got $(a-\\varepsilon b,\\ b+\\varepsilon a)=P+\\varepsilon\\,(-b,a)$. For a polynomial $f(a,b)$ this means\n",
    "\n",
    "$$\n",
    "f\\bigl(P\\cdot(1,\\varepsilon)\\bigr)=f(P)+\\varepsilon\\,D f(P),\\qquad D=-b\\,\\partial_a+a\\,\\partial_b,\n",
    "$$\n",
    "\n",
    "which is exactly the vector field $D$ that we used for the derivative in part 2. Now we can see where it came\n",
    "from: it is the **invariant vector field** determined by a tangent vector at $e$ and carried over the whole\n",
    "group by multiplication. Invariance means that $D$ commutes with the translations $L_Q(P)=Q\\cdot P$. Let us\n",
    "check this for a few polynomials $f$:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5475b415",
   "metadata": {},
   "outputs": [],
   "source": [
    "def D(f):\n",
    "    return -b * sp.diff(f, a) + a * sp.diff(f, b)\n",
    "\n",
    "\n",
    "LQ = m((c, d), (a, b))                        # przesunięcie o punkt Q = (c, d)\n",
    "\n",
    "\n",
    "def przesun(f):\n",
    "    return f.subs({a: LQ[0], b: LQ[1]}, simultaneous=True)\n",
    "\n",
    "\n",
    "for f in (a, b, a**3 * b + b**2, a**5 - 7 * a * b**4):\n",
    "    print(f\"f = {str(f):20} D(f∘L_Q) - (Df)∘L_Q =\",\n",
    "          sp.expand(D(przesun(f)) - przesun(D(f))))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "caf6a41d",
   "metadata": {},
   "source": [
    "## The derivative formula without induction\n",
    "\n",
    "In part 2 the formula $T_n'=nU_{n-1}$ required induction with the Leibniz rule. In the language of algebraic\n",
    "groups the proof is shorter and needs no induction. The group is commutative, so\n",
    "\n",
    "$$\n",
    "\\bigl(P\\cdot(1,\\varepsilon)\\bigr)^n=P^n\\cdot(1,\\varepsilon)^n=P^n\\cdot(1,n\\varepsilon).\n",
    "$$\n",
    "\n",
    "The first coordinate of the left-hand side is $T_n(a-\\varepsilon b)=T_n(a)-\\varepsilon\\,b\\,T_n'(a)$ (Taylor's\n",
    "formula over the dual numbers is exact, because $\\varepsilon^2=0$). The first coordinate of the right-hand\n",
    "side is $T_n(a)-n\\varepsilon\\,b\\,U_{n-1}(a)$. Comparing the coefficients of $\\varepsilon$ gives\n",
    "$T_n'=nU_{n-1}$. Every step is an equality in a ring, and for specific $n$ the computer checks it exactly:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "125ca707",
   "metadata": {},
   "outputs": [],
   "source": [
    "zgodne = True\n",
    "for n in range(1, 16):\n",
    "    Tn, Un = sp.chebyshevt(n, a), sp.chebyshevu(n - 1, a)\n",
    "    lewa = obetnij(Tn.subs(a, a - eps * b))\n",
    "    prawa = obetnij(m((Tn, b * Un), (1, n * eps))[0])\n",
    "    zgodne &= sp.expand(lewa - prawa) == 0\n",
    "print(\"T_n(a - εb) = pierwsza współrzędna P^n·(1, nε) dla n ≤ 15:\", zgodne)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4f2d17ed",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "assert zgodne"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0a1f095b",
   "metadata": {},
   "source": [
    "Abstraction did two things here. It shortened the proof: one line instead of induction. It also explained\n",
    "what really happens: the differential of the power map at $e$ is multiplication by $n$ in the Lie algebra, and\n",
    "the rest is carrying this fact over the group.\n",
    "\n",
    "## The formal logarithm and Machin's formula\n",
    "\n",
    "In part 1 we parametrized the circle by the number $t$ (the slope of a line through $(-1,0)$), and\n",
    "multiplication of points turned into the operation\n",
    "\n",
    "$$\n",
    "F(s,t)=\\frac{s+t}{1-st}.\n",
    "$$\n",
    "\n",
    "Since $F(s,0)=s$, $F(s,t)=F(t,s)$ and $F$ is associative, while its power series at $0$ has integer\n",
    "coefficients, $F$ is a **formal group law**: the circle group viewed in a neighborhood of the identity element.\n",
    "Every one-dimensional formal group law over $\\Q$ has a **logarithm**: a series $\\log_F$ with\n",
    "$\\log_F(t)=t+\\dots$ such that $\\log_F(F(s,t))=\\log_F(s)+\\log_F(t)$. The logarithm thus carries the group\n",
    "operation over to addition in the Lie algebra. For the circle it is\n",
    "\n",
    "$$\n",
    "\\operatorname{arctg} t=t-\\frac{t^3}{3}+\\frac{t^5}{5}-\\dots\n",
    "$$\n",
    "\n",
    "Let us check this as an equality of formal series up to degree $15$:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "41fd138a",
   "metadata": {},
   "outputs": [],
   "source": [
    "N = 16\n",
    "log_F = sum((-1)**k * x**(2 * k + 1) / (2 * k + 1) for k in range(N // 2))\n",
    "F = (s + t) / (1 - s * t)\n",
    "roznica = log_F.subs(x, F) - log_F.subs(x, s) - log_F.subs(x, t)\n",
    "szereg = sp.series(sp.series(roznica, s, 0, N).removeO(), t, 0, N).removeO()\n",
    "reszta = [mon for mon in sp.Poly(sp.expand(szereg), s, t).monoms()\n",
    "          if sum(mon) < N]\n",
    "print(\"wyrazy stopnia < 16 w log_F(F(s,t)) - log_F(s) - log_F(t):\", reszta)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f08a8bae",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "assert reszta == []"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0eb31310",
   "metadata": {},
   "source": [
    "Now comes a new phenomenon that is hard to expect without this abstraction. Let us compute, in the group of\n",
    "rational points of the circle and in the parameter $t$, the expression $4\\cdot\\frac15\\ominus\\frac1{239}$, that\n",
    "is, “four times the point $t=\\frac15$ and once the inverse of the point $t=\\frac1{239}$”:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b3c170b9",
   "metadata": {},
   "outputs": [],
   "source": [
    "def F_wym(s, t):\n",
    "    return (s + t) / (1 - s * t)\n",
    "\n",
    "\n",
    "z = Fraction(0)\n",
    "for _ in range(4):\n",
    "    z = F_wym(z, Fraction(1, 5))\n",
    "print(\"4·(1/5) =\", z, \"   4·(1/5) ⊖ 1/239 =\", F_wym(z, Fraction(-1, 239)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "198d2838",
   "metadata": {},
   "source": [
    "The result is exactly $t=1$, the point corresponding to the angle $\\frac{\\pi}{2}$ ($t$ is the tangent of half\n",
    "the angle). The logarithm is a homomorphism, but only up to the kernel of the exponential map; this is why\n",
    "we get\n",
    "\n",
    "$$\n",
    "4\\operatorname{arctg}\\tfrac15-\\operatorname{arctg}\\tfrac1{239}\\in\\tfrac{\\pi}{4}+\\pi\\Z .\n",
    "$$\n",
    "\n",
    "Which value? A rough estimate $0<\\arctan x<x$ for $x>0$ is enough: the left-hand side lies in the interval\n",
    "$\\bigl(-\\frac1{239},\\ \\frac45\\bigr)$, and the only element of $\\frac\\pi4+\\pi\\Z$ in this interval is\n",
    "$\\frac\\pi4$. This is how **Machin's formula** (1706) arises:\n",
    "\n",
    "$$\n",
    "\\frac{\\pi}{4}=4\\operatorname{arctg}\\frac15-\\operatorname{arctg}\\frac1{239},\n",
    "$$\n",
    "\n",
    "which was used until the mid-20th century to compute record approximations of $\\pi$. Let us compute $\\pi$\n",
    "exactly with fractions, summing $40$ terms of each of the two series:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2bc93d48",
   "metadata": {},
   "outputs": [],
   "source": [
    "def arctg_ulamek(q, wyrazy):\n",
    "    return sum(Fraction((-1)**k, 2 * k + 1) * q**(2 * k + 1)\n",
    "               for k in range(wyrazy))\n",
    "\n",
    "\n",
    "pi_machin = 4 * (4 * arctg_ulamek(Fraction(1, 5), 40)\n",
    "                 - arctg_ulamek(Fraction(1, 239), 40))\n",
    "mpmath.mp.dps = 70\n",
    "pi_przybl = mpmath.mpf(pi_machin.numerator) / pi_machin.denominator\n",
    "blad = abs(pi_przybl - mpmath.pi)\n",
    "print(\"π ≈\", mpmath.nstr(pi_przybl, 55))\n",
    "print(\"błąd ≈\", mpmath.nstr(blad, 3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8a982d46",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "assert blad < mpmath.mpf(\"1e-50\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3f844bc4",
   "metadata": {},
   "source": [
    "The identity $4\\cdot\\frac15\\ominus\\frac1{239}=1$ is an ordinary computation with fractions in the group of\n",
    "rational points of the circle. Only the logarithm, that is, the passage to the Lie algebra, turns it into a\n",
    "fast formula for $\\pi$.\n",
    "\n",
    "## One group, different forms\n",
    "\n",
    "Over the complex numbers the circle becomes the **multiplicative group** $\\C^\\times$. The map\n",
    "$(a,b)\\mapsto a+ib$ has the inverse\n",
    "\n",
    "$$\n",
    "z\\mapsto\\Bigl(\\frac{z+z^{-1}}{2},\\ \\frac{z-z^{-1}}{2i}\\Bigr),\n",
    "$$\n",
    "\n",
    "and multiplication of numbers $z$ corresponds to multiplication of points:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "edd97d52",
   "metadata": {},
   "outputs": [],
   "source": [
    "z1, z2 = sp.symbols(\"z_1 z_2\")\n",
    "\n",
    "\n",
    "def punkt(z):\n",
    "    return ((z + 1 / z) / 2, (z - 1 / z) / (2 * sp.I))\n",
    "\n",
    "\n",
    "print(\"na okręgu:\", sp.simplify(punkt(z1)[0]**2 + punkt(z1)[1]**2))\n",
    "print(\"punkt(z₁)·punkt(z₂) - punkt(z₁z₂) =\",\n",
    "      [sp.simplify(p - q)\n",
    "       for p, q in zip(m(punkt(z1), punkt(z2)), punkt(z1 * z2))])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fdc90293",
   "metadata": {},
   "source": [
    "Over $\\R$ this is not so: the circle has the point $(0,1)$ of order $4$, while in $\\R^\\times$ the only element\n",
    "of finite order other than $1$ is $-1$, so the groups are not isomorphic. Over $\\F_p$ we saw both possibilities\n",
    "in part 4: $p-1$ points (when $-1$ is a square, the circle “is” the group $\\F_p^\\times$) and $p+1$ points (when\n",
    "it is not). The circle is a **form** of the multiplicative group (an *algebraic torus*): two algebraic groups\n",
    "that become the same after a field extension may differ over the original field. This idea leads to Galois\n",
    "cohomology and the theory of algebraic tori.\n",
    "\n",
    "## Characteristic $p$: the differential can vanish\n",
    "\n",
    "Over $\\F_p$ the Lie algebra of the circle is $\\F_p$, and the differential of the power map $P\\mapsto P^p$ is\n",
    "multiplication by $p$, that is, **zero**. In characteristic zero this cannot happen. Which polynomial has zero\n",
    "derivative? For example $x^p$, because $(x^p)'=px^{p-1}=0$ in $\\F_p$. Indeed, for an odd prime $p$:\n",
    "\n",
    "$$\n",
    "T_p(x)\\equiv x^p\\pmod p .\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9f57caba",
   "metadata": {},
   "outputs": [],
   "source": [
    "frobenius = {p: sp.Poly(sp.chebyshevt(p, x) - x**p, x).trunc(p).is_zero\n",
    "             for p in sp.primerange(3, 60)}\n",
    "print(\"T_p(x) ≡ x^p (mod p) dla nieparzystych p < 60:\",\n",
    "      all(frobenius.values()))\n",
    "print(\"T_2(x) mod 2 =\", sp.Poly(sp.chebyshevt(2, x), x).trunc(2).as_expr())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "79ae3c7c",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "assert all(frobenius.values())"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0dbac856",
   "metadata": {},
   "source": [
    "The proof is one line in the ring $\\F_p[i]$: $(a+ib)^p=a^p+i^pb^p$, and $i^p=\\pm i$ for odd $p$, so the first\n",
    "coordinate of $P^p$ is $a^p$. Raising to the $p$-th power turns into the **Frobenius endomorphism**. This\n",
    "phenomenon — a map that is a bijection on points but has zero differential — does not exist for Lie groups\n",
    "over $\\R$. It was discovered only by the theory of algebraic groups. Among other things, it implies that in\n",
    "characteristic $p$ the circle has no points of order $p$. Frobenius also plays the main role in the proof of the\n",
    "Lucas–Lehmer test from part 4: when $q$ is an odd prime and $M_q$ is prime, raising to the power $M_q$ acts on the points of the\n",
    "hyperbola $x^2-3y^2=1$ like the conjugation $x+y\\sqrt3\\mapsto x-y\\sqrt3$, so the order of the point $(2,1)$\n",
    "divides $M_q+1=2^q$.\n",
    "\n",
    "## What abstraction gives us\n",
    "\n",
    "The notions of a Lie group and an algebraic group are not empty names. In this chapter they did three things.\n",
    "\n",
    "* **They organized the proofs.** The facts from parts 2 and 3 are a single observation, “taking powers is\n",
    "  multiplication by $n$ in the Lie algebra”, seen from different sides.\n",
    "* **They shortened the proofs.** The formula $T_n'=nU_{n-1}$ follows from the commutativity of the group in\n",
    "  one line, without induction.\n",
    "* **They revealed new phenomena.** Machin's formula for $\\pi$ is the logarithm of an identity in the group of\n",
    "  rational points. The circle and $\\C^\\times$ are the same group over $\\C$, but different over $\\R$ and over\n",
    "  $\\F_p$. In characteristic $p$ the differential of the power map vanishes and Frobenius appears.\n",
    "\n",
    "The power of mathematics lies in the fact that such organized abstractions naturally shorten and organize\n",
    "proofs, and along the way reveal phenomena that were not visible before.\n",
    "\n",
    "## Exercises\n",
    "\n",
    "The exercises are formal: each can be solved by a computation with polynomials or dual numbers and checked\n",
    "in SymPy.\n",
    "\n",
    "1. **Hopf algebra.** The coordinate ring of the circle is $A=\\Q[a,b]/(a^2+b^2-1)$. The group operation is\n",
    "   given by the homomorphism $\\Delta\\colon A\\to A\\otimes A$, $a\\mapsto a\\otimes a-b\\otimes b$,\n",
    "   $b\\mapsto a\\otimes b+b\\otimes a$. Write down the counit $e^*(a)=1$, $e^*(b)=0$ and the antipode\n",
    "   $S(a)=a$, $S(b)=-b$, and then check the Hopf algebra axioms symbolically. Which axiom is the associativity\n",
    "   from part 1, and which one is the inverse element?\n",
    "2. **Invariant differentials.** Show that the form $\\omega=\\frac{db}{a}=-\\frac{da}{b}$ is invariant under\n",
    "   translations and that $\\omega(D)=1$. Write $\\omega$ in the parameter $t$ and integrate formally: why do you\n",
    "   get $2\\operatorname{arctg}t$?\n",
    "3. **Values at $1$.** Using only the points $(1,\\varepsilon v)$ and dual numbers, prove that\n",
    "   $U_{n-1}(1)=n$, and hence $T_n'(1)=n^2$. Then compute $T_n''(1)$ with numbers satisfying $\\varepsilon^3=0$.\n",
    "4. **Machin-like formulas.** Decide in the group of rational points whether\n",
    "   $\\frac\\pi4=\\operatorname{arctg}\\frac12+\\operatorname{arctg}\\frac13$ (Euler) and\n",
    "   $\\frac\\pi4=2\\operatorname{arctg}\\frac12-\\operatorname{arctg}\\frac17$. Hint:\n",
    "   $\\operatorname{arctg}\\frac1x$ is the argument of the Gaussian integer $x+i$, and Machin's formula expresses\n",
    "   the fact that $(5+i)^4(239-i)$ is a real multiple of $1+i$. Compute this product in $\\Z[i]$.\n",
    "5. **The logarithm of the multiplicative group.** For the law $G(s,t)=s+t+st$ (the group $\\C^\\times$ in the\n",
    "   parameter $t=z-1$) find the formal logarithm and compare it with $\\log(1+t)$. Why does the same isomorphism\n",
    "   with $S^1$, written in the parameters, give the equality\n",
    "   $\\operatorname{arctg}t=\\frac{1}{2i}\\log\\frac{1+it}{1-it}$?\n",
    "6. **The kernel of the power map.** Show that in characteristic $0$ (and in characteristic $p\\nmid n$) the\n",
    "   differential of $P\\mapsto P^n$ is invertible, so the equation $P^n=e$ has $n$ solutions over an\n",
    "   algebraically closed field. Compare with the number of roots of $T_n(x)-1$ from part 3 and with the case\n",
    "   $n=p$ in characteristic $p$.\n",
    "7. **Frobenius.** Prove $T_p(x)\\equiv x^p\\pmod p$ for odd primes $p$ and\n",
    "   $T_{p^k}=T_p\\circ\\dots\\circ T_p\\equiv x^{p^k}$. What is the analogue for $U_{p-1}$?\n",
    "8. **The hyperbola.** Repeat the construction of the tangent space, the invariant field and the logarithm for\n",
    "   the group $x^2-Dy^2=1$ from part 4. Which series replaces $\\arctan$? Which phenomenon related to Pell's\n",
    "   equation corresponds to the fact that this group is not compact over $\\R$?\n",
    "\n",
    "## Literature and further reading\n",
    "\n",
    "* J. Stillwell, *Naive Lie Theory*, Springer, 2008 ([DOI](https://doi.org/10.1007/978-0-387-78214-0)) —\n",
    "  Lie groups starting from the circle and the quaternions, accessibly written.\n",
    "* B. C. Hall, *Lie Groups, Lie Algebras, and Representations*, 2nd ed., Springer, 2015\n",
    "  ([DOI](https://doi.org/10.1007/978-3-319-13467-3)) — the standard textbook on matrix groups.\n",
    "* W. C. Waterhouse, *Introduction to Affine Group Schemes*, Springer, 1979\n",
    "  ([DOI](https://doi.org/10.1007/978-1-4612-6217-6)) — algebraic groups via Hopf algebras; the circle and\n",
    "  dual numbers appear from the first chapters on.\n",
    "* J. S. Milne, *Algebraic Groups*, Cambridge University Press, 2017\n",
    "  ([DOI](https://doi.org/10.1017/9781316711736)) and the author's free notes\n",
    "  [Algebraic Groups; Lie Algebras; Lie Groups; Reductive Groups](https://www.jmilne.org/math/CourseNotes/ala.html).\n",
    "* J. H. Silverman, *The Arithmetic of Elliptic Curves*, 2nd ed., Springer, 2009\n",
    "  ([DOI](https://doi.org/10.1007/978-0-387-09494-6)) — a chapter on formal groups; the same notion for\n",
    "  elliptic curves.\n",
    "* F. Lemmermeyer, *Conics — a Poor Man's Elliptic Curves*,\n",
    "  [arXiv:math/0311306](https://arxiv.org/abs/math/0311306) — the arithmetic of conics as groups, the circle\n",
    "  over $\\F_p$, analogies with elliptic curves.\n",
    "* Encyclopedia entries: [Lie group](https://en.wikipedia.org/wiki/Lie_group),\n",
    "  [formal group law](https://en.wikipedia.org/wiki/Formal_group_law),\n",
    "  [algebraic torus](https://en.wikipedia.org/wiki/Algebraic_torus),\n",
    "  [dual number](https://en.wikipedia.org/wiki/Dual_number),\n",
    "  [Machin-like formula](https://en.wikipedia.org/wiki/Machin-like_formula)."
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "default_lexer": "ipython3"
  },
  "kernelspec": {
   "display_name": "Python 3",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
