# How to solve integral $\int \log (x+\frac{1}{2}-\frac{\arctan(\tan(\pi(x+\frac{1}{2})))}{\pi})dx$?

I have been trying to work out how WolframAlpha derived this answer,

$$\int \log\left(x+\frac{1}{2}-\frac{\arctan\left(\tan\left(\pi\left(x+\frac{1}{2}\right)\right)\right)}{\pi}\right) {\rm d}x=x \log \left(x+\frac{\tan ^{-1}(\cot (\pi x))}{\pi }+\frac{1}{2}\right) + C$$ (1)

I have just started to read Paul Nahin's Inside Interesting Integrals, but I cannot see a way to proceed or even sketch out what I need to do.

• Have you tried plotting it? It's a step function so you can convert the integral into a sum. Commented Oct 25, 2019 at 10:58
• Can you simplify (really simplify) $$\arctan\left(\tan\left(\pi\left(x+\frac{1}{2}\right)\right)\right)?$$ Commented Oct 25, 2019 at 10:58
• $\mod \pi$, yes. My initial now deleted comment was incorrect. Commented Oct 25, 2019 at 11:07
• perhaps wolfram converts to a sum then finds the limit which is $x \log (x+\frac{\tan ^{-1}(\cot (\pi x))}{\pi }-\frac{1}{2}t)$ is this what you are suggesting? Commented Oct 25, 2019 at 11:08

Think about the graph of $$\arctan ( \tan (x))$$. For intervals with length $$\pi$$, it yields the graph of $$x + c$$ for a some constant $$c$$. In fact, by doing some stretching and shifting (i.e. $$\arctan(\tan(\pi(x+\frac12))$$, you can convince yourself that $$x + \frac12 - \frac{\arctan \left(\tan \left(\pi \left(x+\frac12 \right) \right) \right)}{\pi} \equiv \lfloor x \rfloor + 1$$

and similarly, with some identities and some shifting around, that $$x + \frac12 + \frac{\arctan (\cot (\pi x) )}{\pi} \equiv \lfloor x \rfloor + 1$$

So, the integral is now $$\int \log(\lfloor x \rfloor +1 ) {\rm d} x.$$

Use integration by parts now with $$u = \log(\lfloor x \rfloor + 1),\frac{du}{dx} = \frac{0}{\lfloor x \rfloor + 1} = 0$$ and $$\frac{dv}{dx} = 1, v = x$$.

$$\int \log(\lfloor x \rfloor +1 ) {\rm d} x = x \log(\lfloor x \rfloor + 1) + C$$

which actually translates back to

$$\int \log \left( x + \frac12 - \frac{\arctan \left(\tan \left(\pi \left(x+\frac12 \right) \right) \right)}{\pi} \right) {\rm d}x = x \log \left( x + \frac12 + \frac{\arctan (\cot (\pi x) )}{\pi} \right) + C$$

ta daa!

• super stuff! once the identity $x + \frac12 - \frac{\arctan \left(\tan \left(\pi \left(x+\frac12 \right) \right) \right)}{\pi} \equiv \lfloor x \rfloor + 1$ is shown the rest becomes clear. Commented Oct 25, 2019 at 12:59