% Cleo bench — shared template for derivation documents.
% Replace <<TITLE>>, <<QID>>, <<N>> and the body. Keep the preamble as-is unless
% a document genuinely needs another package.
\documentclass[11pt]{article}
\usepackage[a4paper,margin=2.7cm]{geometry}
\usepackage{amsmath,amssymb,amsthm,mathtools}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage[colorlinks=true,linkcolor=blue!50!black,urlcolor=blue!50!black]{hyperref}
\allowdisplaybreaks

\newtheorem{lemma}{Lemma}
\newtheorem{proposition}{Proposition}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}

\title{Cleo Bench Problem 7\\[1ex]\large Calculating $\int_{\pi/2}^{\pi}\frac{x\sin{x}}{5-4\cos{x}}\,\mathrm dx$}
\author{Derivation by Claude (Fable 5), closed-book\thanks{Problem originally
posed on Mathematics Stack Exchange
(\href{https://math.stackexchange.com/q/418134}{question 418134}, CC BY-SA),
famously answered by user Cleo. This derivation was produced independently,
offline, without access to the published answer, as part of the Cleo benchmark.}}
\date{July 2026}

\begin{document}
\maketitle

\section*{Problem}

Evaluate in exact closed form
\[I \;=\; \int_{\pi/2}^{\pi}\frac{x\sin x}{5-4\cos x}\,\mathrm dx .\]

(The classical companion $\int_{0}^{\pi}\frac{x\sin x}{5-4\cos x}\,dx=\frac{\pi}{2}\ln\frac32$ is easy; the point of the problem is the half interval $[\pi/2,\pi]$.)

\section*{Result}

\[\boxed{\;\int_{\pi/2}^{\pi}\frac{x\sin x}{5-4\cos x}\,dx
\;=\;\frac{\pi}{8}\ln\frac{81}{20}\;-\;\frac12\,\operatorname{Ti}_2\!\Big(\frac12\Big)\;}\]

where $\operatorname{Ti}_2$ is the inverse tangent integral,
\[\begin{gathered}
\operatorname{Ti}_2(y)=\int_0^y\frac{\arctan t}{t}\,dt=\sum_{k=0}^{\infty}\frac{(-1)^k y^{2k+1}}{(2k+1)^2}=\Im\operatorname{Li}_2(iy),\\
\operatorname{Ti}_2\Big(\frac12\Big)=\sum_{k=0}^{\infty}\frac{(-1)^k}{(2k+1)^2\,2^{2k+1}}=0.48722235829452235711\ldots
\end{gathered}\]

Equivalent forms of the answer:
\[I=\frac{\pi}{2}\ln 3-\frac{\pi}{4}\ln 2-\frac{\pi}{8}\ln 5-\frac12\,\Im\operatorname{Li}_2\!\Big(\frac{i}{2}\Big)
=\frac{\pi}{8}\ln\frac{81}{20}+\frac{i}{4}\Big[\operatorname{Li}_2\Big(\frac i2\Big)-\operatorname{Li}_2\Big(-\frac i2\Big)\Big].\]

Numerically $I = 0.3056636556244567842879511119999482029039534693\ldots$

\section*{Derivation}

\subsection*{Step 0. Structure of the denominator}

For all real $x$,
\[\big(2-e^{ix}\big)\big(2-e^{-ix}\big)=4-2\big(e^{ix}+e^{-ix}\big)+1=5-4\cos x,\]
so
\[5-4\cos x=4\left|1-\tfrac12 e^{ix}\right|^{2}\;\in[1,9],\]
strictly positive. Hence the integrand is continuous on $[\pi/2,\pi]$ (no singularities) and all manipulations below take place with absolutely bounded, continuous functions.

\subsection*{Step 1. Integration by parts}

Since $\dfrac{d}{dx}\ln(5-4\cos x)=\dfrac{4\sin x}{5-4\cos x}$, we have
$\dfrac{\sin x}{5-4\cos x}=\dfrac14\,\dfrac{d}{dx}\ln(5-4\cos x)$, and both factors $x$ and $\ln(5-4\cos x)$ are $C^1$ on $[\pi/2,\pi]$, so integration by parts is legitimate:
\[I=\frac14\Big[x\ln(5-4\cos x)\Big]_{\pi/2}^{\pi}-\frac14\int_{\pi/2}^{\pi}\ln(5-4\cos x)\,dx .\]
With $5-4\cos\pi=9$ and $5-4\cos\frac\pi2=5$,
\[I=\frac{\pi\ln 9}{4}-\frac{\pi\ln 5}{8}-\frac14\,L,
\qquad L:=\int_{\pi/2}^{\pi}\ln(5-4\cos x)\,dx. \tag{1}\]

\subsection*{Step 2. The log integral $L$}

By Step 0,
\[\ln(5-4\cos x)=2\ln 2+2\ln\Big|1-\tfrac12 e^{ix}\Big|. \tag{2}\]

For $|z|\le\frac12$ the principal logarithm has the absolutely convergent expansion $\log(1-z)=-\sum_{n\ge1}\frac{z^n}{n}$; with $z=\frac12e^{ix}$ the terms are bounded by $\frac1{n2^n}$, so by the Weierstrass $M$-test the series converges \textbf{uniformly in $x\in\mathbb R$}. Taking real parts,
\[\ln\Big|1-\tfrac12 e^{ix}\Big|=-\sum_{n=1}^{\infty}\frac{\cos nx}{n\,2^{n}},\]
uniformly on $[\pi/2,\pi]$. Uniform convergence on the compact interval justifies term-by-term integration:
\[\begin{aligned}
\int_{\pi/2}^{\pi}\ln\Big|1-\tfrac12 e^{ix}\Big|\,dx
&=-\sum_{n=1}^{\infty}\frac1{n2^n}\int_{\pi/2}^{\pi}\cos nx\,dx\\
&=-\sum_{n=1}^{\infty}\frac{\sin n\pi-\sin\frac{n\pi}{2}}{n^{2}2^{n}}
=\sum_{n=1}^{\infty}\frac{\sin\frac{n\pi}{2}}{n^{2}2^{n}} .
\end{aligned}\]
Now $\sin\frac{n\pi}{2}=0$ for even $n$ and $\sin\frac{(2k+1)\pi}{2}=(-1)^k$, so
\[\int_{\pi/2}^{\pi}\ln\Big|1-\tfrac12 e^{ix}\Big|\,dx
=\sum_{k=0}^{\infty}\frac{(-1)^{k}}{(2k+1)^{2}\,2^{2k+1}}
=\operatorname{Ti}_2\Big(\frac12\Big), \tag{3}\]
by the defining series of the inverse tangent integral. (That series equals $\int_0^{1/2}\frac{\arctan t}{t}dt$ by integrating $\frac{\arctan t}{t}=\sum_{k\ge0}\frac{(-1)^k t^{2k}}{2k+1}$ term by term --- again uniform on $[0,\frac12]$ --- and equals $\Im\operatorname{Li}_2(i/2)$ because $\operatorname{Li}_2(iy)=\sum_n \frac{(iy)^n}{n^2}$ has imaginary part $\sum_n\frac{y^n\sin(n\pi/2)}{n^2}$.)

\textit{Series-free cross-check of (3).} $\operatorname{Li}_2$ is analytic on $|z|<1$ and $\frac{d}{dx}\operatorname{Li}_2\!\big(\tfrac12e^{ix}\big)=-\,i\log\!\big(1-\tfrac12e^{ix}\big)$, so $\ln\big|1-\tfrac12e^{ix}\big| = -\frac{d}{dx}\Im\operatorname{Li}_2\!\big(\tfrac12e^{ix}\big)$, whence
\[\int_{\pi/2}^{\pi}\ln\Big|1-\tfrac12e^{ix}\Big|dx=\Im\operatorname{Li}_2\Big(\frac i2\Big)-\Im\operatorname{Li}_2\Big(-\frac12\Big)=\operatorname{Ti}_2\Big(\frac12\Big),\]
since $\operatorname{Li}_2(-\tfrac12)$ is real. Same result.

Combining (2) and (3):
\[L=2\ln2\cdot\frac{\pi}{2}+2\operatorname{Ti}_2\Big(\frac12\Big)=\pi\ln 2+2\operatorname{Ti}_2\Big(\frac12\Big). \tag{4}\]

\subsection*{Step 3. Assemble}

Insert (4) into (1):
\[I=\frac{\pi\ln 9}{4}-\frac{\pi\ln 5}{8}-\frac{\pi\ln 2}{4}-\frac12\operatorname{Ti}_2\Big(\frac12\Big)
=\frac{\pi}{8}\,\ln\frac{9^{2}}{4\cdot 5}-\frac12\operatorname{Ti}_2\Big(\frac12\Big)
=\frac{\pi}{8}\ln\frac{81}{20}-\frac12\operatorname{Ti}_2\Big(\frac12\Big).\]

$\blacksquare$

\subsection*{Consistency checks with the full range}

An independent route (used as a cross-check) is the uniformly convergent Poisson-type series obtained from $\sum_{n\ge1}r^n\sin nx=\frac{r\sin x}{1-2r\cos x+r^2}$ at $r=\frac12$:
\[\frac{\sin x}{5-4\cos x}=\frac12\sum_{n=1}^{\infty}\frac{\sin nx}{2^{n}},\]
and $\int_{\pi/2}^{\pi}x\sin nx\,dx=-\frac{\pi(-1)^n}{n}+\frac{\pi\cos(n\pi/2)}{2n}-\frac{\sin(n\pi/2)}{n^2}$. Summing with $\sum_{n}\frac{(-1)^n}{n2^n}=-\ln\frac32$ and $\sum_n\frac{\cos(n\pi/2)}{n2^n}=-\Re\log(1-\tfrac i2)=-\frac12\ln\frac54$ reproduces exactly the same value. In particular one gets the classical
\[\int_{0}^{\pi}\frac{x\sin x}{5-4\cos x}\,dx=\frac{\pi}{2}\ln\frac32,
\qquad\text{hence}\qquad
\int_{0}^{\pi/2}\frac{x\sin x}{5-4\cos x}\,dx=\frac{\pi}{8}\ln\frac54+\frac12\operatorname{Ti}_2\Big(\frac12\Big):\]
the two half-range integrals carry the constant $\operatorname{Ti}_2(1/2)$ with opposite signs, and it cancels over the full range --- which is why $[0,\pi]$ is elementary while $[\pi/2,\pi]$ is not.

\subsection*{Why $\operatorname{Ti}_2(1/2)$ is the right ``closed form''}

$\operatorname{Ti}_2(1/2)=\Im\operatorname{Li}_2(i/2)$ is a standard dilogarithmic constant. It satisfies $\operatorname{Ti}_2(2)-\operatorname{Ti}_2(1/2)=\frac{\pi}{2}\ln 2$ and Lewin-type Clausen representations, but it has \textbf{no known evaluation} in terms of $\pi$, logarithms and Catalan's constant $G$ (the known closed-form points of $\operatorname{Ti}_2$ are $\tan\frac\pi4=1$, $\tan\frac{\pi}{12}=2-\sqrt3$, etc., and $\frac12$ is not of that form). As experimental support, an integer-relation (PSLQ) search at 250-digit precision against the basis
\[\{G,\ \pi\ln2,\ \pi\ln3,\ \pi\ln5,\ \arctan\tfrac12\ln2,\ \arctan\tfrac12\ln5,\ \pi^2,\ \arctan^2\tfrac12,\ \pi\arctan\tfrac12\}\]
with coefficients up to $10^{10}$ found no relation (a candidate produced at 60 digits failed at 250 digits, residual $\sim10^{-45}$, i.e. spurious). So the answer above is in lowest terms in the accepted sense.

\section*{Numerical verification}

All computations with mpmath (working precision up to 250 digits).

\begin{itemize}
\item Direct quadrature, \texttt{mp.quad} on $[\pi/2,\pi]$ at \texttt{mp.mp.dps = 250}:
  \[I_{\text{num}}=0.30566365562445678428795111199994820290395346929706\ldots\]
\item Closed form $\dfrac{\pi}{8}\ln\dfrac{81}{20}-\dfrac12\operatorname{Ti}_2(\tfrac12)$ with $\operatorname{Ti}_2(\tfrac12)=\Im\operatorname{Li}_2(i/2)$ computed three independent ways (mpmath \texttt{polylog}, the alternating series $\sum_k\frac{(-1)^k}{(2k+1)^2 2^{2k+1}}$, and quadrature of $\int_0^{1/2}\frac{\arctan t}{t}dt$ --- all agree to full precision):
  \[I_{\text{cf}}=0.30566365562445678428795111199994820290395346929706\ldots\]
\item $|I_{\text{num}}-I_{\text{cf}}|\approx 8.7\times10^{-252}$: \textbf{agreement to about 250 significant digits.}
\item Sub-identity checks: $\int_{\pi/2}^{\pi}\ln(5-4\cos x)\,dx=\pi\ln2+2\operatorname{Ti}_2(\tfrac12)$ verified to $3\times10^{-61}$ at 60 digits; the classical full-range value $\frac{\pi}{2}\ln\frac32$ verified to machine-zero at 60 digits.
\end{itemize}

Reference values (50 significant digits):
\[\operatorname{Ti}_2(\tfrac12)=0.48722235829452235711023449769333797060906604030860,\]
\[I=0.30566365562445678428795111199994820290395346929706.\]

\section*{Notes}

\begin{itemize}
\item The derivation is complete and rigorous: the only limit interchange (term-by-term integration of the $\log$ Fourier series) is justified by uniform convergence via the Weierstrass $M$-test on $|z|=\frac12<1$, and an alternative series-free justification via the antiderivative $\Im\operatorname{Li}_2(\tfrac12 e^{ix})$ is included. The integration by parts is between $C^1$ functions on a compact interval with a strictly positive denominator.
\item The answer necessarily involves one non-elementary constant, $\operatorname{Ti}_2(1/2)=\Im\operatorname{Li}_2(i/2)$. It is \textit{believed} (and supported by the 250-digit PSLQ search reported above) that this constant is not expressible via $\pi$, $\ln$, and Catalan's constant; that impossibility is of course not proven --- this is the only caveat, and it concerns the form, not the correctness, of the result.
\item Equivalent presentations: $I=\frac{\pi}{2}\ln3-\frac{\pi}{4}\ln2-\frac{\pi}{8}\ln5-\frac12\Im\operatorname{Li}_2(i/2)$, or with $\operatorname{Ti}_2(2)$ via $\operatorname{Ti}_2(2)=\operatorname{Ti}_2(1/2)+\frac{\pi}{2}\ln2$, giving $I=\frac{\pi}{8}\ln\frac{81\cdot 4}{20}\,-\ldots$ hmm --- concretely $I=\frac{\pi}{8}\ln\frac{81}{5}+\frac{\pi}{8}\ln\frac{4}{4}\;$; cleanly: $I=\frac{\pi}{8}\ln\frac{81}{5}-\frac{\pi}{8}\ln 4+\frac{\pi}{4}\ln 2-\frac12\operatorname{Ti}_2(2)+\frac{\pi}{4}\ln2$ reduces to $I=\frac{\pi}{8}\ln\frac{324}{5}-\frac12\operatorname{Ti}_2(2)$.
\end{itemize}

\end{document}
