Integrate $\int_0^\pi\frac{3\cos x+\sqrt{8+\cos^2 x}}{\sin x}x\ \mathrm dx$

Here's one way to go.

First, note that $$\begin{eqnarray*} \int_0^\pi\frac{3\cos x+\sqrt{8+\cos^2 x}}{\sin x}x\ \mathrm dx &=& \int_0^\pi\frac{3x(1+\cos x)}{\sin x} \mathrm dx +\int_0^\pi\frac{3x}{\sin x} \left(-1+\sqrt{1-\frac{\sin^2x}{9}}\right)\ \mathrm dx. \end{eqnarray*}$$ For now I'll simply claim that \begin{equation*} \int_0^\pi\frac{3x(1+\cos x)}{\sin x} \mathrm dx = \pi\log 64.\tag{1} \end{equation*} (I would be surprised if this integral has not been handled somewhere on this site.) But $$\begin{eqnarray*} \int_0^\pi\frac{3x}{\sin x} \left(-1+\sqrt{1-\frac{\sin^2x}{9}}\right)\ \mathrm dx &=& \int_0^\pi\frac{3x}{\sin x} \sum_{k=1}^\infty {1/2\choose k} \frac{(-1)^k}{3^{2k}} \sin^{2k}x \ \mathrm dx \\ &=& \sum_{k=1}^\infty {1/2\choose k} \frac{(-1)^k}{3^{2k-1}} \int_0^\pi x \sin^{2k-1}x \ \mathrm dx \\ &=& \sum_{k=1}^\infty {1/2\choose k} \frac{(-1)^k}{3^{2k-1}} \frac{\pi^{3/2}\Gamma(k)}{2\Gamma(k+1/2)} \\ &=& -\pi \sum_{k=1}^\infty \frac{1}{3^{2k-1}2k(2k-1)} \\ &=& -\pi \log \frac{32}{27}. \end{eqnarray*}$$ (The last sum can be found by standard methods. Schematically, $\sum \frac{a^{2k-1}}{2k(2k-1)} = \sum \int {\mathrm da} \frac{a^{2k-2}}{2k}$.) Thus, the integral is $\pi \log 54$ as claimed.


Proof of (1): We have $$\begin{eqnarray*} \int_0^\pi \frac{3x(1+\cos x)}{\sin x} \ \mathrm dx &=& \int_{0^+}^\pi \frac{3x(1+\cos x)}{\sin x} \ \mathrm dx \\ &=& 3\int_{0^+}^\pi x \cot\frac{x}{2} \ \mathrm dx \hspace{5ex}\textrm{(double angle formulas)} \\ &=& 12 \int_{0^+}^{\pi/2} t\cot t \ \mathrm dt \hspace{5ex} (t = x/2) \\ &=& -12\int_{0^+}^{\pi/2} \log\sin t \ \mathrm dt \hspace{5ex}\textrm{(integrate by parts)} \\ &=& -6\int_{0^+}^{\pi/2} \log\sin^2 t \ \mathrm dt \\ &=& -6\int_{0^+}^{\pi/2} \log(1-\cos^2 t) \ \mathrm dt \\ &=& 6 \int_{0^+}^{\pi/2} \sum_{k=1}^\infty \frac{1}{k}\cos^{2k}t \ \mathrm dt \hspace{5ex}\textrm{(series for log)} \\ &=& 6\sum_{k=1}^\infty \frac{1}{k} \int_{0^+}^{\pi/2} \cos^{2k}t \ \mathrm dt \hspace{5ex} \textrm{(Tonelli's theorem)}\\ &=& 6\sum_{k=1}^\infty \frac{1}{k} \frac{\sqrt{\pi}\Gamma(k+1/2)}{2\Gamma(k+1)} \\ &=& 3\pi \sum_{k=1}^\infty {1/2 \choose k}(-1)^{k+1}\frac{2k-1}{k} \\ &=& \pi \log 64. \end{eqnarray*}$$ Note that $$\begin{eqnarray*} 6\pi \sum_{k=1}^\infty {1/2 \choose k}(-1)^{k+1} &=& -6\pi \left[\sum_{k=0}^\infty {1/2 \choose k}(-1)^{k} - 1\right] \\ &=& -6\pi[(1-1)^{1/2} - 1] \\ &=& 6\pi \end{eqnarray*}$$ and $$\begin{eqnarray*} -3\pi \sum_{k=1}^\infty {1/2 \choose k}(-1)^{k+1} \frac{1}{k} &=& 3\pi \sum_{k=1}^\infty {1/2\choose k}(-1)^k \int_0^1 x^{k-1} \ \mathrm dx \\ &=& 3\pi \int_0^1 \frac{1}{x} \left[ \sum_{k=0}^\infty {1/2\choose k}(-1)^k x^{k} -1 \right] \ \mathrm dx \\ &=& 3\pi \int_0^1 \frac{1}{x} \left( \sqrt{1-x} -1 \right) \ \mathrm dx \\ &=& 3\pi(-2+\log 4) \\ &=& -6\pi + \pi\log 64. \end{eqnarray*}$$


Let $$y=\frac{3\cos x+\sqrt{8+\cos^2 x}}{\sin x},$$ then, solving this with respect to $x$, we get $$x=\frac{\pi}{2}+\text{arccot}\frac{6y}{8-y^2}.$$ So, $$\int_0^\pi\frac{3\cos x+\sqrt{8+\cos^2 x}}{\sin x}x\ \mathrm dx=\int_0^\infty\frac{6y(8+y^2)}{(4+y^2)(16+y^2)}\left(\frac{\pi}{2}+\text{arccot}\frac{6y}{8-y^2}\right)\mathrm dy.$$ The latter integral can be solved by Mathematica and yields $$\pi\log54.$$


Of course, we want to prove that the result returned by Mathematica is correct.

The following statement is provably true, that can be checked directly by taking derivatives of both sides: $$\int\frac{6y(8+y^2)}{(4+y^2)(16+y^2)}\left(\frac{\pi}{2}+\text{arccot}\frac{6y}{8-y^2}\right)\mathrm dy =\\ \frac{1}{2} i \left(2 \text{Li}_2\left(\frac{iy}{8}+\frac{1}{2}\right)+\text{Li}_2\left(\frac{iy}{6}+\frac{1}{3}\right)+2\text{Li}_2\left(\frac{iy}{6}+\frac{2}{3}\right)+\text{Li}_2\left(\frac{iy}{4}+\frac{1}{2}\right)+\text{Li}_2\left(\frac{2i}{y-2 i}\right)-\text{Li}_2\left(-\frac{2 i}{y+2i}\right)-\text{Li}_2\left(-\frac{1}{6} i (y+2i)\right)-\text{Li}_2\left(-\frac{1}{4} i (y+2i)\right)-2 \left(-\text{Li}_2\left(-\frac{2i}{y-4 i}\right)+\text{Li}_2\left(\frac{2 i}{y+4i}\right)+\text{Li}_2\left(-\frac{1}{8} i (y+4i)\right)+\text{Li}_2\left(-\frac{1}{6} i (y+4i)\right)\right)\right)+\pi \left(\frac{1}{2}\log \left(3 \left(y^2+4\right)\right)+\log\left(\frac{3}{64}\left(y^2+16\right)\right)\right)+\log \left(4\left(y^2+4\right)\right) \arctan\left(\frac{y}{4}\right)-\left(\log576-2\log \left(y^2+16\right)\right) \arctan\left(\frac{4}{y}\right)+\log\left(y^2+4\right) \text{arccot}\left(\frac{6y}{8-y^2}\right)-\arctan\left(\frac{2}{y}\right)\log12 +\arctan\left(\frac{y}{2}\right)\log2$$

The remaining part is to calculate $\lim\limits_{y\to0}$ and $\lim\limits_{y\to\infty}$ of this expression, which I haven't done manually yet, but it looks like a doable task.


Begin with $u$-substitution using $$\begin{align} u & =x\\ dv & = \frac{3\cos(x)+\sqrt{8+\cos^2(x)}}{\sin(x)}\,dx\end{align}$$ so that $du=dx$, and my CAS tells me (which I suppose could be verified through differentiation and identities) that $$\begin{align} v & = \sinh^{-1}\left(\frac{\cos(x)}{\sqrt{8}}\right)+\frac{3}{2}\ln\left(\frac{3\sqrt{\cos^2(x)+8}-\cos(x)+8}{3\sqrt{\cos^2(x)+8}+\cos(x)+8}\right)+3\ln(1-\cos(x)) \end{align}$$

Now we have $$\begin{align} \left[x\left(\sinh^{-1}\left(\frac{\cos(x)}{\sqrt{8}}\right)+\frac{3}{2}\ln\left(\frac{3\sqrt{\cos^2(x)+8}-\cos(x)+8}{3\sqrt{\cos^2(x)+8}+\cos(x)+8}\right)+3\ln(1-\cos(x))\right)\right]_0^\pi\\ -\int_0^\pi\left(\sinh^{-1}\left(\frac{\cos(x)}{\sqrt{8}}\right)+\frac{3}{2}\ln\left(\frac{3\sqrt{\cos^2(x)+8}-\cos(x)+8}{3\sqrt{\cos^2(x)+8}+\cos(x)+8}\right)+3\ln(1-\cos(x))\right)dx \end{align}$$

and most of the integral part can be evaluated by taking advantage of symmetry about $\pi/2$:

$$\begin{align} \left[x\left(\sinh^{-1}\left(\frac{\cos(x)}{\sqrt{8}}\right)+\frac{3}{2}\ln\left(\frac{3\sqrt{\cos^2(x)+8}-\cos(x)+8}{3\sqrt{\cos^2(x)+8}+\cos(x)+8}\right)+3\ln(1-\cos(x))\right)\right]_0^\pi\\ -3\int_0^\pi\ln(1-\cos(x))dx \end{align}$$

($\sinh^{-1}$ is odd and $\cos(x)$ has odd symmetry about $\pi/2$. For the logarithmic term, the input to $\ln()$ at $x$ is the reciprocal of the input at $\pi/2-x$.)

Some of the nonintegral-part can be cleanly evaluated:

$$\begin{align} \pi\sinh^{-1}\left(\frac{-1}{\sqrt{8}}\right)+\frac{3\pi}{2}\ln\left(\frac{9}{8}\right)+\left[3x\ln(1-\cos(x))\right]_0^\pi\\ -3\int_0^\pi\ln(1-\cos(x))dx \end{align}$$

and now moving the "unclean" part back into an integral: $$\begin{align} \pi\sinh^{-1}\left(\frac{-1}{\sqrt{8}}\right)+\frac{3\pi}{2}\ln\left(\frac{9}{8}\right)+\int_0^\pi\left(3\ln(1-\cos(x))+\frac{3x\sin(x)}{1-\cos(x)}\right)\,dx\\ -3\int_0^\pi\ln(1-\cos(x))dx\\ =\pi\sinh^{-1}\left(\frac{-1}{\sqrt{8}}\right)+\frac{3\pi}{2}\ln\left(\frac{9}{8}\right)+\int_0^\pi\frac{3x\sin(x)}{1-\cos(x)}\,dx \end{align}$$

My CAS says this is

$$\begin{align} \pi\sinh^{-1}\left(\frac{-1}{\sqrt{8}}\right)+\frac{3\pi}{2}\ln\left(\frac{9}{8}\right)+\pi\ln(64) \end{align}$$

which is the only thing the CAS does that I don't quite get. But it's nothing special about endpoints: even WA can give an antiderivative if we can use the dilogarithm. It looks like an integral that might even appear somewhere on this site. A conversion of the arcsinh and logarithm rules yields

$$\begin{align} \pi\ln(2^{-\frac{1}{2}})+\pi\ln\left(\frac{27}{8^{3/2}}\right)+\pi\ln(64)=\pi\ln(54) \end{align}$$