# Where's the mistake in integrating $\operatorname{sech}$ using series?

$$$$\begin{split} \int\frac{2dx}{e^x+e^{-x}} & = \int\frac{2e^{-x}dx}{1+e^{-2x}} \\ &= \int 2e^{-x} \sum_{k=0}^{\infty}(-1)^ke^{-2kx}\,dx \\ &= 2\sum_{k=0}^{\infty}(-1)^k\int e^{-x(2k+1)}\,dx +c\\ &= -2\sum_{k=0}^{\infty}(-1)^k\frac{ e^{-x(2k+1)}}{(2k+1)}+c \end{split}$$$$ Note that $\displaystyle \arctan(x)=\sum_{k=0}^{\infty}(-1)^k \frac{x^{2k+1}}{2k+1}$, giving $$$$\begin{split} \int\frac{2\,dx}{e^x+e^{-x}} & = -2\arctan(e^{-x})+c \end{split}$$$$ Wolfram says this integral is $\displaystyle\arctan\left(\tanh(\frac{x}{2})\right)$$\displaystyle=\arctan \left(\frac{1-e^{-x}}{1+e^{-x}}\right)=\arctan(1)+\arctan(-e^{-x})=\frac{\pi}{4}+\arctan(e^x) So, is \displaystyle -2\arctan(e^{-x})=k+\arctan(e^x) (if so, why?), or did I do something incorrectly? Normally I'd defer the mistake (if there is one) to my neglect for convergence, but the results are so alike that I think my method must be fundamentally correct. • That you have a correct answer cannot be an issue, since differentiating -2\arctan(e^{-x}) gives you the right thing. – André Nicolas Jul 28 '13 at 14:02 • @AndréNicolas Yes, it boiled down to a algebraic error in the end. – Meow Jul 28 '13 at 14:03 ## 1 Answer You made two mistakes: 1/ Wolframalpha gives a factor 2 that you missed. 2/ And this is the correct version of the difference of \arctan's$$\arctan \left(\frac{1-e^{-x}}{1+e^{-x}}\right)=\arctan(1)-\arctan(e^{-x})$\$

• The second was a typo, sorry. Yes, that helps. – Meow Jul 28 '13 at 13:56