8

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.

5xum
  • 123,496
  • 6
  • 128
  • 204
DER
  • 3,011
  • 1
    I’m sure you take this formula from my recent answer on the question about antiderivative.:) By the way, I found this formula simply by playing around with functions in Desmos. Sarcastically your question even have more upvotes than my answer! – Szeto Jun 04 '18 at 14:20
  • What a coincidence! https://math.stackexchange.com/q/2806904/512032 – Szeto Jun 04 '18 at 14:25
  • Consider this: if I had to guess, I would say not that this is a formula for the floor function but rather that this is a formula for $\arctan\cot x$ that has been algebraically manipulated to isolate $\lfloor x\rfloor$; what do you think? I’d be interested to see if similar patterns emerge with $\arcsin\csc x$ and $\arccos\sec x$, and even with $\operatorname{arccsc}\sin x$ and $\operatorname{arcsec}\cos x$! – gen-ℤ ready to perish Jun 04 '18 at 22:13
  • Followup to my earlier comment: Anyone who is interested in similar patterns, check out this very satisfying graph! It’s worth noting that since the non-tangent trigonometric functions are sinusoidal, there is more of a multi-floor-function pattern going on. Very interesting! – gen-ℤ ready to perish Jun 04 '18 at 22:27
  • $\displaystyle \left\lfloor,{x},\right\rfloor = x - \left{,{x},\right}$ and $\displaystyle\left{,{x},\right}$ is a periodic function of period $\displaystyle 1$. – Felix Marin Dec 13 '22 at 16:02

4 Answers4

8

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$.

3

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 $$

5xum
  • 123,496
  • 6
  • 128
  • 204
2

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}.$$

whuber
  • 8,531
  • @mr_e_man That's correct--the limiting argument is unnecessary. It's a vestige of an earlier argument in which I examined the limit at integral values. I'll simplify the explanation. Thank you. – whuber Jun 04 '18 at 20:45
-1

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.

tparker
  • 6,219
  • 1
    It's tagged "Real analysis", so Complex stuff is irrelevant. The arctangent is naturally defined to be in the interval $(-\pi/2,\pi/2)$, or to be the integral $\int_0 \frac{1}{1+x^2}dx$. – mr_e_man Jun 04 '18 at 17:50
  • 1
    @mr_e_man Regardless of how the OP chose to tag the question, considering the continuation to the complex plane gives useful insight into the problem (although my answer is also true solely in a real-valued context). And I disagree that the standard primary branch is much more natural than the other branches - I'd say it's a little more natural. I've never seen that integral given as a definition of the arctangent function. – tparker Jun 04 '18 at 18:10