I am trying to show that $$I=\int_0^\pi \frac{x\cos x \sinh x}{\sin^2x+\sinh^2x}dx=\frac{\pi}{2}\ln\left(\frac{e^\pi+1}{e^\pi-1}\right)$$ I know there is an antiderivative in terms of dilogarithms and logarithms, but this nice closed form makes me think there is a clever way to get this result for these specific bounds of integration. So please avoid posting proofs with the antiderivative.

What I managed to do for now is to notice that $$I=-\Im\int_0^\pi\frac{x}{\sin(x(1+i))}dx$$ which you get by simple computation. From here how to proceed? I'm not sure if the substitution $t=x(1+i)$ is allowed here, since I think this would become a problem of contour integration, which I usually avoid.

Here is my question:

Is there a way to obtain this result without using the antiderivative and contour integration?

  • 2
    $\begingroup$ Perhaps the Feynman technique on something like $$J(\alpha) = \int_{0}^{\pi} \frac{\sin \alpha x \sinh x}{\sin^{2} x + \sinh^{2} x} dx$$ might work, though I haven't delved into the specifics. $\endgroup$ Jun 19, 2023 at 8:49
  • $\begingroup$ Hint: You can use the series representation $$\frac{x \cos x\sinh x}{\sin^2 x+\sinh^2 x}=2x\csc x\sinh x\sum_{k=1}^{\infty}e^{-2kx}\sin(2kx)$$ $\endgroup$
    – KStarGamer
    Jun 19, 2023 at 13:43
  • 1
    $\begingroup$ @KStarGamer's equation is easily proven with e.g.$$\sum_{k\ge1}e^{-2kx}\sin(2kx)=\Im\sum_{k\ge0}\left(e^{-2(1-i)x}\right)^k=\Im\frac{1}{1-e^{-2(1-i)x}}.$$The hard part is using it to evaluate the integral. $\endgroup$
    – J.G.
    Jun 19, 2023 at 14:36
  • 1
    $\begingroup$ Alternatively, you can recognise that $$I=-\Im\int_{0}^{\pi}x\csc((1+i)x)\, dx$$ and use the series representation $$\csc((1+i)x)=2\sum_{k=1}^{\infty}(-1)^ke^{i\left(\frac{\pi}{2}+(1+i)x\right)(2k-1)}$$ which converges on the region we are integrating over. Then proceed to take the negative of the imaginary part after integrating and recognise the resulting sum you get is of the form of the Taylor series of $\operatorname{arcoth}(z)$. $\endgroup$
    – KStarGamer
    Jun 19, 2023 at 15:11

3 Answers 3


Note the KEY trick: $$\boxed{\sin^2x+\sinh^2x=\cosh^2x-\cos^2x}\tag{0}$$

Hence, we can use $\color{red}{\text{partial fraction}}$ to split the integral:

$$\int_0^\pi \frac{x\cos x \sinh x}{\sin^2x+\sinh^2x}dx=\frac12\int_0^\pi \frac{x \sinh x}{\cosh x-\cos x}dx-\frac12\int_0^\pi \frac{x \sinh x}{\cosh x+\cos x}dx$$

From the series representation $$ \frac1{1-e^{-t+ix}}=\sum_{k=0}^\infty e^{-kt}e^{ikx},~~~~\frac1{1-e^{-t-ix}}=\sum_{k=0}^\infty e^{-kt}e^{-ikx} $$ Add them to get the real part: $$ \boxed{\frac{\sinh t}{\cosh t-\cos x}=1+2\sum_{k=1}^\infty e^{-kt}\cos(kx)}\tag{1} $$

From the series representation $$ \frac1{1+e^{-t+ix}}=\sum_{k=0}^\infty (-1)^ke^{-kt}e^{ikx},~~~~\frac1{1+e^{-t-ix}}=\sum_{k=0}^\infty (-1)^ke^{-kt}e^{-ikx} $$ Add them to get the real part: $$ \boxed{\frac{\sinh t}{\cosh t+\cos x}=1+2\sum_{k=1}^\infty(-1)^k e^{-kt}\cos(kx)}\tag{2} $$ The rest are trivial computations,

$$\begin{align}\int_0^\pi \frac{x \sinh x}{\cosh x-\cos x}dx&=\int_0^\pi xdx+2\sum_{k=1}^\infty\int_0^\pi xe^{-kx}\cos(kx)dx\\ \\ &=\frac{\pi^2}2-\pi\sum_{k=1}^\infty\frac{(-e^{-\pi})^k}{k}\\ \\ &=\frac{\pi^2}2+\pi\ln(1+e^{-\pi})\end{align}$$


$$\begin{align}\int_0^\pi \frac{x \sinh x}{\cosh x+\cos x}dx&=\int_0^\pi xdx+2\sum_{k=1}^\infty(-1)^k\int_0^\pi xe^{-kx}\cos(kx)dx\\ \\ &=\frac{\pi^2}2-\pi\sum_{k=1}^\infty\frac{(e^{-\pi})^k}{k}\\ \\ &=\frac{\pi^2}2+\pi\ln(1-e^{-\pi})\end{align}$$


$$\boxed{\int_0^\pi \frac{x\cos x \sinh x}{\sin^2x+\sinh^2x}dx=\frac\pi2\ln\left( \frac{1+e^{-\pi}}{1-e^{-\pi}}\right)=\frac\pi2\ln\left( \coth\left(\frac\pi2\right)\right)~}$$

  • $\begingroup$ Remarkable solution, thank you $\endgroup$
    – Zima
    Jun 19, 2023 at 21:35
  • $\begingroup$ You are welcome! $\endgroup$
    – MathFail
    Jun 19, 2023 at 21:44

PREP $$\frac{1}{\sin(ax)}=\frac{2ie^{-aix}}{1-e^{-2aix}}=2ie^{-aix}\sum_{n=0}^\infty e^{-2anix}=2i\sum_{n=0}^\infty e^{(2n+1)aix}$$ $$\int_0^\pi xe^{mx}dx=\frac{\pi e^{\pi m}}{m}-\frac{e^{\pi m}}{m^2}+\frac{1}{m^2}$$

$$\sum_{n=0}^\infty\frac{x^{2n+1}}{2n+1}=\operatorname{arctanh} x, \space |a|^2<1$$ $$\sum_{n=0}^\infty\frac{1}{(2n+1)^2}=\frac{\pi^2} 8$$ Let $a=1+i$

$$I=\int_0^\pi\frac{x\cos(x)\sinh(x)}{\sin^2(x)+\sinh^2(x)}dx=-\Im \int_0^\pi\frac{x}{\sin(ax)}dx$$ $$I=-\Im \int_0^\pi\frac{x}{\sin(ax)}dx=-\Im \int_0^\pi 2ix\sum_{n=0}^\infty e^{(2n+1)aix}dx$$

$$=-\Im \sum_{n=0}^\infty 2i\int_0^\pi xe^{(2n+1)aix}dx=-\Im \sum_{n=0}^\infty 2i\left(\frac{\pi e^{(2n+1)ai\pi }}{(2n+1)ai}+\frac{e^{(2n+1)ai\pi }}{(2n+1)^2a^2}-\frac{1}{(2n+1)^2a^2}\right)$$

Let $b=e^{ai\pi}=e^{i(1+i)\pi}=-e^{-\pi}$. Note that $\frac{2i}{a^2}=1$

$$=-\Im \sum_{n=0}^\infty 2i\left(\frac{\pi b^{(2n+1) }}{(2n+1)ai}+\frac{b^{(2n+1) }}{(2n+1)^2a^2}-\frac{1}{(2n+1)^2a^2}\right)$$


The remaining sum is real, so we can discard it $$I=\pi\operatorname{arctanh}(e^{-\pi})$$

  • 1
    $\begingroup$ The sign error is right at the end, since $-\Im\frac{2\pi}{1+i}=-\Im\pi(1-i)=+\pi$. $\endgroup$
    – J.G.
    Jun 20, 2023 at 8:26
  • $\begingroup$ @J.G. thank you $\endgroup$
    – phi-rate
    Jun 20, 2023 at 15:27

(Not an answer to your question since this involves contour integration near the beginning. Just doing this for fun since you've already accepted an answer.)

Starting from where you left off, we let $x + ix \mapsto x$ to get

$$I := -\Im \int_0^\pi x \csc(x+ix)dx = -\Im \frac{1}{(1+i)^2}\int_0^{\pi + i\pi}x\csc{x} dx = \frac{1}{2}\Re\int_0^{\pi+i\pi}x\csc{x}dx.$$

Let $f(z) = z\csc{z}$. Centering at $z=0$, we can expand this as the series $\displaystyle 1 + \frac{z^2}{6} + \frac{7z^4}{360} + O\left(z^6\right).$ This converges as $z \to 0$, making $z=0$ a removable singularity.

With that in mind, we construct a contour shaped as a right triangle such that its vertices are on the points $(0,0), (0,\pi),$ and $(\pi, \pi)$. We also traverse around it clockwise. We use Cauchy's Residue Theorem to get

$$ \begin{align} 0 &= \int_{\pi+i\pi}^0 f(z)dz + \int_0^{i\pi}f(z)dz + \int_{i\pi}^{\pi+i\pi}f(z)dz \\ \int_{0}^{\pi+i\pi} f(z)dz &= \int_0^{i\pi}f(z)dz + \int_{i\pi}^{\pi+i\pi}f(z)dz. \end{align} $$

Since the contour integral over the hypotenuse is what we need to retrieve $I$, we apply $\frac{1}{2}\Re$ on both sides. Then we have this long calculation:

$$ \begin{align} I &= \frac{1}{2}\Re\int_0^{i\pi}f(z)dz + \frac{1}{2}\Re\int_{i\pi}^{\pi+i\pi}f(z)dz \\ \\ &= \frac{1}{2}\Re\int_0^\pi f(iy)d(iy) + \frac{1}{2}\Re\int_0^\pi f(x+i\pi)d(x+i\pi)\\ \\ &= \frac{1}{2}\Re i\int_0^\pi iy\csc(iy)dy + \Re\int_0^\pi \frac{x+i\pi}{2\sin(x+i\pi)}dx \\ \\ &= \frac{1}{2}\Re i \int_0^\pi y\operatorname{csch}ydy + \int_{0}^{\pi}\left(\frac{\cosh\left(\pi\right)x\sin x}{\cosh2\pi-\cos2x}+\frac{\pi\sinh\left(\pi\right)\cos x}{\cosh2\pi-\cos2x}\right)dx \\ \\ &= \frac{1}{2}\cdot 0+\cosh\left(\pi\right)\int_{0}^{\pi}\frac{\left(\pi-x\right)\sin\left(\pi-x\right)}{\cosh2\pi-\cos\left(2\left(\pi-x\right)\right)}dx\\ &~~~~~~~~~~~~~~+\pi\sinh\pi\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{\cos\left(x+\frac{\pi}{2}\right)}{\cosh2\pi-\cos\left(2\left(x+\frac{\pi}{2}\right)\right)}dx \\ \\ &= \pi\cosh\pi\int_{0}^{\pi}\frac{\sin x}{\cosh2\pi-\cos2x}dx-\cosh\pi\int_{0}^{\pi}\frac{x\sin x}{\cosh2\pi-\cos2x}dx + \pi \sinh{\pi} \cdot 0\\ \\ &= \frac{\pi\cosh\pi}{2}\int_{0}^{\pi}\frac{\sin x}{\cosh2\pi-\cos2x}dx \\ \\ &= -\frac{\pi\cosh\pi}{2}\int_{0}^{\pi}\frac{\sin x}{2\cos^{2}x-\cosh2\pi-1}dx \\ \\ &= -\frac{\pi\cosh\pi}{2}\int_{-1}^{1}\frac{1}{2x^{2}-\cosh2\pi-1}dx \\ \\ &= \frac{\pi\cosh\pi}{2+2\cosh2\pi}\int_{-1}^{1}\frac{1}{1-\frac{2x^{2}}{1+\cosh2\pi}}dx \\ \\ &= \frac{\pi\cosh^{2}\pi}{2+2\cosh2\pi}\int_{-\operatorname{sech}\pi}^{\operatorname{sech}\pi}\frac{1}{1-x^{2}}dx \\ \\ &= \frac{\pi\cosh^{2}\pi}{2+2\cosh2\pi}\left(\tanh^{-1}\left(\operatorname{sech}\pi\right)-\tanh^{-1}\left(-\operatorname{sech}\pi\right)\right) \\ \\ &= \frac{\pi}{2}\ln\left(\frac{e^{\pi}+1}{e^{\pi}-1}\right) \end{align} $$

  • 1
    $\begingroup$ Thank you for your answer, some steps of the "long calculation" are not obvious to me but I really liked the contour you chose, never heard of it before $\endgroup$
    – Zima
    Jun 20, 2023 at 6:25
  • 1
    $\begingroup$ @Zima I used a CAS for some steps just to get some main points across. Thank you, that triangle contour was something I made up on the fly. Technically, any contour would work as long as convergence stuff lies in your favor and the shape has (or could result in) the interval of integration you need. $\endgroup$ Jun 20, 2023 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .