# Maclaurin Expansion Of Exp, Sin, Cos

## Introduction

In the last issue, I wrote an article about Taylor development.

Explaining The Theory Of Taylor Expansion
Derive the Taylor expansion. The beauty of the Taylor expansion is that it allows us to express functions in polynomial form.

I’ll just repost the Taylor expansion,

Taylor Expansion
\begin{eqnarray*}
f(x) &=& f(a) + f^{\prime}(a)\, (x – a) + \frac{1}{2!}f^{\prime\prime}(a)\, (x-a)^2 + \cdots + \frac{1}{n!}f^{(n)}(a)\, (x-a)^n + \cdots \\
&=& \sum_{k = 0}^{\infty} \frac{1}{k!}f^{(k)}(a)\, (x-a)^k
\end{eqnarray*}

In particular, Taylor development around the origin is called “Maclaurin Expansion”.

Maclaurin Expansion
\begin{eqnarray*}
f(x) &=& f(0) + f^{\prime}(0)\, x + \frac{1}{2!}f^{\prime\prime}(0)\, x^2 + \cdots + \frac{1}{n!}f^{(n)}(0)\, x^n + \cdots \\
&=& \sum_{k = 0}^{\infty} \frac{1}{k!}f^{(k)}(0)\, x^k
\end{eqnarray*}

As a concrete example of this, we will calculate the Maclaurin expansion of $\mathrm{e}^x,\ \sin{x},\ \cos{x}$. We will write the result first.

\begin{eqnarray*}
\mathrm{e}^{x} &=& 1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+\cdots = \sum_{k=0}^{\infty} \frac{x^{k}}{k !} \\
\\
\sin x &=& x-\frac{x^{3}}{3!} + \frac{x^5}{5!}\, – \frac{x^7}{7!} + \cdots = \sum_{k=0}^{\infty}(-1)^{k}\frac{x^{2 k+1}}{(2 k+1) !} \\
\\
\cos x &=& 1-\frac{x^{2}}{2!} + \frac{x^4}{4!}\, – \frac{x^6}{6!} + \cdots = \sum_{k=0}^{\infty}(-1)^{k} \frac{x^{2 k}}{(2 k) !}
\end{eqnarray*}

Let’s verify these by actually doing the calculations.

## Maclaurin expansion of $\mathrm{e}^x$

Calculate the derivative of $f(x) = \mathrm{e}^x$ to compute the Maclaurin expansion.
From the properties of the exponential function $\mathrm{e}^x$,

\begin{eqnarray*}
f^{\prime}(x) &=& \mathrm{e}^x \\
\\
f^{\prime\prime}(x) &=& \mathrm{e}^x \\
\\
f^{(3)}(x) &=& \mathrm{e}^x \\
\\
&\vdots&
\end{eqnarray*}
Therefore,
\begin{eqnarray*}
f^{\prime}(0) = f^{\prime\prime}(0) = f^{(3)}(0) = \cdots = 1.
\end{eqnarray*}
Substituting into the formula for the Maclaurin expansion, we get

\begin{eqnarray*}
\mathrm{e}^{x} &=& 1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+\cdots \\
&=& \sum_{k=0}^{\infty} \frac{x^{k}}{k!}
\end{eqnarray*}

## Maclaurin expansion of $\sin{x}$

Calculate the derivative of $f(x) = \sin{x}$.

\begin{eqnarray*}
f^{\prime}(x) &=& \cos{x} \\
\\
f^{\prime\prime}(x) &=& -\sin{x} \\
\\
f^{(3)}(x) &=& -\cos{x} \\
\\
f^{(4)}(x) &=& \sin{x}\\
\\
&\vdots&
\end{eqnarray*}
Therefore, the $k$-order derivative is
\begin{eqnarray*}
f^{(k)}(x) &=&  \left\{
\begin{array}{ll}
\cos{x}\ \ &(k = 1, 5, 9, \dots) \\
-\sin{x}\ \ &(k = 2, 6, 10, \dots) \\
-\cos{x}\ \ &(k = 3, 7, 11, \dots) \\
\sin{x}\ \ &(k = 4, 8, 12, \dots) \\
\end{array}
\right. \\
\\
&=& \sin{\left(x + \frac{k\pi}{2} \right)}\ \ (k = 1, 2, 3, \dots)
\end{eqnarray*}
In $x = 0$,
\begin{eqnarray*}
f^{(k)}(0) &=&  \left\{
\begin{array}{ll}
1\ \ &(k = 1, 5, 9, \dots) \\
0\ \ &(k = 2, 6, 10, \dots) \\
-1\ \ &(k = 3, 7, 11, \dots) \\
0\ \ &(k = 4, 8, 12, \dots) \\
\end{array}
\right.
\end{eqnarray*}
It has a value only when $k$ is an odd number. Substituting into the formula for the Maclaurin expansion, we get

\begin{eqnarray*}
\sin x &=& x-\frac{x^{3}}{3!} + \frac{x^5}{5!}\, – \frac{x^7}{7!} + \cdots \\
&=& \sum_{k=0}^{\infty}(-1)^{k}\frac{x^{2 k+1}}{(2 k+1) !}
\end{eqnarray*}

## Maclaurin expansion of $\cos{x}$

Calculate also the derivative of $f(x) = \cos{x}$.

\begin{eqnarray*}
f^{\prime}(x) &=& -\sin{x} \\
\\
f^{\prime\prime}(x) &=& -\cos{x} \\
\\
f^{(3)}(x) &=& \sin{x} \\
\\
f^{(4)}(x) &=& \cos{x}\\
\\
&\vdots&
\end{eqnarray*}
Therefore, the $k$-order derivative is
\begin{eqnarray*}
f^{(k)}(x) &=&  \left\{
\begin{array}{ll}
-\sin{x}\ \ &(k = 1, 5, 9, \dots) \\
-\cos{x}\ \ &(k = 2, 6, 10, \dots) \\
\sin{x}\ \ &(k = 3, 7, 11, \dots) \\
\cos{x}\ \ &(k = 4, 8, 12, \dots) \\
\end{array}
\right. \\
\\
&=& \cos{\left(x + \frac{k\pi}{2} \right)}\ \ (k = 1, 2, 3, \dots)
\end{eqnarray*}
In $x = 0$,
\begin{eqnarray*}
f^{(k)}(0) &=&  \left\{
\begin{array}{ll}
0\ \ &(k = 1, 5, 9, \dots) \\
-1\ \ &(k = 2, 6, 10, \dots) \\
0\ \ &(k = 3, 7, 11, \dots) \\
1\ \ &(k = 4, 8, 12, \dots) \\
\end{array}
\right.
\end{eqnarray*}
It has a value only when $k$ is an even number. Substituting into the formula for the Maclaurin expansion, we get

\begin{eqnarray*}
\cos x &=& 1-\frac{x^{2}}{2!} + \frac{x^4}{4!}\, – \frac{x^6}{6!} + \cdots \\
&=& \sum_{k=0}^{\infty}(-1)^{k} \frac{x^{2 k}}{(2 k) !}
\end{eqnarray*}

## Euler’s formula

Finally, use the Maclaurin expansion of $\mathrm{e}^x, \sin{x}, \cos{x}$ to derive Euler’s formula.

Euler’s formula

\begin{eqnarray*}
\large{\mathrm{e}^{\mathrm{i}x} = \cos{x} + \mathrm{i} \sin{x}}
\end{eqnarray*}

Maclaurin expansion of $\mathrm{e}^{x}$

\begin{eqnarray*}
\mathrm{e}^{x} &=& 1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+\frac{x^{4}}{4!}+\frac{x^{5}}{5!}\cdots
\end{eqnarray*} Let’s change it to $x \to \mathrm{i}x$（$\mathrm{i}^2 = -1$）. Therefore,

Yukkuri Machine Learning
タイトルとURLをコピーしました