# Chebyshev polynomials

How could I write the Chebyshev polynomial as a function that uses Nest? Also, how could I write it using recursion?

Furthermore, how can I show that $$T_n(x)=\frac12((x-\sqrt{x^2-1})^n+(x+\sqrt{x^2-1})^n$$?

• Is this homework? What have you tried? Dec 29, 2020 at 1:59
• ChebyshevT[n, x] Dec 29, 2020 at 2:05
• ChebyshevT Dec 29, 2020 at 4:13

The way to use Nest[] for computing the Chebyshev polynomial of the first kind is to recognize that a three-term recurrence is equivalent to repeated multiplication by a certain $$2\times 2$$ matrix. To wit,

With[{n = 5}, First[Nest[{{2 x, -1}, {1, 0}}.# &, {x, 1}, n - 1]]] // Expand
5 x - 20 x^3 + 16 x^5

ChebyshevT[5, x]
5 x - 20 x^3 + 16 x^5


Similarly for the second kind polynomial,

With[{n = 5}, First[Nest[{{2 x, -1}, {1, 0}}.# &, {2 x, 1}, n - 1]]] // Expand
6 x - 32 x^3 + 32 x^5

ChebyshevU[5, x]
6 x - 32 x^3 + 32 x^5


Of course, this formulation can be simplified by just using the action form of MatrixPower[]:

With[{n = 5}, First[MatrixPower[{{2 x, -1}, {1, 0}}, n - 1, {x, 1}]]] // Expand
5 x - 20 x^3 + 16 x^5


(This formulation works out because the difference equation satisfied by both Chebyshev polynomials has constant coefficients, similar to the Fibonacci and Lucas cases. For other orthogonal polynomials like Legendre, things are less simple.)

As for the non-trigonometric representation of the Chebyshev polynomials, you can coax Mathematica into producing them like so:

FunctionExpand[DifferenceRootReduce[ChebyshevT[n, x], n]]
1/2 ((x - Sqrt[-1 + x^2])^n + (x + Sqrt[-1 + x^2])^n)

Assuming[n ∈ Integers,
FullSimplify[FunctionExpand[DifferenceRootReduce[ChebyshevU[n, x], n]]]]
1/2 ((x - Sqrt[-1 + x^2])^n + (x + Sqrt[-1 + x^2])^n +
(x (-(x - Sqrt[-1 + x^2])^n + (x + Sqrt[-1 + x^2])^n))/Sqrt[-1 + x^2])

• How could I also use RSolve to get the $T_n(x)=\frac12((x-\sqrt{x^2-1})^n+(x+\sqrt{x^2-1})^n$ equation? Jan 4, 2021 at 13:31
• What did you try with RSolve[]? Jan 4, 2021 at 15:08
• I've tried RSolve[T[x] == 1/2*((x - Sqrt[x^2 - 1])^n + (x + Sqrt[x^2 - 1])^n), T[x], x] which i think works Jan 4, 2021 at 18:05

Recursive:

ClearAll[f];
f[0, _] = 1;
f[1, x_] = x;
f[n_, x_] := 2 x f[n - 1, x] - f[n - 2, x]


With Nest:

ClearAll[f];
f[0, _] = 1;
f[n_, x_] := Nest[{#[[2]], 2 x #[[2]] - #[[1]]} &, {1, x}, n - 1][[2]]


To show ChebyshevT[n, x] == 1/2 ((x - Sqrt[x^2 - 1])^n + (x + Sqrt[x^2 - 1])^n)  you show first, that the recursion relation is fulfilled. And then you show that the the recursion start is o.k.

ClearAll[f, n];
ff[n_, x_] = 1/2 ((x - Sqrt[x^2 - 1])^n + (x + Sqrt[x^2 - 1])^n);
ff[n, x] == 2 x ff[n - 1, x] - ff[n - 2, x] // Simplify
ff[0, x] == 1
ff[1, x] == x
(*True,True,True*)


Instead, you may show that ff[n,x] fulfills the Chebyshev Differential equation:

ClearAll[f, n, x];
ff[n_, x_] = 1/2 ((x - Sqrt[x^2 - 1])^n + (x + Sqrt[x^2 - 1])^n);
(1 - x^2) D[ff[n, x], {x, 2}] - x  D[ff[n, x], x] +  n^2 ff[n, x] // Simplify
(*0*)