Formula for the floor function I found the following formula for the floor function:
$$\lfloor x \rfloor = -\frac12+x+\frac{\arctan(\cot\pi x)}{\pi}$$
for all $x$ not an integer.
My question is where I can find the proof of this formula.
 A: It is well-known that the cotangent function has period $\pi$, so that the cotangent of $\pi x$ has period $1$.
With the usual definition of the arc tangent, you get a number between $-\frac\pi2$ and $\frac\pi2$, or, after division by $\pi$, a number between $-\frac12$ and $\frac12$.
Hence,
$$\frac{\arctan\cot\pi x}\pi=\frac{\arctan\tan\left(\dfrac\pi2-\pi x\right)}\pi=\frac12-x\bmod1$$
Now,
$$-\frac12+\frac12+x-x\bmod1=x-\{x\}=\lfloor x\rfloor.$$

Anyway, the formula is virtually useless, as it is undefined for integer $x$.
A: Hint:
Write down $x=n + \frac12 + q$ where $n$ is an integer and $q\in\left(-\frac12, \frac12\right)$.
Then use trigonometric addition theorems and the fact that $$\cot(n\pi+\frac\pi2) = \frac{\cos(n\pi + \frac\pi2)}{\sin(n\pi +\frac\pi2)} = 0 $$
A: Consider 
$$f(x) = \frac{1}{\pi}\int_{0}^{\cot(\pi x)}\frac{dy}{1+y^2}=\frac{\arctan(\cot(\pi x))}{\pi},$$
with the latter equation obtained by substituting $y=\tan u.$  Since $x\to \cot(\pi x)$ is manifestly periodic of period $1,$ and $f$ integrates to $0$ over one period (since $\cot$ is an odd function), $f$ also is periodic.
When $x$ is not an integer $f$ is differentiable at $x$ because both $\cot(\pi x)$  and the integral (qua function of its upper limit) are. The Chain Rule and Fundamental Theorem of Calculus together imply 
$$f^\prime(x) = \frac{1}{\pi}\left(\frac{1}{1 + (\cot(\pi x))^2}\right) \frac{d}{dx}\left(\cot(\pi x)\right)=\frac{-\pi\csc(\pi x)^2}{\pi\csc(\pi x)^2}=-1.$$
This is the key insight, because it shows $f$ has the basic properties needed to construct functions that are periodic and linear between their points of discontinuity.  The rest is just algebra.
Since $f(1/2)$ is an integral from $0$ to $0=\cot(\pi/2),$
$$f(1/2) = 0.$$
This information completely determines $f.$  To summarize, at nonintegral values $f$ falls linearly with slope $-1,$ equals $0$ at $1/2,$ and repeats this pattern between each successive pair of integers.  Consequently the function
$$\frac{1}{2} - f(x)$$
must rise linearly from $0$ at $x=0$ up to a limit of $1$ as $x\to 1.$  Because it is periodic, it drops back to $0$ when $x=1$ and repeats this pattern ad infinitum in both directions.  Obviously that describes the remainder ("fractional part") function.  That is,
$$x - \lfloor x \rfloor = \frac{1}{2} - f(x).$$
Solving for the floor,
$$\lfloor x \rfloor = x - \left( \frac{1}{2} - f(x)\right) = -\frac{1}{2} + x + \frac{\arctan(\cot(\pi x))}{\pi}.$$
A: The arctangent function is multivalued - when thought of as a function of a complex variable, its domain is a Riemann surface with multiple sheets joined at branch cuts in the complex plane. So your formula is not well-defined unless you specify which branch you are considering to be the principal branch. The most natural way to specify the usual principal branch of the arctangent function basically uses the idea of the floor function anyway, so your formula "for" the floor function is correct but somewhat circular.
