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

I have approximated $\sin(x)$ and $\cos (x)$ using the Taylor Series (Maclaurin Series) with the following results:

$$f(x)=f(0)+\frac{f^{(1)}(0)}{1!}(x-0)+\frac{f^{(2)}(0)}{2!}(x-0)^2+\frac{f^{(3)}(0)}{3!}(x-0)^3+\cdots$$ \begin{align}\implies \sin(x)&=x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}+\frac{x^9}{9!}-\cdots\\&=\sum_{n=0}^{\infty} \frac{(-1)^n}{(2n+1)!}x^{2n+1} \end{align}

$$f(x)=f(a)+\frac{f^{(1)}(a)}{1!}(x-a)+\frac{f^{(2)}(a)}{2!}(x-a)^2+\frac{f^{(3)}(a)}{3!}(x-a)^3+\cdots$$ \begin{align} \implies \cos(x)&=1-\frac{x^2}{2!}+\frac{x^4}{4!}-\frac{x^6}{6!}+\frac{x^8}{8!}-\frac{x^10}{10!}+\cdots \\&=\sum_{n=0}^{\infty} \frac{(-1)^n}{(2n)!}x^{2n} \end{align}

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

• It would be better to rephrase the question in more specific terms, like: "How to compute the Fourier-Chebyshev expansion of $\sin(x)$ and $\cos(x)$ over $[-1,1]$?" - and add your attempts. The link is quite irrelevant, you may assume we know how to approximate an exponential through Chebyshev polynomials. – Jack D'Aurizio Jul 1 '15 at 12:26
• Thanks! I've modified my question. – David Lin Jul 2 '15 at 2:23

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$

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

$\hspace1in$

• Thanks! What is the difference between Chebyshev Polynomials and the Fourier-Chebyshev series? – David Lin Jul 1 '15 at 9:27
• Also, is there a way to approximate Sine and Cosine using Chebyshev Polynomials which have results similar to caig.cs.nctu.edu.tw/course/NM07S/slides/chap4_1.pdf Page 9? – David Lin Jul 1 '15 at 11:36
• @DavidLin: Chebyshev Polynomials : Fourier-Chebyshev series = $\sin(nx)$ : Fourier series. Chebyshev polynomials are a complete base of $L^2(-1,1)$ with respect to the inner product $\int_{-1}^{1} \frac{f\cdot g}{\sqrt{1-x^2}}\,dx$, you should know this. I do not understand your second question: are you asking me to write $x^n$ in terms of Chebyshev polynomials or the opposite? – Jack D'Aurizio Jul 1 '15 at 12:22
• Thanks again! My second question is asking if there is a way to express sin(x) and cos(x) each in one simple line of infinite Chebyshev Series. Sorry, I am only a highschool student so I don't really quite understand 70% of the high maths in your answer LOL. Thanks again for answering and helping out! – David Lin Jul 2 '15 at 2:33
• @DavidLin: my $(2)$ gives $\cos(x)$ in terms of Chebyshev polynomials. To have a similar expansion for $\sin(x)$, too, just differentiate both sides of $(2)$. – Jack D'Aurizio Jul 2 '15 at 11:40