TITLE: Characteristic function of the logistic distribution?
QUESTION [7 upvotes]: I recently came across a question in my graduate course where we have to calculate the characteristic function for the Logistic distribution. The Logistic distribution we are working with is given by the following PDF:
$$
f(x) = \frac{e^{-x}}{(1 + e^{-x})^2}. 
$$
The way that I went about doing this is the following:
$$E\left[ e^{itX} \right]
= E[\cos(tX)] + iE[\sin(tX)].
$$
The $E[\sin(tX)] = 0$.
The real problem for me comes when calculating $E[\cos(tX)]$. I tried to express $\cos$ in its exponential representation, but I didn't get too far with that. Upon plugging this integral into WolframAlpha, it says that the hypergeometric function is used for it. Any thoughts on how I can analytically compute this? I'd be happy to use the hypergeometric function, but I don't quite see the connection between that and $\text{csch}(x)$, which is part of the result that WolframAlpha gives (and this result matches the characteristic function listed for the Logistic distribution).
Edit: I would like to be able to do this problem without a computer and solely pencil and paper. This is what I mean by an analytic solution.

REPLY [2 votes]: Here is an alternative solution using the moment generator function and analytic continuation. The standard logistic distribution has the form
$$\mu(dx)=\frac{e^x}{(1+e^x)^2}\,dx$$
$$\mathcal{M}(\mu)(s)=\int_{\mathbb{R}}e^{sx}\frac{e^x}{(1+e^x)^2}\,dx
$$
The change of variables $u=\frac{1}{1+e^x}$ ($du=-\frac{e^x}{(1+e^x)^2}\,dx$) yields
$$\begin{align}
\mathcal{M}(\mu)(s)&=\int^1_0\Big(\frac{1-u}{u}\Big)^s du=\int^1_0u^{(1-s)-1}(1-u)^{(s+1)-1}\,du\\
&=B(1-s,s+1)=\frac{\Gamma(1-s)\Gamma(s+1)}{\Gamma(2)}=s\Gamma(1-s)\Gamma(s)\\
&=\frac{\pi s}{\sin(\pi s)}
\end{align}$$
for $-1<s<1$.  Notice $\mathcal{M}(\mu)$ can be defined analytically in the strip $(-1,1)\times\mathbb{R}$ and then, by analytic continuation it can be extended to all of $\mathbb{C}\setminus\mathbb{Z}$. In particular, for $s=it$, $t\in\mathbb{R}$, we obtain
$$
\widehat{\mu}(t)=\int_{\mathbb{R}}e^{itx}\frac{e^x}{(1+e^x)^2}\,dx=\frac{\pi it}{\sin(\pi it)}=\frac{\pi t}{\operatorname{sinh}(\pi t)}
$$
Since $\widehat{\mu}(t)$ is analytic on $(-1,1)\times\mathbb{R}$, $\int_{\mathbb{R}}|x|^n\mu(dx)<\infty$ for all $n\in\mathbb{Z}_+$. Using methods of complex analysis we can obtain a power series representation of $\widehat{\mu}$ around $0$ as follows. Recall that
$b(z)=\frac{z}{e^z-1}$ with $b(0)=1$, has power series representation
$$b(z)=\sum^\infty_{n=0}\frac{B_n}{n!}z^n, \qquad |z|<2\pi$$
where $B_n$ is the $n$-th Bernoulli number. The sequence $B_n$ satisfies $B_0=1$ and
$$ \delta_{1n}=\sum^{n-1}_{k=0}\frac{B_k}{k!}\frac{1}{(n-k)!},\qquad  n\in\mathbb{N}$$
A simple calculation shows that
\begin{align}
b(-z)+ b(z)&=z\frac{e^{z/2}+e^{-z/2}}{e^{z/2}-e^{z/2}}=z\operatorname{coth}\big(\tfrac{z}{2}\big)\\
b(-z)-b(z)&=z
\end{align}
These identities imply that $B_{2n+1}=0$ for $n\geq1$ and
$$\operatorname{coth}\big(\tfrac{z}{2}\big)=\sum^\infty_{k=0}\frac{2B_{2k}}{(2k)!}z^{2k-1}
$$
Since $\operatorname{coth}(z)-\operatorname{coth}(2z)=\frac{2}{e^{2z}-e^{-2z}}=\operatorname{csch}(2z)$,
$$z\operatorname{csch}(z)=\sum^{\infty}_{k=0}\frac{2B_{2k}}{(2k)!}\Big(1-2^{2k-1}\Big)z^{2k}
$$
Therefore
$$\widehat{\mu}(t)=\pi t\operatorname{csch}(\pi t)=\sum^\infty_{k=0}\frac{2B_{2k}}{(2k)!}(1-2^{2k-1})\pi^{2k}t^{2k}
$$