<s>[INST] An alternative way to calculate $\int_{0}^{1}\frac{x}{x^2+(1-x)^2}\,dx$ Consider the integral
$$
\int_{0}^{1}\frac{x}{x^2+(1-x)^2}\,dx
$$
By noting that
$$
\frac{x}{x^2+(1-x)^2}=
\frac{2x-1}{(2x-1)^2+1}+\frac{1}{(2x-1)^2+1}
$$
we deduce
$$
\int\frac{x}{x^2+(1-x)^2}\,dx=\frac{\ln(x^2+(1-x)^2)}{4}+\frac{1}{2}\arctan(2x-1)+C,
$$
so
$$
\int_{0}^{1}\frac{x}{x^2+(1-x)^2}\,dx=\frac{\pi}{4}.
$$
Is there an alternative way to calculate this integral?
 [/INST] $$I=\int\frac{x}{x^2+(1-x)^2}\,dx=\int \frac{x}{2x^2-2x+1}\,dx=\int \frac{x}{2(x-a)(x-b)}\,dx$$
$$I=\frac 1{2(a-b)}\int \Big[\frac a{x-a}-\frac b{x-b} \Big]\,dx$$
$$I=\frac 1{2(a-b)}\Big[a \log(|x-a|)-b\log(|x-b|)\Big]$$ Now $a=\frac{1-i}2$, $b=\frac{1+i}2$,
$$I=\frac {1-i}4\left(\log
   \left(x-\frac{1+i}{2}\right)+i \log
   \left(x-\frac{1-i}{2}\right)\right)$$
Use the bounds, play with the complex numbers to get the answer.
</s>