---
title: "Special Families of Polynomials"
canonical: "https://docs.magma-maths.org/v2.30-1/BasicRings/UnivariatePolynomialRings/families-polynomials.html"
source: "https://docs.magma-maths.org/v2.30-1/BasicRings/UnivariatePolynomialRings/families-polynomials.md"
part: "Basic Rings"
chapter: "Univariate Polynomial Rings"
breadcrumbs:
  - {"title": "Magma Handbook", "source": "https://docs.magma-maths.org/v2.30-1/index.md"}
  - {"title": "Basic Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/index-basic-rings.md"}
  - {"title": "Univariate Polynomial Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/UnivariatePolynomialRings/index-univariate-polynomial-rings.md"}
prev: {"title": "Ideals and Quotient Rings", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/UnivariatePolynomialRings/ideal-quotient.md"}
next: {"title": "Bibliography", "source": "https://docs.magma-maths.org/v2.30-1/BasicRings/UnivariatePolynomialRings/bibliography.md"}
intrinsics:
  - {"name": "ChebyshevFirst", "signature": "ChebyshevFirst(n): RngIntElt -> RngUPolElt"}
  - {"name": "ChebyshevT", "signature": "ChebyshevT(n): RngIntElt -> RngUPolElt"}
  - {"name": "ChebyshevSecond", "signature": "ChebyshevSecond(n): RngIntElt -> RngUPolElt"}
  - {"name": "ChebyshevU", "signature": "ChebyshevU(n): RngIntElt -> RngUPolElt"}
  - {"name": "LegendrePolynomial", "signature": "LegendrePolynomial(n): RngIntElt -> RngUPolElt"}
  - {"name": "LaguerrePolynomial", "signature": "LaguerrePolynomial(n): RngIntElt -> RngUPolElt"}
  - {"name": "LaguerrePolynomial", "signature": "LaguerrePolynomial(n, m): RngIntElt, RngElt -> RngUPolElt"}
  - {"name": "HermitePolynomial", "signature": "HermitePolynomial(n): RngIntElt -> RngUPolElt"}
  - {"name": "GegenbauerPolynomial", "signature": "GegenbauerPolynomial(n, m): RngIntElt, RngElt -> RngUPolElt"}
  - {"name": "DicksonFirst", "signature": "DicksonFirst(n, a): RngIntElt, RngElt -> RngUPolElt"}
  - {"name": "DicksonSecond", "signature": "DicksonSecond(n, a): RngIntElt, RngElt -> RngUPolElt"}
  - {"name": "BernoulliPolynomial", "signature": "BernoulliPolynomial(n): RngIntElt -> RngUPolElt"}
  - {"name": "SwinnertonDyerPolynomial", "signature": "SwinnertonDyerPolynomial(n): RngIntElt -> RngUPolElt"}
---

# Special Families of Polynomials

## Orthogonal Polynomials

<a id="function-chebyshevfirst-rngintelt"></a>
### `ChebyshevFirst(n): RngIntElt -> RngUPolElt`

<a id="function-chebyshevt-rngintelt"></a>
### `ChebyshevT(n): RngIntElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the Chebyshev polynomial of the first kind $T_n(x)$, where $T_n(x)$ is defined by $T_n(x) = \cos n \theta$ with $x = \cos \theta$.

<a id="function-chebyshevsecond-rngintelt"></a>
### `ChebyshevSecond(n): RngIntElt -> RngUPolElt`

<a id="function-chebyshevu-rngintelt"></a>
### `ChebyshevU(n): RngIntElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the Chebyshev polynomial of the second kind, $U_n(x)$, of degree $n - 1$. The polynomial is defined by $U_n(x) = {{1} \over {n}} T_n ' (x) = {{\sin n \theta} \over {\sin \theta}}$ where $x = \cos \theta$.

<a id="function-legendrepolynomial-rngintelt"></a>
### `LegendrePolynomial(n): RngIntElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the Legendre polynomial $P_n(x)$ of degree $n$, where $P_n(x)$ is defined by

$$
\begin{aligned}P_0(x) &= 1, \ P_1(x) = x, \\
   P_n(x) &= {1 \over {n}} ((2n - 1) x P_{n - 1}(x)
    - (n - 1) P_{n - 2}(x)).\end{aligned}
$$

<a id="function-laguerrepolynomial-rngintelt"></a>
### `LaguerrePolynomial(n): RngIntElt -> RngUPolElt`

<a id="function-laguerrepolynomial-rngintelt-rngelt"></a>
### `LaguerrePolynomial(n, m): RngIntElt, RngElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the Laguerre polynomial $L_n^m(x)$ of degree $n$ with parameter $m$. If $m$ is omitted, it is assumed to be zero if it is not specified. The polynomial satisfies the recurrence relation

$$
\begin{aligned}L_0(x) &= 1, \ L_1(x) = 1 + m - x,
   \\
   L_n(x) &= {1 \over n} (((2n+m-1) - x) L_{n - 1}^m(x) -
   (n - 1 + m) L_{n - 2}^m(x)).\end{aligned}
$$

<a id="function-hermitepolynomial-rngintelt"></a>
### `HermitePolynomial(n): RngIntElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the Hermite polynomial $H_n(x)$ of degree $n$, where $H_n(x)$ is defined by

$$
\begin{aligned}H_0(x) &= 1, \ H_1(x) = 2x, \\ H_n(x) &= 2x H_{n - 1}(x) -
   2n H_{n - 2}(x).\end{aligned}
$$

<a id="function-gegenbauerpolynomial-rngintelt-rngelt"></a>
### `GegenbauerPolynomial(n, m): RngIntElt, RngElt -> RngUPolElt`

Given a positive integer $n$ and an integer $m$, this function constructs the Gegenbauer polynomial $C_n^m(x)$ of degree $n$ with parameter $m$, where $C_n^m(x)$ is defined by

$$
\begin{aligned}C_0^m(x) &= 1, \ C_1^m(x) = 2 m x,\\
   C_n^m(x) &= {1 \over n}(2(n - 1 + m) x C_{n - 1}^m(x) -
   (n + 2m - 2) C_{n - 2}^m(x)).\end{aligned}
$$

## Permutation Polynomials

<a id="function-dicksonfirst-rngintelt-rngelt"></a>
### `DicksonFirst(n, a): RngIntElt, RngElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the Dickson polynomial of the first kind $D_n (x, a)$ of degree $n$, where $D_n (x, a)$ is defined by

$$
D_n(x, a) = \sum_{i=0}^{\lfloor n/2 \rfloor}
   {n \over {n - i}} {{n - i} \choose i} (-a)^i x^{n - 2i}.
$$

<a id="function-dicksonsecond-rngintelt-rngelt"></a>
### `DicksonSecond(n, a): RngIntElt, RngElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the Dickson polynomial of the second kind $E_n (x, a)$ of degree $n$, where $E_n (x, a)$ is defined by

$$
E_n(x, a) = \sum_{i=0}^{\lfloor n/2 \rfloor}
   {{n - i} \choose {i}} (-a)^i x^{n - 2i}.
$$

## The Bernoulli Polynomial

<a id="function-bernoullipolynomial-rngintelt"></a>
### `BernoulliPolynomial(n): RngIntElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the $n$-th Bernoulli polynomial.

## Swinnerton-Dyer Polynomials

<a id="function-swinnertondyerpolynomial-rngintelt"></a>
### `SwinnertonDyerPolynomial(n): RngIntElt -> RngUPolElt`

Given a positive integer $n$, this function constructs the $n$-th Swinnerton-Dyer polynomial, which is defined to be

$$
\prod (x \pm \sqrt{2} \pm \sqrt{3} \pm \sqrt{5} \pm
   \cdots \pm \sqrt{p_n}),
$$

where $p_i$ is the $i$-th prime and the product runs over all $2^n$ possible combinations of $+$ and $-$ signs. This polynomial lies in ${\mathbb{Z}}[x]$, has degree $2^n$, and is irreducible over ${\mathbb{Z}}$.

See Example [Factoring Swinnerton-Dyer Polynomials](https://docs.magma-maths.org/v2.30-1/BasicRings/UnivariatePolynomialRings/factorization.md#example-ex-d3c652) above which explains more about this class of polynomials, and see also Example [Swinnerton-Dyer Polynomials](https://docs.magma-maths.org/v2.30-1/GlobalFields/AlgebraicallyClosedFields/creation.md#example-ex-681d9c) in the chapter on algebraically closed fields to see how these polynomials are constructed and also for a generalization.
