<s>[INST] Integral $\int_0^{\pi/3}\frac{x}{\cos(x)}\,dx$ I am trying to compute the integral
$$\int_0^{\pi/3}\frac{x}{\cos(x)}\,dx \tag{1}$$
Context: Originally I was trying to prove the following result:
$$\sum_{n=0}^\infty\frac{1}{(2n+1)^2\binom{2n}{n}}=\frac83\beta(2)-\frac{\pi}3\ln(2+\sqrt{3})\tag{2}$$
Where $\beta(2)$ is the Catalan´s constant
To this end I started with the well known result
$$\frac{\arcsin(x)}{\sqrt{1-x^2}}=\sum_{n=0}^\infty\frac{4^n x^{2n+1}}{(2n+1)\binom{2n}{n}} \tag{3}$$
Dividing both sides of $(3)$ by $x$ and integrating from $0$ to $1/2$ we obtain
$$\int_0^{1/2}\frac{\arcsin(x)}{x\sqrt{1-x^2}}\,dx=\frac12\sum_{n=0}^\infty\frac{ 1}{(2n+1)^2\binom{2n}{n}} \tag{4}$$
So the task reduces to compute the integral in $(4)$. Therefore
$$
\begin{aligned}
\sum_{n=0}^\infty\frac{ 1}{(2n+1)^2\binom{2n}{n}}&=2\int_0^{1/2}\frac{\arcsin(x)}{x\sqrt{1-x^2}}\,dx\\
&=2\int_0^{\pi/6}\frac{x}{\sin(x)}\,dx &(x \to \sin(x))\\
&=2\int_0^{\pi/2}\frac{x}{\sin(x)}\,dx-2\int_{\pi/6}^{\pi/2}\frac{x}{\sin(x)}\,dx\\
&=4\beta(2)-2\int_{\pi/6}^{\pi/2}\frac{x}{\sin(x)}\,dx\\
&=4\beta(2)-2\int_{0}^{\pi/3}\frac{\left(\frac{\pi}{2}-x\right)}{\cos(x)}\,dx & (x \to \frac{\pi}{2}-x)\\
&=4\beta(2)-\pi\int_{0}^{\pi/3}\sec(x)\,dx+2\int_{0}^{\pi/3}\frac{x}{\cos(x)}\,dx\\
&=4\beta(2)-\pi\ln\left(\sec(x)+\tan(x) \right)\Big|_0^{\pi/3}+2\int_{0}^{\pi/3}\frac{x}{\cos(x)}\,dx\\
&=4\beta(2)-\pi\ln\left(2+\sqrt{3}\right)+2\int_{0}^{\pi/3}\frac{x}{\cos(x)}\,dx\\
&=4\beta(2)-\pi\ln\left(2+\sqrt{3}\right)+4\int_{0}^{\pi/3}\frac{x}{e^{ix}+e^{-ix}}\,dx\\
&=4\beta(2)-\pi\ln\left(2+\sqrt{3}\right)+4\int_{0}^{\pi/3}\frac{xe^{-ix}}{1+e^{-2ix}}\,dx\\
&=4\beta(2)-\pi\ln\left(2+\sqrt{3}\right)+4\int_{0}^{\pi/3}xe^{-ix}\sum_{k=0}^\infty(-1)^ke^{-2ikx}\,dx\\
&=4\beta(2)-\pi\ln\left(2+\sqrt{3}\right)+4\sum_{k=0}^\infty(-1)^k\int_{0}^{\pi/3}xe^{-ix(2k+1)}\,dx\\
\end{aligned}
$$
The integral in the last line is $(1)$. I integrated by parts, but ended up with some nasty series not very promising.
 [/INST] Using integration by parts:
\begin{align*}
\int{\frac{x}{\cos(x)}dx} &= \int{x\sec(x)\ dx} \\
&= x\sec(x)\tan(x) - \int{\sec(x)\tan(x)dx} \\
&= x\sec(x)\tan(x) - \int{\cos(x)\sec^2(x)\tan(x)dx} && ...multiply \ by \cos(x)\sec(x) = 1 \\
&= x\sec(x)\tan(x) - [\tan(x)\cos(x) + \int{\sin(x)\tan(x)dx}]\\ 
&= x\sec(x)\tan(x) - [\tan(x)\cos(x) + \int{\frac{\sin^2(x)}{\cos(x)}dx}] \\
&= x\sec(x)\tan(x) - [\tan(x)\cos(x) + \int{\frac{1-\cos^2(x)}{\cos(x)}dx}] \\
&= x\sec(x)\tan(x) - [\tan(x)\cos(x) + \int{[\sec(x)-\cos(x)]dx }] \\
&= x\sec(x)\tan(x) - [\tan(x)\cos(x) + [\sec(x)\tan(x)-\sin(x)]] \\
\end{align*}
After puttting limits, we get answer = $\frac{2\pi}{\sqrt{3}} - [\frac{\sqrt{3}}{2}+[2\sqrt{3} - \frac{\sqrt{3}}{2}]]$
</s>