# How do you find the taylor series series for f (x) = 5 cos πx at a=1/2?

Jul 4, 2015

The general formula for writing out a Taylor series is:

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

Note that according to this formula, you need to take the derivative of the function $n$ times. Let's say $n = 4$.

${f}^{\left(0\right)} \left(x\right) = f \left(x\right) = 5 \cos \pi x$

$f ' \left(x\right) = - 5 \pi \sin \pi x$

$f ' ' \left(x\right) = - 5 {\pi}^{2} \cos \pi x$

$f ' ' ' \left(x\right) = 5 {\pi}^{3} \sin \pi x$

$f ' ' ' ' \left(x\right) = 5 {\pi}^{4} \cos \pi x$

Thus, the truncated Taylor series can be written as:

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

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

Notice how $\cos \left(\frac{\pi}{2}\right) = 0$ and $\sin \left(\frac{\pi}{2}\right) = 1$:

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

As a result, this becomes a series with alternating signs and only odd terms (similarly, if you did this with $5 \sin \pi x$, you'd have alternating signs and only even terms).

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

Just remember these things:
- Only the $x$ in $f \left(x\right)$ approaches $a$, not the one in ${\left(x - a\right)}^{n}$
- Plug in $a$ after taking the derivative
- $a$ does not vary, but $n$ does