# Using $f(x)=f(a+b-x)$ generally to compute an integral

Upon reading this several times I somewhat understand it. This document discusses the case of $\int_{a}^{b}f(x)\,\mathrm{d}x$ where $f(x)+f(a+b-x)$ is constant. However what happens if they are equal? I am unsure if it is an Integration strategy that follows from the symmetry but take this integral as an example $$\int_{0}^{\frac{\pi}{2}}\sqrt{\tan x}+\sqrt{\cot x}\,\mathrm{d}x$$ it is easy to see that $f(x)=f\left(\frac{\pi}{2}-x\right)$ I figured this meant it was symmetric along the interval and therefore was equivalent to $$2\int_{0}^{\frac{\pi}{4}}\sqrt{\tan x}+\frac{1}{\sqrt{\tan x}}\,\mathrm{d}x=2\int_{0}^{\frac{\pi}{4}}\frac{1+\tan x}{\sqrt{\tan x}}\,\mathrm{d}x$$ now making the substitution $x=\frac{\pi}{4}-u$ we get that $\tan\left(\frac{\pi}{4}-u\right)=\frac{1-\tan u}{1+\tan u}$ and then the integral is now $$2\int_{0}^{\frac{\pi}{4}}\frac{2}{1+\tan u}\cdot \sqrt{\frac{1+\tan u}{1-\tan u}}\,\mathrm{d}u$$ Through some algebra and trig identities we can get this to be $4\displaystyle\int_{0}^{\frac{\pi}{4}}\frac{\cos x}{\sqrt{1-2\sin^2 x}}\,\mathrm{d}x$ which comes out to a final answer of $\pi\sqrt2$ (through a trivial $u=\sin x$) which is what the original evaluates to. Another example would be \begin{align*} I=\int_{0}^{\pi}\sin^2x\cos^4 x\,\mathrm{d}x&=2\int_{0}^{\frac{\pi}{2}}\sin^2 x\cos^4x\,\mathrm{d}x\\ &=2\int_{0}^{\frac{\pi}{2}}\cos^2 x\sin^4 x\,\mathrm{d}x\\ 2I&=2\int_{0}^{\frac{\pi}{2}} \sin^2x\cos^4 x+ \cos^2 x\sin^4 x\,\mathrm{d}x\\ I&=\int_{0}^{\frac{\pi}{2}}\left(\sin x\cos x\right)^2\,\mathrm{d}x \end{align*} Which evaluates to $\frac{\pi}{16}$ and is easier to evaluate than the original integral using $\sin x\cos x=\frac{\sin(2x)}{2}$ and power reduction identities. So why did this all work out so nicely? That first $\sqrt{\tan x}$ integral was made much nicer, the second one worked out nicely as well, Is there a reason for this? Also, is there a generalized form to do integrals of functions with the properties of $f(x)=f(a+b-x)$?

I don’t think those examples show much; how has halving the range of integration helped? It seems just as nice (perhaps nicer) to integrate over $−\pi/4$ to $\pi/4$ for the first example and up to $\pi$ in the second example.
The only way you can use $f(x)=f(a+b-x)$ is, as you already know, to halve the range of integration.
There can be no general techniques making use of the fact that $f(x)=f(a+b-x).$ Given an arbitrary $g$ defined on $[a,b]$ you can consider the "even part" $f(x)=\tfrac12(g(x)+g(a+b-x)).$ This satisfies $f(x)=f(a+b-x)$ and $\int_a^bf(x)dx=\int_a^bg(x)dx.$ So any technique that can evaluate integrals $\int_a^bf(x)dx$ with $f(x)=f(a+b-x)$ can be used to evaluate arbitrary integrals.