Conjecture: $\lfloor\frac{n}4\rfloor+\lfloor\frac{n+1}4\rfloor-\lfloor\frac{n+2}4\rfloor-\lfloor\frac{n+3}4\rfloor=\cos(\frac{n\pi}2)-1$

algebra-precalculusceiling-and-floor-functions

I was playing around with numbers when I noticed that this peculiar expression seemed to be true:

$$\left\lfloor\frac{n}4\right\rfloor+\left\lfloor\frac{n+1}4\right\rfloor-\left\lfloor\frac{n+2}4\right\rfloor-\left\lfloor\frac{n+3}4\right\rfloor=\cos\left(\frac{n\pi}{2}\right)-1,\quad n\in\mathbb N$$

I'm at a complete loss as to how floor functions and the cosine are related in a rather simple form. Could somebody give me a proof/intuitive understanding of the above?

Best Answer

I find it useful to view your expression not within the realm of calculus, but rather in terms of constructing a digital signal. In particular, this repeating 3-valued signal is the goal:

enter image description here

i.e. $\cos(n\pi/2)$ for integer $n$. It is clear that we can achieve it as the sum of these two binary signals, each having half the frequency:

enter image description here

Note these two summands are, in form, hardly different from each other; the phase difference is worth noting, and that one is "down", the other "up".

The first summand is $\left\lfloor\frac{n}4\right\rfloor-\left\lfloor\frac{n+2}4\right\rfloor$ while the second is $1 + \left\lfloor\frac{n+1}4\right\rfloor-\left\lfloor\frac{n+3}4\right\rfloor$. We see that each binary oscillation is expressible as the difference of two (non-periodic) staircase signals, one lagging behind the other.

Related Question