Sum of Floors not greater than Floor of Sum

From ProofWiki
Jump to navigation Jump to search

Theorem

Let $\floor x$ denote the floor function.


Then:

$\floor x + \floor y \le \floor {x + y}$


The equality holds:

$\floor x + \floor y = \floor {x + y}$

if and only if:

$x \bmod 1 + y \bmod 1 < 1$

where $x \bmod 1$ denotes the modulo operation.


Proof

From the definition of the modulo operation, we have that:

$x = \floor x + \paren {x \bmod 1}$

from which:

\(\ds \floor {x + y}\) \(=\) \(\ds \floor {\floor x + \paren {x \bmod 1} + \floor y + \paren {y \bmod 1} }\)
\(\ds \) \(=\) \(\ds \floor x + \floor y + \floor {\paren {x \bmod 1} + \paren {y \bmod 1} }\) Floor of Number plus Integer

Hence the inequality.


The equality holds if and only if:

$\floor {\paren {x \bmod 1} + \paren {y \bmod 1} } = 0$

that is, if and only if:

$x \bmod 1 + y \bmod 1 < 1$

$\blacksquare$


Sources