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.
 A: $$I=\int_0^\frac{\pi}{3}\frac{x}{\cos(x)}\,dx $$
Making the substitution $x=\frac{\pi}{2}-t$
$$I=\frac{\pi}{2}\int_\frac{\pi}{6}^\frac{\pi}{2}\frac{dt}{\sin t}-\int_\frac{\pi}{6}^\frac{\pi}{2}\frac{t\,dt}{\sin t}=I_1-I_2$$
Next, we make the substitution $\frac{dt}{\sin t}=d\big(\ln(\tan\frac{t}{2})\big)$
$$I_1=\frac{\pi}{2}\int_\frac{\pi}{6}^\frac{\pi}{2}d\big(\ln(\tan\frac{t}{2})\big)=-\frac{\pi}{2}\ln(\tan\frac{\pi}{12})$$
Using $\tan\frac{x}{2}=\frac{1-\cos x}{\sin x}$ and $-\ln(2-\sqrt 3)=\ln(2+\sqrt 3)$
$$I_1=\frac{\pi}{2}\ln(2+\sqrt3)$$
$$I_2=\int_\frac{\pi}{6}^\frac{\pi}{2}\frac{t\,dt}{\sin t}=t\ln(\tan\frac{t}{2})\Big|_\frac{\pi}{6}^\frac{\pi}{2}-\int_\frac{\pi}{6}^\frac{\pi}{2}\ln(\tan\frac{t}{2})dt$$
$$=\frac{\pi}{6}\ln(2+\sqrt 3)-\int_0^\frac{\pi}{2}\ln(\tan\frac{t}{2})dt+\int_0^\frac{\pi}{6}\ln(\tan\frac{t}{2})dt$$
$$=\frac{\pi}{6}\ln(2+\sqrt 3)-2\int_0^\frac{\pi}{4}\ln(\tan x)dx+2\int_0^\frac{\pi}{12}\ln(\tan x)dx$$
In the second term we make the substitution $\tan x=t$, and the third term was evaluated here
($G=\beta(2)$ - Catalan's constant)
$$I_2=\frac{\pi}{6}\ln(2+\sqrt 3)-2\int_0^1\frac{\ln t}{1+t^2}dt -\frac{4}{3}G=\frac{\pi}{6}\ln(2+\sqrt 3)+2G-\frac{4}{3}G$$
$$I_2=\frac{\pi}{6}\ln(2+\sqrt 3)+\frac{2}{3}G$$
$$I=I_1-I_2=\frac{\pi}{3}\ln(2+\sqrt 3)-\frac{2}{3}G$$
A: 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}]]$
