# Is $\lfloor{\frac{a+b+c+d}{4}}\rfloor=\lfloor\frac{\lfloor{\frac{a+b}{2}}\rfloor+\lfloor{\frac{c+d}{2}}\rfloor}{2}\rfloor$ for $a,b,c,d\in\mathbb R$?

Does the following hold $$\forall a,b,c,d\in\mathbb R$$? $$\quad\left\lfloor{\frac{a+b+c+d}{4}}\right\rfloor=\left\lfloor\frac{\left\lfloor{\frac{a+b}{2}}\right\rfloor+\left\lfloor{\frac{c+d}{2}}\right\rfloor}{2}\right\rfloor?$$

It seems like it's enough to restrict $$a,b,c,d$$ to $$[0,4)$$, and then we can do a case analysis for all possible values of $$\left\lfloor{\frac{a+b}{2}}\right\rfloor,\left\lfloor{\frac{c+d}{2}}\right\rfloor$$.

Is there a simpler way?

As suggested in a comment, an equivalent questions is whether the following holds for all $$x,y\in\mathbb R$$:

$$\left\lfloor\frac{x+y}{2}\right\rfloor = \left\lfloor\frac{\left\lfloor x\right\rfloor+\left\lfloor y\right\rfloor}{2}\right\rfloor.$$

As suggested in the answer (and one of the comments), this fails, e.g., for $$a=2.5, c=1.5, b,d=0$$.

A followup question:

Does the equality hold for all $$a,b,c,d\in\mathbb N$$?

• Define $x:=\frac{a+b}{2},\,y:=\frac{c+d}{2}$ to halve the number of variables.
– J.G.
Jan 7 at 17:16
• @J.G. - good point, thanks.
– M A
Jan 7 at 17:22
• When executing FullSimplify[Floor[(a+b+c+d)/4]-Floor[(Floor[(a+b)/2]+Floor[(c+d)/2])/2]] I did not obtain zero, which might be a first indicator that your identity does not hold. Jan 7 at 17:24
• This fails for $(a,b,c,d)=(0,2.2,0,1.8)$. Jan 7 at 17:25
• @EldarSultanow - thanks. Which software is this?
– M A
Jan 7 at 17:41

The result is false. As pointed out by J.G., we can apply change of variable $$x=\frac{a+b}{2}$$ and $$y=\frac{c+d}{2}$$ to get:
$$\begin{equation*} \lfloor \frac{x+y}{2}\rfloor = \lfloor \frac{ \lfloor x \rfloor+\lfloor y\rfloor}{2}\rfloor \end{equation*}$$
But this cannot hold for every real $$x$$ and every real $$y$$: just put $$x=2.5$$ and $$y=1.5$$ for example.
If $$a$$, $$b$$, $$c$$, and $$d$$ are all positive integers, we can just make sure $$a+b=5$$ and $$c+d=3$$ to get $$x=2.5$$ and $$y=1.5$$ so that the result fails even if we assume they are all positive integers.