How to find the MacLaurin series of $\frac{1}{1+e^x}$ Mathcad software gives me the answer as: $$ \frac{1}{1+e^x} = \frac{1}{2} -\frac{x}{4} +\frac{x^3}{48} -\frac{x^5}{480} +\cdots$$
I have no idea how it found that and i don't understand. What i did is expand $(1+e^x)^{-1} $ as in the binomial MacLaurin expansion. I want until the $x^4$ term. So what i found is the following:
$$ (1+e^x)^{-1} = 1 - e^x + e^{2x} + e^{3x} + e^{4x}+\cdots\tag1 $$
Then by expanding each $e^{nx}$ term individually:
$$ e^x = 1 + x + \frac{x^2}{2} + \frac{x^3}{6} + \frac{x^4}{24}+\cdots\tag2 $$
$$ e^{2x} = 1 + 2x + 2x^2 + \frac{3x^3}{2} + \frac{2x^4}{3}+\cdots\tag3 $$
$$ e^{3x} = 1 + 3x + \frac{9x^2}{2} + \frac{9x^3}{2} + \frac{27x^4}{8}+\cdots\tag4 $$ 
$$ e^{4x} = 1 + 4x + 8x^2 + \frac{32x^3}{3} + \frac{32x^4}{3}+\cdots\tag5 $$
So substituting $(2),(3),(4),(5)$ into $(1)$ i get:
$$ (1+e^x)^{-1} = 1 +2x+5x^2+ \frac{22x^3}{3} + \frac{95x^4}{12} +\cdots$$
Which isn't the correct result. Am i not allowed to expand this series binomially? I've seen on this site that this is an asymptotic expansion. However, i don't know about these and i haven't been able to find much information on this matter to solve this. If someone could help me understand how to solve it and why my approach isn't correct, i would be VERY grateful. Thanks in advance.
 A: Let  $\dfrac1{1+e^x}=a_0+a_1x+a_2x^2+\cdots$ 
$$\implies(1+e^x)\left(a_0+a_1x+a_2x^2+\cdots\right)=1$$
As $e^x=\sum_{r=0}^\infty\dfrac{x^r}{r!}$
$$\implies\left(2+\dfrac x1+\dfrac{x^2}2+\dfrac{x^3}{3!}+\cdots\right)\left(a_0+a_1x+a_2x^2+\cdots\right)=1$$
Comparing the coefficients of different powers of $x,$
$\implies1=2a_0\iff a_0=?$
$0=2a_1+a_0\iff a_1=?$
$0=2a_2+a_1+\dfrac{a_0}2$
and so on
A: Just a sketch of a proof to be expanded later (sorry, I am in a hurry): by taking the logarithmic derivative of the Weierstrass product of the $\cosh$ function we have the Taylor series of the $\tanh$ function, with the coefficients depending on values of the $\zeta$ function at even integers. With a little maquillage it is not difficult to turn that into the Taylor series of $\frac{1}{1+e^x}$. Or we may just play a bit with the generating function of Bernoulli numbers.
So, I was saying:
$$\cosh z = \prod_{n\geq 0}\left(1+\frac{4z^2}{(2n+1)^2 \pi^2}\right)\tag{1}$$
hence:
$$ \tanh z = \sum_{n\geq 0}\frac{8z}{(2n+1)^2 \pi^2 + 4z^2}\tag{2} $$
leads to:
$$ \tanh z = \sum_{m\geq 0}(-1)^m z^{2m+1}\sum_{n\geq 0}\frac{2^{2m+3}}{\pi^{2m+2}(2n+1)^{2m+2}}\tag{3}$$
by expanding the general term of the RHS of $(2)$ as a geometric series. Computing the innermost sum in terms of the $\zeta$ function it follows that:
$$\tanh z = \sum_{m\geq 0}\frac{2(-1)^m\left(2^{2m+2}-1\right) }{\pi^{2m+2}}\zeta(2m+2)\, z^{2m+1}\tag{4}$$
but since $\frac{1}{1+e^{z}}=\frac{1-\tanh(z/2)}{2}$ it follows that:
$$\frac{1}{1+e^{z}}=\frac{1}{2}-\sum_{m\geq 0}\frac{(-1)^m\left(2^{2m+2}-1\right) }{2^{2m+1}\pi^{2m+2}}\zeta(2m+2)\, z^{2m+1}\tag{5}$$
so to solve the original problem it is enough to recall that $\zeta(2)=\frac{\pi^2}{6}$ and $\zeta(4)=\frac{\pi^4}{90}$.
Moreover, through $(5)$ it is straightforward to compute the magnitude of the coefficients by simply approximating $\zeta(2m+2)$ with $1$. On the other hand, that is trivial also by considering that the radius of convergence of the Taylor series of $f(z)=\frac{1}{1+e^z}$ at $z=0$ is $\pi$, since $f(z)$ is a meromorphic function with two simple poles at $z=\pm \pi i$.
A: Since you're just looking for the first few terms:
$$f(x)=\frac{1}{1+e^x} \implies f(0)=\frac 12$$
$$f'(x)=\frac{-e^x}{(1+e^x)^2} \implies f'(0)=-\frac 14$$
$$f''(x)=\frac{-e^x}{(1+e^x)^2}+2\frac{e^{2x}}{(1+e^x)^3}\implies f''(0)=0$$
$$f'''(x)=f''(x)+4\frac{e^{2x}}{(1+e^x)^3}-3\times 2\frac{e^x}{(1+e^x)^4}\implies f'''(0)=\frac 18$$
You get:
$$\frac{1}{1+e^x}=\frac 1{2\times 0!} -\frac 1{4\times 1!} x+\frac 1{8\times 3!}x^3+\mathcal O  (x^5)$$
$$\frac{1}{1+e^x}=\frac 1{2} -\frac 1{4} x+\frac 1{48}x^3+ \mathcal O  (x^5)$$
A: Here's another way to derive it term by term:
$$y^{-1}=1+e^x\Rightarrow -y^{-2}y'=e^x=y^{-1}-1\Rightarrow y'=y^2-y$$
Now you can continue to differentiate with the minimum of fuss:
$$y''=2yy'-y'$$
$$y'''=2yy''+2y'y'-y''$$
$$y^{(4)}=2yy'''+6y''y'-y'''$$
And so on, evaluating at each step.
A: $\begin{array}\\
f(x)
&=\frac{1}{1+e^x}\\
&=\frac{1}{2+(e^x-1)}\\
&=\frac12\frac{1}{1+(e^x-1)/2}\\
&=\frac12\sum_{n=0}^{\infty}(-1)^n\frac{(e^x-1)^n}{2^n}\\
&=\frac12\sum_{n=0}^{\infty}(-1)^n\frac{(x+x^2/2+x^3/6+...)^n}{2^n}\\
&=\frac12\sum_{n=0}^{\infty}(-1)^n(x/2)^n(1+x/2+x^2/6+...)^n\\
&=\frac12\sum_{n=0}^{\infty}(-1)^n(x/2)^n(1+nx/2+...)\\
&=\frac12\left(1-\frac{x}{2}(1+\frac{x}{2}+...)+\frac{x^2}{4}(1+...)+...\right)\\
&=\frac12\left(1-\frac{x}{2}-\frac{x^2}{4} +\frac{x^2}{4}(1+...)+...\right)\\
&=\frac12\left(1-\frac{x}{2}+O(x^3)\right)\\
&=\frac12-\frac{x}{4}+O(x^3)\\
\end{array}
$
