Explanation for these transformations of integrals I've recently found the following transformations:
$$\int _{a} ^{\infty} \frac{\ln x}{x^2 + a^2}\,dx = \int _{a} ^{0} \frac{\ln x}{x^2 + a^2}\,dx$$
$$\int _{0} ^{\pi/2} \log(\sin(\tfrac{\pi}{2}-u))\,du = \int _{0} ^{\pi/2}\log(\sin u)\, du = \int _{\pi/2} ^{\pi}\log(\sin u)\, du$$
Could you explain to me why that is?
 A: $(1)$
$$ - \int _a ^{0} \frac{\ln x}{x^2 + a^2}\,dx+\int _a ^{\infty} \frac{\ln x}{x^2 + a^2}\,dx$$
$$= \int _0^a \frac{\ln x}{x^2 + a^2}\,dx+\int _a ^{\infty} \frac{\ln x}{x^2 + a^2}\,dx$$
$$= \int _0^\infty \frac{\ln x}{x^2 + a^2}\,dx=I\text{(say,)}$$
Putting $x=a\tan \theta\implies dx=a\sec^2\theta d\theta$
When $x=0, \theta=0, x=\infty\implies \theta=\frac\pi2$
$$\text{So,}I=\int_0^\frac\pi2\frac{\ln(a\tan\theta)}{a^2 \sec^2\theta}a\sec^2\theta d\theta$$
$$\implies a\cdot I=\ln a\int_0^\frac\pi2d\theta+\int_0^\frac\pi2 \ln \tan\theta d\theta$$
Now, $\ln a\int_0^\frac\pi2d\theta=\ln a\left(\frac\pi2-0\right)$
$I_1=\int_0^\frac\pi2 \ln \tan\theta d\theta=\int_0^\frac\pi2 \ln \tan \left(\frac\pi2+0-\theta\right) d\theta $ as $\int_a^bf(x)dx=\int_a^bf(a+b-x)dx$
$I_1=\int_0^\frac\pi2 \ln \cot\theta d\theta$
$=\int_0^\frac\pi2 \ln (\tan\theta)^{-1} d\theta=-\int_0^\frac\pi2 \ln \tan\theta d\theta=-I_1\implies I_1=0$
$\implies a\cdot I=\frac\pi2\ln a\ne0$ unless $a=1$
$(2)$
$$\int _{0} ^{\pi/2} \log(\sin(\tfrac{\pi}{2}-u))\,du =\int _{0} ^{\pi/2} \log(\cos u)\,du $$
$$=\int _{0} ^{\pi/2} \log \cos \left(\frac\pi2+0-u\right)\,du  \text{ as } \int_a^bf(x)dx=\int_a^bf(a+b-x)dx$$
$$=\int _{0} ^{\pi/2} \log(\sin u)\,du $$
Put $v=\pi-u\implies \sin u=\sin(\pi-v)=\sin v$
A: For the first set $t:=\frac 1x$ then
\begin{align}
\int _{a} ^{\infty} \frac{\ln x}{x^2 + a^2}\,dx &= -\int _{\frac1a} ^{0} \frac{\ln\left(\frac 1t\right)}{\frac 1{t^2} + a^2}\,\frac{dt}{t^2}\\
&=\int _{\frac 1a}^{0} \frac{\ln\left(t\right)}{1 + (at)^2}\,dt\\
&=\int _a^{0} \frac{\ln\left(z\right)-\ln(a^2)}{1 + \frac {z^2}{a^2}}\frac{dz}{a^2}\\
&=\int _a^{0} \frac{\ln\left(z\right)}{a^2 + z^2}\;dz-2\;\ln(a)\int _a^{0} \frac{dz}{a^2 + z^2}\\
&=\int _a^{0} \frac{\ln\left(z\right)}{z^2 + a^2}\;dz+2\;\ln(a)\frac{\pi}{4a}\\
\end{align}
(setting $z:=a^2t$)
So that we get an additional term $\ \displaystyle\ln(a)\frac{\pi}{2a}$ here.

To be complete...
For the second (setting $v:=\frac{\pi}2-u$):
\begin{align}
I=\int _{0} ^{\pi/2} \log\left(\sin\left(\tfrac{\pi}{2}-u\right)\right)\,du&=-\int_{\pi/2}^{0} \log(\sin(v))\;dv\\
&=\int _{0} ^{\pi/2} \log(\sin(v))\,dv\\
&= \int _{\pi/2} ^{\pi}\log(\sin w)\, dw\\
\end{align}
(wtih the substitution $w:=\pi-v$)
