Doing definite integration $\int_0^{\pi/4}\frac{x\,dx}{\cos x(\cos x + \sin x)}$

We have $$I=\int_{0}^{\pi/4}\frac{2x}{2\cos^2x+2\cos x\sin x}dx=\int_0^{\pi/4}\frac{2x}{\cos 2x+\sin 2x+1}dx=\frac{1}{2}\int_0^{\pi/2}\frac{xdx}{\cos x+\sin x+1}=\frac{1}{2}\int_0^{\pi/2}\frac{\pi/2-x}{\cos x+\sin x+1}dx\\I=\frac{1}{4}\int_0^{\pi/2}\frac{\pi/2}{\cos x+\sin x+1}dx$$Now substitute $x$ for $2x$ again$$=\frac{\pi}{4}\int_0^{\pi/4}\frac{dx}{2\cos^2x+2\sin x\cos x}=\frac{\pi}{8}\int_0^{\pi/4}\frac{\sec^2xdx}{1+\tan x}=\frac{\pi}{8}\int_0^{1}\frac{1}{1+u}du=\frac{\pi}{8}\log 2$$


Let $$I(x)= \int^{\frac{\pi}{4}}_0 \frac{x}{\cos(x)(\cos(x)+\sin(x))} dx$$

$$ I(x)= \int^{\frac{\pi}{4}}_0 \frac{x}{\cos(x)(\sqrt2\sin(x+\frac{\pi}{4}))} dx$$

$$ I(x)= \int^{\frac{\pi}{4}}_0 \frac{x}{\sqrt2\cos(x)\sin(x+\frac{\pi}{4})} dx$$

Since $$ I(x)=I(\frac{\pi}{4}-x)$$

$$ I(\frac{\pi}{4}-x)=\int^{\frac{\pi}{4}}_0 \frac{\frac{\pi}{4}-x}{\cos(\frac{\pi}{4}-x)(\sqrt2\sin(\frac{\pi}{4}-x+\frac{\pi}{4}))} dx$$

$$ I(\frac{\pi}{4}-x) =\int^{\frac{\pi}{4}}_0 \frac{\frac{\pi}{4}-x}{\sqrt2 \cos(x)\sin(x+\frac{\pi}{4})} dx$$

But $$ I(x)=I(\frac{\pi}{4}-x)$$

so $$ I+I =\int^{\frac{\pi}{4}}_0 \frac{\frac{\pi}{4}-x}{\sqrt2 \cos(x)\sin(x+\frac{\pi}{4})}+\int^{\frac{\pi}{4}}_0 \frac{x}{\sqrt2\cos(x)\sin(x+\frac{\pi}{4})} dx$$

$$ 2I = \frac{\pi}{4\sqrt2}\int^{\frac{\pi}{4}}_0 \frac{1}{\cos(x)\sin(x+\frac{\pi}{4})} dx$$

Can you continue?

$$ I = \frac{\sqrt2\pi}{16}\int^{\frac{\pi}{4}}_0 \frac{1}{\cos(x)(\frac{1}{\sqrt{2}})(\cos(x)+\sin(x))} dx$$

$$ I = \frac{\pi}{8}\int^{\frac{\pi}{4}}_0 \frac{\sec(x)}{\sin(x)+\cos(x)}\cdot\frac{\frac{1}{\cos(x)}}{\frac{1}{\cos(x)}} dx$$

$$ I = \frac{\pi}{8}\int^{\frac{\pi}{4}}_0 \frac{\sec^2(x)}{\tan(x)+1} dx$$

$$ I = \frac{\pi}{8} \left[\ln|\tan(x)+1 \right]^{\frac{\pi}{4}}_0$$

$$ I = \frac{\pi}{8} \cdot \ln(2) $$


\begin{align} \int_0^{\pi/4}\frac{x\,dx}{\cos x(\cos x + \sin x)} &= \int_0^{\pi/4}\frac{x\,dx}{\cos^2(x)+\cos(x)\sin(x)}\\ &=\int_0^{\pi/4}\frac{2x\,dx}{\cos(2x)+\sin(2x)+1} \\&=\frac{1}{2}\int_0^{\pi/2}\frac{t\,dt}{\cos(t)+\sin(t)+1} \end{align}

By $t \to 1-t$ $$I =\frac{1}{2}\int_0^{\pi/2}\frac{(\pi/2-t)\,dt}{\cos(t)+\sin(t)+1} $$

Separate the integrals $$I =\frac{1}{2}\int_0^{\pi/2}\frac{(\pi/2)\,dt}{\cos(t)+\sin(t)+1} -I$$

$$I = \frac{\pi}{8}\int_0^{\pi/2}\frac{\,dt}{\cos(t)+\sin(t)+1} = \frac{\pi}{8}\log(2)$$

The last integral could be solved using Weierstrass substitution.