Taylor Series Expansion of $\tanh x$

You may too use the method I used here for the expansion of $\tan$ :

Integrate repetitively $\ \tanh'(x)=1-\tanh(x)^2\ $ starting with $\,\tanh(x)\approx x$ :

\begin{align} \tanh(x)&\small{=}\ x+O\bigl(x^2\bigr)\\ &\small{=\int 1-\left(x+O\bigl(x^2\bigr)\right)^2\,dx}=x-\frac {x^3}3+O\bigl(x^4\bigr)\\ &\small{=\int 1-\left(x-\frac {x^3}3+O\bigl(x^4\bigr)\right)^2dx=\int 1-x^2+\frac {2x^4}3\,dx-O\bigl(x^6\bigr)}=x-\frac {x^3}3+\frac {2x^5}{15}-O\bigl(x^6\bigr)\\ &= \cdots\\ \end{align}

Every integration gives another coefficient of $\ \displaystyle\tanh(x)=\sum_{n\ge 0} a_n\ (-1)^n\,x^{2n+1}\ $ and we get simply : $$a_0=1,\; a_{n+1}=\frac 1{2n+3} \sum_{k=0}^n a_k\ a_{n-k},\ \text{for}\;n>0$$ i.e. the sequence (with alternating signs for $\tanh$) : $$(a_n)_{n\in\mathbb{N}}=\left(\frac 11,\frac 13, \frac 2{15}, \frac {17}{315}, \frac {62}{2835}, \frac{1382}{155925},\cdots\right)$$

We may probably deduce the recurrence relation of Bernoulli numbers in function of this one (or vice et versa) but I didn't try that yet.


\begin{eqnarray} \tanh x &=& x - \frac {x^3} {3} + \frac {2x^5} {15} - \frac {17x^7} {315} + \cdots = \sum_{n=1}^\infty \frac{2^{2n}(2^{2n}-1)B_{2n} x^{2n-1}}{(2n)!}, \left |x \right | < \frac {\pi} {2} \\ \end{eqnarray} Where $B_{m}$ is the $m$-th Bernoulli number defined as \begin{equation} B_m(n) = \sum_{k=0}^m\sum_{v=0}^k(-1)^v\binom kv\frac{\left( n+v\right) ^m}{k+1} \end{equation}


An easy way to compute the coefficients of the Taylor series of $\tanh$ is to consider that: $$\cosh(z)=\prod_{n=0}^{+\infty}\left(1+\frac{4z^2}{(2n+1)^2 \pi^2}\right)$$ hence: $$ \log\cosh z = \sum_{n=0}^{+\infty}\log\left(1+\frac{4z^2}{(2n+1)^2 \pi^2}\right)$$ and by differentiating: $$ \tanh z = 2z\sum_{n=0}^{+\infty}\frac{\frac{4}{(2n+1)^2 \pi^2}}{1+\frac{4z^2}{(2n+1)^2 \pi^2}}$$ so: $$ [z^{2k+1}]\tanh z = 2\frac{(-1)^k}{\pi^{2k+2}}\sum_{n=0}^{+\infty}\frac{1}{(n+1/2)^{2k+2}}=2\frac{(-2)^k}{\pi^{2k+2}}\sum_{n=0}^{+\infty}\frac{1}{(2n+1)^{2k+2}}$$ giving:

$$ [z^{2k+1}]\tanh z = 2\frac{(-1)^k}{\pi^{2k+2}}\left(1-\frac{1}{4^{k+1}}\right)\zeta(2k+2).$$