How to use Chebyshev Polynomials to approximate $\sin(x)$ and $\cos(x)$ within the interval $[−π,π]$?

Solution 1:

Assume that we want to approximate $\cos(x)$ over $I=[-1,1]$. The Taylor series gives: $$ \cos(x) = \sum_{n=0}^{+\infty}\frac{(-1)^n}{(2n)!} x^{2n}\tag{1} $$ while the Fourier-Chebyshev series is given by: $$ \cos(x) = J_0(1) + 2\sum_{n\geq 1}(-1)^n J_{2n}(1) T_{2n}(x)\tag{2}$$ where: $$ \frac{2}{\pi}\int_{-1}^{1}\frac{\cos(x) T_n(x)}{\sqrt{1-x^2}}\,dx = \frac{2}{\pi}\int_{-\pi/2}^{\pi/2}\cos(\cos x)\cos(nx)\,dx\tag{3}$$ is a Bessel function of the first kind and $T_{n}(x)$ is a Chebyshev polynomial of the first kind. Since both $x^n$ and $T_n(x)$ are bounded by $1$ on $I$, the accuracy of the approximation just depends on how fast $J_{2n}(1)$ decays to zero. Since: $$ J_{2n}(1) = \sum_{l\geq 0}\frac{(-1)^l}{4^{l+n}(2n+l)!},\qquad \left|J_{2n}(1)\right|\approx\frac{1}{4^n(2n)!}\tag{4}$$ we have that the Taylor approximation pointwise outperforms $(2)$ in the region $|x|\leq\frac{1}{2}$, while the $L^2$-approximation $(2)$ is more accurate than $(1)$ near the endpoints of $I$, and in uniform terms. However, its coefficients are less trivial to compute.

It is also interesting to mention that, by expanding $T_{2n}(x)$ and equating the coefficients of $x^{2m}$ in $(1)$ and $(2)$ we get an interesting identity about the Bessel function of the first kind. The same happens if we integrate the square of both sides of $(2)$, multiplied by $\frac{1}{\sqrt{1-x^2}}$, over $I$.

Here we have a graph of the approximation error for $n=5$. The Taylor series gives the blue graph, the Fourier-Chebyshev series gives the red graph.

$\hspace1in$enter image description here

This is the same graph over the subinterval $\left[-\frac{2}{3},\frac{2}{3}\right]$:

$\hspace1in$enter image description here