Floor Function Identity


By Yatir Halevi on Thursday, November 22, 2001 - 07:52 pm:

I found an expression for calculating the floor function:


floor(x)=x+ tan-1 (cot(πx))/π-1/2
First, can anyone explain to me why it does what it does...
and second, Is there anyway of simplifying it, and/or making it useful in other expressions, (the atan part is what makes it uncomfortable)


Thnx,
Yatir
By Brad Rodgers on Thursday, November 22, 2001 - 09:52 pm:

Well done. I've never seen anything like this before, yet it is beyond a doubt true! You can prove it in a rather unrigorous way using differentiation at intervals where x is not an integer, and recognize that at x=integer, tan(pi x)=0, and tan-1 (1/0)=pi/2 (I say that hesitantly, but we all know what I mean by 1/0). Plugging this into your equation, we see that it shows that at integers, the function is equal to that integer, and it is equal to that integer until the next integer. This gives you an idea of why the relation is true, but I'm still trying to come up with a rigorous proof (I think I've got one, but I'm just working out the tweaks). Anyone know if this relation has been discovered before?

Brad


By Dan Goodman on Friday, November 23, 2001 - 12:16 am:
It's neat, but it shouldn't come as too much of a surprise. As Yatir pointed out, the atan part should make you uncomfortable. The reason this works is that atan(x) picks out the principal branch of the inverse to tan, i.e. the value which lies between -π/2 and π/2. So, if you take tan-1 (tan(x)) you get a sort of ''sawtooth'' function. Obviously, if tan-1 could pick out the ''correct'' branch of the inverse to tan then you would get tan-1 (tan(x))=x, but it can only pick out the principal branch which effectively means you are saying something like ''suppose x was an angle, what is the principal value of that x angle?'' which is clearly very similar to saying ''what is the fractional part of x?'' - and once you have the fractional part you just need to subtract it from the original number to get the integer part, which is the floor. You can do a similar thing with log, because x-(1/2π)log( e2iπx )=[x]=Floor(x) if log takes the branch which gives angles being between 0 and 2π.

The reason you can do it with a cot(x) is because there is a relation something like cot(π/2-x)=tan(x) or something like that. You can rewrite it without using cot(x) by saying floor(x)=x-1/2-(1/π) tan-1 (tan(πx+π/2)). If you choose the branch of tan-1 (x) which gives values between 0 and 2π then you get floor(x)=x-(1/π) tan-1 (tan(πx)), which is even simpler. Hope that clears it up, unfortunately it's not very useful but it is quite clever. It's a bit like saying that for real numbers, |x|= x2 .


By Dan Goodman on Friday, November 23, 2001 - 12:20 am:

As an afterthought, if f(x+a)=f(x) for all x and for 0 < x < a f(x) is increasing, then Floor(x)=x-f-1 (f(ax))/a for the principal branch of f-1 returning values between 0 and a. So, there is nothing special about tan or Log or cot going on here...


By Brad Rodgers on Friday, November 23, 2001 - 01:23 am:

I think I have a fully rigorous proof of your equality. For the sake of rigorousness, however, it is very long. I'll try to type it all out, but I may end up fizzling out halfway, and posting the rest later. First, a trivial addition to your original formula: Technically as we do have a 1/0 when we are dealing with your result, we should say


floor(x)=x+ tan-1 (cot(πx))/π-1/2 if x not an integer, and equal to x if x is an integer
I've typed up the proof in word, as it is very heavy in symbols, and as it is rather long. Indeed, if you have a problem understanding it, the problem is most likely symbology. For all practical purposes, the "proof" I've typed above works fine. But nonetheless:

Proof (26 k)

By the way, how did you come up with this? The actual result would've never occured to me...

Brad
By Brad Rodgers on Friday, November 23, 2001 - 01:26 am:

Oops, hadn't yet seen your post Dan.


By Yatir Halevi on Friday, November 23, 2001 - 12:06 pm:

Brad and Dan, Thank you both for your proofs.
Both are very nice and suprisingly i understood them.
The proof i had in mind is something like yours, dan, but brad yours is great as well.
I can't take credit for it, because it is not mine, i god it from mathworld.wolfram.com, While doing some research on the floor function.
Now, the real question, is there any use to this expression???

Thnx,

Yatir