{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4c09e9fa",
   "metadata": {},
   "source": [
    "# Part 2. Chebyshev polynomials from powers of a point\n",
    "\n",
    "We take powers of a point $P=(a,b)$ of the circle. Each coordinate of $P^n$ is a polynomial in $a$ and $b$, and on\n",
    "the circle we may replace $b^2$ by $1-a^2$. We will see that then the first coordinate depends only\n",
    "on $a$, while the second equals $b$ times a polynomial in $a$. These polynomials are the **Chebyshev polynomials**\n",
    "of the first and second kind, $T_n$ and $U_{n-1}$. We will derive all their basic properties\n",
    "from the group law and check each of them by a symbolic computation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "75b8dde2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import sympy as sp\n",
    "\n",
    "a, b = sp.symbols(\"a b\")\n",
    "JEDEN, ZERO = sp.Integer(1), sp.Integer(0)\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 redukuj(w):\n",
    "    \"\"\"Reszta z dzielenia przez a² + b² - 1 względem b (b² → 1 - a²).\"\"\"\n",
    "    return sp.expand(sp.rem(sp.expand(w), a**2 + b**2 - 1, b))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "34d5eaec",
   "metadata": {},
   "source": [
    "## Powers of a general point\n",
    "\n",
    "Let us compute successive powers of the point with symbolic coordinates $P=(a,b)$. After each multiplication\n",
    "we reduce the result with the function `redukuj`, that is, we replace $b^2$ by $1-a^2$."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4098efef",
   "metadata": {},
   "outputs": [],
   "source": [
    "P = (a, b)\n",
    "Q = (JEDEN, ZERO)\n",
    "for n in range(1, 7):\n",
    "    Q = tuple(redukuj(q) for q in m(Q, P))\n",
    "    print(f\"P^{n} = ({Q[0]},  {sp.factor(Q[1])})\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c547e9a0",
   "metadata": {},
   "source": [
    "After reduction the first coordinate does not contain $b$, and the second has the form $b$ times a polynomial in $a$.\n",
    "Let us call these polynomials $T_n(a)$ and $U_{n-1}(a)$:\n",
    "\n",
    "$$\n",
    "P^n=\\bigl(T_n(a),\\ b\\,U_{n-1}(a)\\bigr).\n",
    "$$\n",
    "\n",
    "## Definition by induction\n",
    "\n",
    "From $P^{n+1}=P^n\\cdot P$ and the formula for $m$ we read off how to pass from $n$ to $n+1$:\n",
    "\n",
    "$$\n",
    "\\bigl(T_n,\\ bU_{n-1}\\bigr)\\cdot(a,b)\n",
    "=\\bigl(aT_n-b^2U_{n-1},\\ b\\,(T_n+aU_{n-1})\\bigr),\n",
    "$$\n",
    "\n",
    "and on the circle $b^2=1-a^2$. This gives a recursive definition:\n",
    "\n",
    "$$\n",
    "T_0=1,\\quad U_{-1}=0,\\qquad\n",
    "T_{n+1}=aT_n-(1-a^2)\\,U_{n-1},\\qquad\n",
    "U_n=T_n+a\\,U_{n-1}.\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "014e43f0",
   "metadata": {},
   "outputs": [],
   "source": [
    "def czebyszew(N):\n",
    "    \"\"\"Listy T[0..N] i U[0..N], gdzie U[n] to U_{n-1} (U[0] = U_{-1} = 0).\"\"\"\n",
    "    T, U = [JEDEN], [ZERO]\n",
    "    for _ in range(N):\n",
    "        T_n, U_n = T[-1], U[-1]\n",
    "        T.append(sp.expand(a * T_n - (1 - a**2) * U_n))\n",
    "        U.append(sp.expand(T_n + a * U_n))\n",
    "    return T, U\n",
    "\n",
    "\n",
    "T, U = czebyszew(40)\n",
    "for n in range(6):\n",
    "    print(f\"T_{n} = {T[n]}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0d04d131",
   "metadata": {},
   "source": [
    "```{admonition} Theorem 1\n",
    ":class: important\n",
    "For every point $P=(a,b)$ of the circle and every $n\\ge0$ we have\n",
    "$P^n=\\bigl(T_n(a),\\ b\\,U_{n-1}(a)\\bigr)$.\n",
    "```\n",
    "\n",
    "*Proof.* Induction on $n$. For $n=0$ both sides are $(1,0)$. In the step we assume that\n",
    "$P^n=(T,\\ bU)$ for some numbers $T,U$, and check that $P^{n+1}=P^n\\cdot P$ has the form from the definition.\n",
    "The induction step is **a single** symbolic check in which $T$ and $U$ are ordinary symbols:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e8c8ae8d",
   "metadata": {},
   "outputs": [],
   "source": [
    "Ts, Us = sp.symbols(\"T U\")\n",
    "krok = m((Ts, b * Us), (a, b))\n",
    "nastepny = (a * Ts - (1 - a**2) * Us, b * (Ts + a * Us))\n",
    "print([redukuj(krok[i] - nastepny[i]) for i in range(2)])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3d473ad9",
   "metadata": {},
   "source": [
    "Both differences are zero modulo $a^2+b^2-1$, which completes the proof. $\\square$\n",
    "\n",
    "The proof uses neither angles nor trigonometric functions and works over every field (also over\n",
    "$\\mathbb{F}_p$). For the point $(\\cos\\theta,\\sin\\theta)$, de Moivre’s formula gives\n",
    "$P^n=(\\cos n\\theta,\\sin n\\theta)$, so we recover the classical definition:\n",
    "\n",
    "$$\n",
    "T_n(\\cos\\theta)=\\cos n\\theta,\\qquad U_{n-1}(\\cos\\theta)=\\frac{\\sin n\\theta}{\\sin\\theta}.\n",
    "$$\n",
    "\n",
    "Our polynomials agree with the ones built into SymPy:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e4528831",
   "metadata": {},
   "outputs": [],
   "source": [
    "zgodne = all(sp.expand(T[n] - sp.chebyshevt(n, a)) == 0 for n in range(41))\n",
    "zgodne_U = all(sp.expand(U[n + 1] - sp.chebyshevu(n, a)) == 0\n",
    "               for n in range(40))\n",
    "print(\"T_n = chebyshevt(n) dla n ≤ 40:\", zgodne)\n",
    "print(\"U_n = chebyshevu(n) dla n ≤ 39:\", zgodne_U)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "691b070c",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "assert zgodne and zgodne_U"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "459a2864",
   "metadata": {
    "tags": [
     "hide-input"
    ]
   },
   "outputs": [],
   "source": [
    "INDYGO_SKALA = [\"#a5b4fc\", \"#818cf8\", \"#6366f1\", \"#4f46e5\", \"#4338ca\",\n",
    "                \"#312e81\"]\n",
    "xs = np.linspace(-1, 1, 801)\n",
    "fig, ax = plt.subplots(figsize=(7, 3.6))\n",
    "for n, kolor in zip(range(1, 7), INDYGO_SKALA):\n",
    "    f = sp.lambdify(a, T[n], \"numpy\")\n",
    "    ax.plot(xs, f(xs) + 0 * xs, color=kolor, lw=2, label=f\"$T_{n}$\")\n",
    "ax.axhline(0, color=\"#94a3b8\", lw=0.8)\n",
    "ax.set_xlim(-1, 1)\n",
    "ax.set_ylim(-1.1, 1.1)\n",
    "ax.set_xlabel(\"$a$\")\n",
    "ax.set_title(\"Wielomiany Czebyszewa $T_1, \\\\dots, T_6$ na $[-1, 1]$\",\n",
    "             loc=\"left\", fontsize=11)\n",
    "ax.legend(ncol=6, loc=\"lower center\", bbox_to_anchor=(0.5, -0.38),\n",
    "          frameon=False, fontsize=9)\n",
    "for bok in (\"top\", \"right\"):\n",
    "    ax.spines[bok].set_visible(False)\n",
    "ax.grid(color=\"#e2e8f0\", lw=0.6)\n",
    "fig.tight_layout()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "032b6057",
   "metadata": {},
   "source": [
    "On the interval $[-1,1]$ the values of $T_n$ stay within $[-1,1]$, because $T_n(a)$ is the first\n",
    "coordinate of a point of the circle. Outside this interval $b=\\sqrt{1-a^2}$ is not real and $T_n$ grows\n",
    "like $2^{n-1}a^n$.\n",
    "\n",
    "## The three-term recurrence\n",
    "\n",
    "The operation $m$ is **bilinear**: linear in each argument separately. Therefore, for any\n",
    "$Q=(x,y)$, not necessarily on the circle,\n",
    "\n",
    "$$\n",
    "Q\\cdot(a,b)+Q\\cdot(a,-b)=Q\\cdot(2a,0)=2a\\,Q,\n",
    "$$\n",
    "\n",
    "and for $Q=P^n$ and $P^{-1}=(a,-b)$ the left-hand side is $P^{n+1}+P^{n-1}$. Comparing coordinates, we get\n",
    "the classical recurrence\n",
    "\n",
    "$$\n",
    "T_{n+1}=2a\\,T_n-T_{n-1},\\qquad U_{n}=2a\\,U_{n-1}-U_{n-2}.\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9fcabfc7",
   "metadata": {},
   "outputs": [],
   "source": [
    "x, y = sp.symbols(\"x y\")\n",
    "lewa = [u + v for u, v in zip(m((x, y), (a, b)), m((x, y), (a, -b)))]\n",
    "print(\"Q·P + Q·P⁻¹ - 2a·Q =\", [sp.expand(l - 2 * a * q)\n",
    "                               for l, q in zip(lewa, (x, y))])\n",
    "print(\"T_{n+1} = 2a T_n - T_{n-1} dla n < 40:\",\n",
    "      all(sp.expand(T[n + 1] - 2 * a * T[n] + T[n - 1]) == 0\n",
    "          for n in range(1, 40)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "246afa47",
   "metadata": {},
   "source": [
    "## Pell’s equation for polynomials\n",
    "\n",
    "$P^n$ lies on the circle, so $T_n^2+b^2U_{n-1}^2=1$, that is, after substituting $b^2=1-a^2$:\n",
    "\n",
    "$$\n",
    "T_n(a)^2-(a^2-1)\\,U_{n-1}(a)^2=1.\n",
    "$$\n",
    "\n",
    "This is **Pell’s equation** $X^2-(a^2-1)Y^2=1$ in the polynomial ring, and $(T_n,U_{n-1})$ are its\n",
    "solutions — the successive powers of the fundamental solution $(a,1)$. We will return to this in Part 4, with\n",
    "the genuine Pell equation in the integers."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "81877e20",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(\"T_n² - (a² - 1) U_{n-1}² = 1 dla n ≤ 40:\",\n",
    "      all(sp.expand(T[n]**2 - (a**2 - 1) * U[n]**2) == 1 for n in range(41)))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4d899ce5",
   "metadata": {},
   "source": [
    "## Composition: $T_m\\circ T_n=T_{mn}$\n",
    "\n",
    "This is the most beautiful consequence of the group law.\n",
    "\n",
    "```{admonition} Theorem 2\n",
    ":class: important\n",
    "For all $m,n\\ge1$ we have $T_m\\bigl(T_n(a)\\bigr)=T_{mn}(a)$ and\n",
    "$U_{mn-1}(a)=U_{m-1}\\bigl(T_n(a)\\bigr)\\cdot U_{n-1}(a)$.\n",
    "```\n",
    "\n",
    "*Proof.* Let $P=(a,b)$ lie on the circle and $Q=P^n=\\bigl(T_n(a),\\ bU_{n-1}(a)\\bigr)$. The point $Q$ also\n",
    "lies on the circle, so by Theorem 1 applied to $Q$:\n",
    "\n",
    "$$\n",
    "Q^m=\\Bigl(T_m\\bigl(T_n(a)\\bigr),\\ bU_{n-1}(a)\\cdot U_{m-1}\\bigl(T_n(a)\\bigr)\\Bigr).\n",
    "$$\n",
    "\n",
    "On the other hand, $Q^m=P^{mn}=\\bigl(T_{mn}(a),\\ bU_{mn-1}(a)\\bigr)$. We compare coordinates.\n",
    "One subtlety remains: the equalities hold in the ring $\\mathbb{Q}[a,b]/(a^2+b^2-1)$, while we\n",
    "want equalities of polynomials in $a$ alone. Every element of this ring has a unique representation\n",
    "$r_0(a)+b\\,r_1(a)$ (the remainder of division by $b^2+a^2-1$ with respect to $b$, our function `redukuj`),\n",
    "so two polynomials in $a$ that are equal in this ring are truly equal. In the same way we cancel the factor $b$\n",
    "in the second coordinate. $\\square$\n",
    "\n",
    "The proof is general, but the computer can additionally check the claim for many pairs $(m,n)$:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9b4027f2",
   "metadata": {},
   "outputs": [],
   "source": [
    "zlozenie = all(sp.expand(T[k].subs(a, T[n]) - T[k * n]) == 0\n",
    "               for k in range(1, 9) for n in range(1, 6))\n",
    "zlozenie_U = all(sp.expand(U[k * n] - U[k].subs(a, T[n]) * U[n]) == 0\n",
    "                 for k in range(1, 9) for n in range(1, 6))\n",
    "print(\"T_m(T_n) = T_mn dla m ≤ 8, n ≤ 5:\", zlozenie)\n",
    "print(\"U_{mn-1} = U_{m-1}(T_n)·U_{n-1} dla m ≤ 8, n ≤ 5:\", zlozenie_U)\n",
    "print(\"T_3(T_5) =\", sp.factor(T[3].subs(a, T[5])) == sp.factor(T[15]),\n",
    "      \"  stopień:\", sp.degree(T[15], a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "23c0e3f9",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "assert zlozenie and zlozenie_U"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "273320a7",
   "metadata": {},
   "source": [
    "Corollary: Chebyshev polynomials **commute** under composition, $T_m\\circ T_n=T_n\\circ T_m$,\n",
    "just like the powers $a^m\\circ a^n=a^n\\circ a^m$. Both families come from the same construction:\n",
    "the powers $a^n$ are exponentiation in the multiplicative group, and $T_n$ — in the circle group.\n",
    "\n",
    "This is no accident. J. F. Ritt proved in 1923 that there are no other essentially different examples:\n",
    "if two polynomials of degree at least $2$ commute under composition and are not iterates of a\n",
    "common polynomial, then after a linear change of variable they are either both powers or both Chebyshev\n",
    "polynomials (up to sign). So both families come from one-dimensional algebraic groups: the multiplicative group and the circle.\n",
    "\n",
    "## The product formula\n",
    "\n",
    "By bilinearity, $P^n+P^{-n}=\\bigl(2T_n(a),0\\bigr)$, and multiplication by the point $(2T_n,0)$ is multiplication\n",
    "by the number $2T_n$. Hence $P^{m+n}+P^{m-n}=P^m\\cdot(P^n+P^{-n})=2T_n(a)\\,P^m$ and\n",
    "\n",
    "$$\n",
    "2\\,T_m T_n=T_{m+n}+T_{|m-n|}.\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9b2809d0",
   "metadata": {},
   "outputs": [],
   "source": [
    "iloczynowy = all(sp.expand(2 * T[k] * T[n] - T[k + n] - T[abs(k - n)]) == 0\n",
    "                 for k in range(16) for n in range(16))\n",
    "print(\"2 T_m T_n = T_{m+n} + T_{|m-n|} dla m, n < 16:\", iloczynowy)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "143a8cd4",
   "metadata": {},
   "source": [
    "## The derivative: motion along the circle\n",
    "\n",
    "The derivative also has a geometric meaning here. Motion along the circle at constant speed is the\n",
    "**tangent vector field** $D=-b\\,\\partial_a+a\\,\\partial_b$; it satisfies $D(a)=-b$, $D(b)=a$ and the Leibniz rule.\n",
    "We will prove by induction that for $P^n=(x_n,y_n)$\n",
    "\n",
    "$$\n",
    "D(x_n)=-n\\,y_n,\\qquad D(y_n)=n\\,x_n,\n",
    "$$\n",
    "\n",
    "that is, the $n$-th power “spins” $n$ times faster. For $n=1$ this is the definition of $D$. In the step,\n",
    "$x_{n+1}=ax_n-by_n$ and $y_{n+1}=ay_n+bx_n$; the Leibniz rule gives formulas for $D(x_{n+1})$ and $D(y_{n+1})$\n",
    "in terms of $x_n,y_n,D(x_n),D(y_n)$, and in place of $D(x_n),D(y_n)$ we insert the induction hypothesis.\n",
    "Again a single check with symbols $x,y$ instead of specific polynomials suffices:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "27a011e1",
   "metadata": {},
   "outputs": [],
   "source": [
    "n = sp.Symbol(\"n\")\n",
    "Dx, Dy = -n * y, n * x                       # założenie indukcyjne\n",
    "D_x_nast = -b * x + a * Dx - a * y - b * Dy  # D(a x - b y), Leibniz\n",
    "D_y_nast = -b * y + a * Dy + a * x + b * Dx  # D(a y + b x)\n",
    "x_nast, y_nast = a * x - b * y, a * y + b * x\n",
    "print([sp.expand(D_x_nast + (n + 1) * y_nast),\n",
    "       sp.expand(D_y_nast - (n + 1) * x_nast)])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "80e2b1fa",
   "metadata": {},
   "source": [
    "From $x_n=T_n(a)$ we get $D(x_n)=T_n'(a)\\cdot D(a)=-b\\,T_n'(a)$, and on the other hand\n",
    "$-n\\,y_n=-n\\,b\\,U_{n-1}(a)$. After cancelling $b$:\n",
    "\n",
    "$$\n",
    "T_n'=n\\,U_{n-1}.\n",
    "$$\n",
    "\n",
    "Applying $D$ twice gives $D^2(x_n)=-n^2x_n$. Let us compute $D^2$ for an arbitrary function $g(a)$:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "677a25a6",
   "metadata": {},
   "outputs": [],
   "source": [
    "g = sp.Function(\"g\")\n",
    "\n",
    "\n",
    "def D(w):\n",
    "    return -b * sp.diff(w, a) + a * sp.diff(w, b)\n",
    "\n",
    "\n",
    "D2 = redukuj(D(D(g(a))))\n",
    "print(\"D²(g(a)) =\", sp.collect(D2, [g(a).diff(a, 2), g(a).diff(a)]))\n",
    "print(\"= (1 - a²)·g'' - a·g':\",\n",
    "      sp.expand(D2 - ((1 - a**2) * g(a).diff(a, 2) - a * g(a).diff(a))) == 0)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "49800ade",
   "metadata": {},
   "source": [
    "We got $(1-a^2)g''-a\\,g'$. Hence $T_n$ satisfies the **Chebyshev differential equation**\n",
    "\n",
    "$$\n",
    "(1-a^2)\\,T_n''-a\\,T_n'+n^2\\,T_n=0.\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b580fd85",
   "metadata": {},
   "outputs": [],
   "source": [
    "pochodna = all(sp.expand(sp.diff(T[k], a) - k * U[k]) == 0 for k in range(41))\n",
    "rownanie = all(sp.expand((1 - a**2) * sp.diff(T[k], a, 2)\n",
    "                         - a * sp.diff(T[k], a) + k**2 * T[k]) == 0\n",
    "               for k in range(41))\n",
    "print(\"T_n' = n U_{n-1} dla n ≤ 40:\", pochodna)\n",
    "print(\"równanie Czebyszewa dla n ≤ 40:\", rownanie)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "678abc11",
   "metadata": {
    "tags": [
     "remove-cell"
    ]
   },
   "outputs": [],
   "source": [
    "assert pochodna and rownanie and iloczynowy"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "868cdf13",
   "metadata": {},
   "source": [
    "## Summary\n",
    "\n",
    "We derived all the properties in this part from the group law, and we checked each induction step\n",
    "by a single symbolic computation. The table collects where they came from. In Part 5 we will see\n",
    "that this is one observation viewed from different sides.\n",
    "\n",
    "| Property | Where it comes from in the circle group | Proof |\n",
    "|---|---|---|\n",
    "| $P^n=(T_n,\\ bU_{n-1})$ | $P^{n+1}=P^n\\cdot P$ | induction, step = one reduction |\n",
    "| $T_{n+1}=2aT_n-T_{n-1}$ | $P^{n+1}+P^{n-1}=2a\\,P^n$ | bilinearity of $m$ |\n",
    "| $T_n^2-(a^2-1)U_{n-1}^2=1$ | $P^n$ lies on the circle | closure |\n",
    "| $T_m\\circ T_n=T_{mn}$ | $(P^n)^m=P^{mn}$ | the theorem for $Q=P^n$ |\n",
    "| $2T_mT_n=T_{m+n}+T_{\\lvert m-n\\rvert}$ | $P^m(P^n+P^{-n})$ | bilinearity of $m$ |\n",
    "| $T_n'=nU_{n-1}$, Chebyshev equation | motion along the circle | induction with the Leibniz rule |\n",
    "\n",
    "## Exercises\n",
    "\n",
    "1. From $P^{2n}=(P^n)^2$ derive $T_{2n}=2T_n^2-1$ and $U_{2n-1}=2T_nU_{n-1}$. Check symbolically.\n",
    "2. Show that $T_n(-a)=(-1)^nT_n(a)$, using the point $(-1,0)$ of the circle.\n",
    "3. The roots of $T_n$ are $\\cos\\frac{(2k-1)\\pi}{2n}$, $k=1,\\dots,n$. Explain this via the points $P$\n",
    "   with $P^n=(0,\\pm1)$ and check numerically for $n=7$.\n",
    "4. The Dickson polynomials $D_n(x)=2T_n(x/2)$ have integer coefficients and leading coefficient $1$.\n",
    "   Write down $D_1,\\dots,D_6$ and check that $D_m\\circ D_n=D_{mn}$.\n",
    "\n",
    "## Literature and further reading\n",
    "\n",
    "* T. J. Rivlin, *Chebyshev Polynomials: From Approximation Theory to Algebra and Number Theory*, 2nd ed.,\n",
    "  Wiley, 1990 — the classic monograph, also on composition and arithmetic properties.\n",
    "* J. C. Mason, D. C. Handscomb, *Chebyshev Polynomials*, Chapman & Hall/CRC, 2003.\n",
    "* [NIST DLMF, Chapter 18](https://dlmf.nist.gov/18) — formulas and properties of orthogonal polynomials,\n",
    "  including Chebyshev polynomials; [Chebyshev polynomials](https://en.wikipedia.org/wiki/Chebyshev_polynomials)\n",
    "  on Wikipedia.\n",
    "* J. F. Ritt, *Permutable rational functions*, Transactions of the AMS 25 (1923), 399–448\n",
    "  ([DOI](https://doi.org/10.1090/S0002-9947-1923-1501252-3)) — commuting polynomials and rational functions.\n",
    "* The Mathlib library (Lean) has these polynomials and their properties with formal proofs, among others the composition\n",
    "  `Polynomial.Chebyshev.T_mul` and the product formula `Polynomial.Chebyshev.T_mul_T`:\n",
    "  [documentation](https://leanprover-community.github.io/mathlib4_docs/Mathlib/RingTheory/Polynomial/Chebyshev.html)."
   ]
  }
 ],
 "metadata": {
  "jupytext": {
   "default_lexer": "ipython3"
  },
  "kernelspec": {
   "display_name": "Python 3",
   "name": "python3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
