<s>[INST] Help find the MacLaurin series for $\frac{1}{e^x+1}$ What is the MacLaurin series up to $x^4$ for $\frac{1}{e^x+1}$?
My Attempt:
$$\begin{align}
\frac{1}{e^x+1} &=(1+e^x)^{-1} \\
&\approx 1 -e^x+(e^x)^2-(e^x)^3+(e^x)^4 \\
\end{align}
$$
Since
$$
\begin{align}
e^x  &\approx \frac{1}{24} \, x^{4} + \frac{1}{6} \, x^{3} + \frac{1}{2} \, x^{2} + x
+ 1 \\
(e^x)^2 &\approx \frac{2}{3} \, x^{4} + \frac{4}{3} \, x^{3} + 2 \, x^{2} + 2 \, x + 1
 \\
(e^x)^3 &\approx \frac{27}{8} \, x^{4} + \frac{9}{2} \, x^{3} + \frac{9}{2} \, x^{2} + 3
\, x + 1 \\
(e^x)^4 & \approx \frac{32}{3} \, x^{4} + \frac{32}{3} \, x^{3} + 8 \, x^{2} + 4 \, x + 1
\end{align}
$$
Therefore
$$
1 -e^x+(e^x)^2-(e^x)^3+(e^x)^4 \approx \frac{95}{12} \, x^{4} + \frac{22}{3} \, x^{3} + 5 \, x^{2} + 2 \, x + 1
$$
But the answer is $\frac{1}{48} \, x^{3} - \frac{1}{4} \, x + \frac{1}{2}$
Please advise what did I do wrong and what is the correct way to solve this problem.
 [/INST] Your initial expansion is an asymptotic series, valid for small values of $e^x$.  But when $x$ is small, $e^x \approx 1$, which isn't small at all!  If you instead write
$$
\frac{1}{e^x+1}=\frac{1}{2+(e^x-1)}=\frac{1}{2}\cdot\frac{1}{1+\frac{1}{2}(e^x-1)}=\frac{1}{2}\left(1-\frac{1}{2}(e^x-1) +\frac{1}{4}(e^x-1)^2-\frac{1}{8}(e^x-1)^3+\frac{1}{16}(e^x-1)^4+\ldots\right),
$$
and then fill in the expansion for $e^x-1$ where appropriate, you should find the right answer.
</s>