<s>[INST] Finding $\int_0^{\frac{\pi}{2}} \frac{x}{\sin x} dx $ Is there a way to show $$\int_0^{\frac{\pi}{2}} \frac{x}{\sin x} dx = 2C$$ where $C=\sum_{n=0}^{\infty} \frac{(-1)^n}{(2n+1)^2} $ is Catalan’s constant, preferably without using complex analysis?
The following is an attempt to expand it as as a series:
\begin{align*}
\int_0^{\frac{\pi}{2}} \frac{x}{\sin x} dx
&= \int_0^{\frac{\pi}{2}} \frac{x}{1-\cos^2 x}\sin x\  dx \\
&= \sum_{n=0}^{\infty} \int_0^{\frac{\pi}{2}} x\sin x \ \cos^{2n}x \ dx \\
&= \sum_{n=0}^{\infty}\frac{1}{2n+1} \int_0^{\frac{\pi}{2}} \cos^{2n+1}x \ dx \\
&= \sum_{n=0}^{\infty} \frac{4^n}{\binom{2n}{n}(2n+1)^2}
\end{align*}
which is close but not quite there.
 [/INST] $$
\begin{aligned}
I&=\int_{0}^{\pi / 2} \frac{x}{\sin (x)} d x\\&=\frac{1}{2} \int_{0}^{\pi / 2} \frac{x}{\cos \left(\frac{x}{2}\right) \sin \left(\frac{x}{2}\right)} d x \\
&=\frac{1}{2} \int_{0}^{\pi / 2} \frac{x}{\cos \left(\frac{x}{2}\right) \sin \left(\frac{x}{2}\right)} \frac{1}{\frac{\cos \left(\frac{x}{2}\right)}{\cos \left(\frac{x}{2}\right)}} d x \\
&=\frac{1}{2} \int_{0}^{\pi / 2} \frac{x}{\cos ^{2}\left(\frac{x}{2}\right) \tan \left(\frac{x}{2}\right)} d x\\
&=\frac{1}{2} \int_{0}^{\pi / 2} \frac{x \sec ^{2}\left(\frac{x}{2}\right)}{\tan \left(\frac{x}{2}\right)} d x\\
&=2 \int_{0}^{1} \frac{\arctan (x)}{x} d x \qquad\left(\tan \left(\frac{x}{2}\right) \to x \right)\\
&=2 \int_{0}^{1} \sum_{k=0}^{\infty} \frac{(-1)^{k}}{(2 k+1)} x^{2 k} d x \\
&=2 \sum_{k=0}^{\infty} \frac{(-1)^{k}}{(2 k+1)^{2}}\\
&=2 G \qquad \blacksquare
\end{aligned}
$$
</s>