Show that, for any function \(f\) (for which the integrals exist), \[
\int_0^\infty f\left(x+\sqrt{1+x^2}\right)\,dx
=\frac12\int_1^\infty\left(1+\frac1{t^2}\right)f(t)\,dt.
\]
Hence evaluate \[
\int_0^\infty
\frac{1}{2x^2+1+2x\sqrt{x^2+1}}\,dx,
\] and, using the substitution \(x=\tan\theta\), \[
\int_0^{\frac12\pi}\frac{1}{(1+\sin\theta)^3}\,d\theta.
\]