What is a Taylor series approximation for f(x)=cos(pix) with n = 4 and a = 3?

Jun 19, 2015

The answer would be here. But there is a trick to this.

Recall that for $a = 3$, since $x \to a$, $a$ is odd, and the derivative of $\cos \left(\pi x\right)$ will eventually give $\sin a \pi$ where $\sin \left(\text{odd} \cdot \pi\right) = \sin \pi = 0$.

So, since everything is multiplying in the Taylor series expansion within each individual $n$th term, you can ignore the odd derivative terms. Call them $0$. GREAT! Remember that.

Now, you will have to take $n$ derivatives (except the odd ones). Thankfully $n \to 4$, only.

The series is written as:

sum_(n=0)^4 f^n(a)/(n!)(x-a)^n

Because the derivatives of $\cos u$ are, starting at the $0$th derivative and ending at the $4$th derivative (where the cycle restarts):

$\left\{\cos u , - \sin u , - \cos u , \sin u , \cos u , \ldots\right\} {\left(\frac{\mathrm{du}}{\mathrm{dx}}\right)}^{n}$

...with ${\left(\frac{\mathrm{du}}{\mathrm{dx}}\right)}^{n}$ from the Chain Rule on the factor of $\pi$... you get:

${f}^{0} \left(x\right) = \textcolor{b l u e}{f \left(x\right) = \cos \pi x}$

${\cancel{\textcolor{b l u e}{f ' \left(x\right)} = \pi \left(- \sin \pi x\right) \textcolor{b l u e}{= - \pi \sin \pi x}}}^{\text{0 at a = 3}}$

$\textcolor{b l u e}{f ' ' \left(x\right)} = {\pi}^{2} \left(- \cos \pi x\right) \textcolor{b l u e}{= - {\pi}^{2} \cos \pi x}$

${\cancel{\textcolor{b l u e}{f ' ' ' \left(x\right)} = - {\pi}^{3} \left(- \sin \pi x\right) \textcolor{b l u e}{= {\pi}^{3} \sin \pi x}}}^{\text{0 at a = 3}}$

$\textcolor{b l u e}{f ' ' ' ' \left(x\right)} = {\pi}^{4} \left(\cos \pi x\right) \textcolor{b l u e}{= {\pi}^{4} \cos \pi x}$

Now, plug them into the equation, with $x = a$ except for the $\left(x - a\right)$, varying $n$ from $0$ to $4$ (inclusive), and nonvarying $a$:

sum_(n=0)^4 f^n(a)/(n!)(x-a)^n

By default:
= f^0(3)/(0!)(x-3)^0 + (f'(3))/(1!)(x-3)^1 + (f''(3))/(2!)(x-3)^2 + (f'''(3))/(3!)(x-3)^3 + (f''''(3))/(4!)(x-3)^4 + ...

Now plug in ${f}^{n} \left(a\right)$, $n$, and $a$:
$= \frac{\cos 3 \pi}{1} \left(1\right) + {\cancel{\frac{- \pi \sin 3 \pi}{1} \left(x - 3\right)}}^{0} + \frac{- {\pi}^{2} \cos 3 \pi}{2} {\left(x - 3\right)}^{2} + {\cancel{\frac{{\pi}^{3} \sin 3 \pi}{6} {\left(x - 3\right)}^{3}}}^{0} + \frac{{\pi}^{4} \cos 3 \pi}{24} {\left(x - 3\right)}^{4} + \ldots$

As you could see, the odd terms do indeed cancel! Simplify all the sign swaps, parentheses, $1$'s, etc.:
$= \left(\cos 3 \pi\right) - \frac{{\pi}^{2} \cos 3 \pi}{2} {\left(x - 3\right)}^{2} + \frac{{\pi}^{4} \cos 3 \pi}{24} {\left(x - 3\right)}^{4} + \ldots$

But $\cos 3 \pi = \cos \pi = - 1$, so:

$= \left(- 1\right) - \frac{- {\pi}^{2}}{2} {\left(x - 3\right)}^{2} + \frac{- {\pi}^{4}}{24} {\left(x - 3\right)}^{4} + \ldots$

$\textcolor{b l u e}{= - 1 + \frac{{\pi}^{2}}{2} {\left(x - 3\right)}^{2} - \frac{{\pi}^{4}}{24} {\left(x - 3\right)}^{4} + \ldots}$