Taylor polynomial of $f(x) = 1/(1+\cos x)$ I'm trying to solve a problem from a previous exam. Unfortunately there is no solution for this problem.
So, the problem is:

Calculate the Taylor polynommial (degree $4$) in $x_0 = 0$ of the function:
  $$f(x) = \frac{1}{1+\cos(x)}$$

What I tried so far:


*

*calculate all $4$ derivatives

*$1+\cos(x) = 2\cos^2(\frac{x}{2})$ and work with this formula

*$\int\frac{1}{1+\cos(x)}dx = \tan(\frac{x}{2})$ and then use the Taylor series of $\tan(\frac{x}{2})$

*$\frac{1}{1 + \cos(x)} = \frac{1}{1 + \left(1 + \frac{x^2}{2!} + \cdots\right)}$


What do you think, is there a good way to calculate the Taylor polynomial of this function or is there just the hard way (derivatves)?
 A: Let's do this in a couple of different ways. We want to expand $\dfrac{1}{1 + \cos x}$.
Method 1
If it's not obvious what the best method is, we might just choose one and go. A fourth degree Taylor Expansion isn't so bad - it's only a few derivatives. So you might just go, suffer through a few derivatives, and save yourself the trouble of deciding the best way.
Alternately, if you happen to know the series for $\tan x$, then that's a great way to proceed (referring to your idea of using the series expansion for $\tan (x/2)$
Method 2
If we are certain it has a Taylor expansion, and we are comfortable then we know it will look like $a_0 + a_1x + a_2x^2/2 + \ldots$ We know that $\cos x = 1 - x^2/2 + x^4/4! + \ldots$, so that $\dfrac{1}{1 + \cos x} = \dfrac{1}{2 - x^2/2 + x^4/4! + \dots}$
So we consider $\dfrac{1}{2 - x^2/2 + x^4/4! + \dots} = a_0 + a_1x + a_2x^2/2 + \ldots$, or equivalently $$(a_0 + a_1x + a_2x^2/2 + \ldots)(2 - x^2/2 + x^4/4! + \dots) = 1$$
By equating the coefficients of powers of $x$ on the left and on the right (which are all $0$ except for $x^0$, which has coefficient $1$), we get that $2a_0 = 1$, $a_1 = 0$, $a_0(-x^2/2) + (a_2x^2/2)(2) = 0$, etc. This isn't too bad, and is just a set of linear equations.
A: There are some things that can make it easier, since you are expanding around $x_0 = 0$.
Let $f(x) = \frac{1}{1+\cos x} = \left(1+\cos x\right)^{-1}$. We can compute $df/dx$ as $\frac{df}{dx} = -\left(1+\cos x\right)^{-2}\frac{d (1+\cos x)}{dx} = -\left(1+\cos x\right)^{-2}\sin x$. Now, we have a product rule situation going to higher derivatives.
This makes our life a little easier, since $\sin x_0 = \sin 0 = 0$. In other words, we can simply "not care" about higher-order derivatives that have a $\sin$ term in them.
So, in short, the best way to compute the Taylor expansion quickly for a few terms on an exam, in my opinion, is to compute the derivatives, and note that since we need to compute $\frac{d^nf}{dx^n}\mid_{x = 0}$, to just skip the rigor of computing in detail any term that gets multiplied by $\sin x$.
A: $$\cos x=\sum_{k=0}^\infty (-1)^k\frac{x^{2k}}{(2k)!}=1+\cos x= 2-\frac{x^2}{2}+\frac{x^4}{24}-...\Longrightarrow$$
$$\frac{1}{1+\cos x}=\frac{1}{2-\frac{x^2}{2}+\frac{x^4}{24}-...}=\frac{1}{2}\frac{1}{\left[1-\left(\frac{x}{2}\right)^2\right]\left(1-\frac{x^2}{24}+...\right)}=$$
$$=\frac{1}{2}\left(1+\frac{x^2}{4}+\frac{x^4}{8}+...\right)$$by taking the development of $$\frac{1}{1-x^2}$$
