Prove that for any positive integer $n$, \[\left\lfloor \frac{n}{3}\right\rfloor+\left\lfloor \frac{n+2}{6}\right\rfloor+\left\lfloor \frac{n+4}{6}\right\rfloor = \left\lfloor \frac{n}{2}\right\rfloor+\left\lfloor \frac{n+3}{6}\right\rfloor .\]
Problem
Source:
Tags: floor function, invariant
25.05.2007 03:25
This equation can be proven by distinction of alle cases $ n\equiv 0,1,2,3,4,5\mod 6$ and by calculation, but that's much to write, so i'll just take one case: $ n\equiv 1 (mod6) \\ \left\lfloor \frac {n}{3}\right\rfloor + \left\lfloor \frac {n + 2}{6}\right\rfloor + \left\lfloor \frac {n + 4}{6}\right\rfloor = \left\lfloor \frac {n}{2}\right\rfloor + \left\lfloor \frac {n + 3}{6}\right\rfloor \\ \frac {n - 1}{3} + \frac {n - 1}{6} + \frac {n - 1}{6} = \frac {n - 1}{2} + \frac {n - 1}{6} \\ 0 = 0$ That you can do with every case and there will always stand a true equation in the end, so the proposition is true.
22.07.2007 06:04
Note that the equation $ \left\lfloor \frac{n}{3} \right\rfloor + \left\lfloor \frac{n+2}{6} \right\rfloor + \left\lfloor \frac{n+4}{6} \right\rfloor = \left\lfloor \frac{n}{2} \right\rfloor + \left\lfloor \frac{n+3}{6} \right\rfloor$ holds for any real $ n$, not just for integers $ n$. In fact, while $ n\in[k,k + 1[$ for some integer $ k$, each of these terms remains invariant, so the theorem for real $ n$ follows immediately from the theorem for integers.
25.03.2008 19:22
Peter wrote: Prove that for any positive integer $ n$, \[ \left\lfloor \frac{n}{3} \right\rfloor + \left\lfloor \frac{n+2}{6} \right\rfloor + \left\lfloor \frac{n+4}{6} \right\rfloor = \left\lfloor \frac{n}{2} \right\rfloor + \left\lfloor \frac{n+3}{6} \right\rfloor .\] A solution for every real $ n$, not just for positive integers $ n$: Theorem 1. Let $ x$ be a real and $ n$ a positive integer. Then, (1) $ \sum_{k=0}^{n-1}\left\lfloor x+\frac{k}{n}\right\rfloor = \left\lfloor nx\right\rfloor$. Here comes a somewhat nonstandard proof of Theorem 1. We first note that it is enough to prove the equality (1) for all nonnegative reals $ x$. This is because, once this equality is proven for all nonnegative reals $ x$, we can conclude that it holds for all reals $ x$ as follows: For any real $ y$, there exists an integer $ s$ such that $ y+s$ is nonnegative (just take $ s$ big enough); therefore, since the formula (1) holds for nonnegative $ x$, we can apply it to $ x=y+s$ and get (2) $ \sum_{k=0}^{n-1}\left\lfloor \left(y+s\right)+\frac{k}{n}\right\rfloor = \left\lfloor n\left(y+s\right)\right\rfloor$; but since $ s$ is an integer, $ \sum_{k=0}^{n-1}\left\lfloor \left(y+s\right)+\frac{k}{n}\right\rfloor = \sum_{k=0}^{n-1}\left\lfloor y+\frac{k}{n}+s\right\rfloor = \sum_{k=0}^{n-1}\left(\left\lfloor y+\frac{k}{n}\right\rfloor+s\right)$ $ = \left(\sum_{k=0}^{n-1}\left\lfloor y+\frac{k}{n}\right\rfloor\right)+sn$ and $ \left\lfloor n\left(y+s\right)\right\rfloor = \left\lfloor ny+sn\right\rfloor = \left\lfloor ny\right\rfloor +sn$, so that (2) becomes $ \left(\sum_{k=0}^{n-1}\left\lfloor y+\frac{k}{n}\right\rfloor\right)+sn = \left\lfloor ny\right\rfloor +sn$, thus $ \sum_{k=0}^{n-1}\left\lfloor y+\frac{k}{n}\right\rfloor = \left\lfloor ny\right\rfloor$, and therefore (1) holds for $ x=y$; hence, (1) is proven for all reals $ x$. Thus, it is enough to prove (1) for all nonnegative reals $ x$ only. So we will assume that $ x$ is nonnegative from now on. Read http://www.mathlinks.ro/Forum/viewtopic.php?t=150713 post #2 (or http://www.problem-solving.be/pen/viewtopic.php?t=347 post #2) until equation (1), which states that (3) $ \left\lfloor u\right\rfloor = \sum_{i\in\mathbb{N}}\left[ i\leq u\right]$ for every nonnegative real $ u$. (Here and in the following, $\mathbb{N}$ denotes the set $\left\{1,2,3,\ldots\right\}$.) Time for the actual idea of the proof: $ \sum_{k=0}^{n-1}\left\lfloor x+\frac{k}{n}\right\rfloor = \sum_{k=0}^{n-1}\sum_{i\in\mathbb{N}}\left[ i\leq x+\frac{k}{n}\right]$ (after (3), since $ x+\frac{k}{n}$ is nonnegative) $ = \sum_{k=0}^{n-1}\sum_{i\in\mathbb{N}}\left[ in\leq nx+k\right] = \sum_{k=0}^{n-1}\sum_{i\in\mathbb{N}}\left[ in-k\leq nx\right]$ $ = \sum_{k=0}^{n-1}\sum_{j\in\mathbb{N};\ j\equiv -k\text{ mod } n}\left[ j\leq nx\right]$ (since $ \left\{in-k\mid i\in\mathbb{N}\right\}=\left\{j\mid j\in\mathbb{N}\text{ and } j\equiv -k\text{ mod } n\right\}$) $ = \sum_{j\in\mathbb{N}}\left[ j\leq nx\right] = \left\lfloor nx\right\rfloor$ (after (3), since $ nx$ is nonnegative). Thus, we have proven (1) - at least, for nonnegative $ x$, but as we know this is enough to be sure that (1) holds for all real $ x$. Thus, Theorem 1 is proven. Now, on to solving the original problem: Theorem 1 yields $ \left\lfloor \frac{n}{6} \right\rfloor + \left\lfloor \frac{n}{6}+\frac13 \right\rfloor + \left\lfloor \frac{n}{6}+\frac23 \right\rfloor = \left\lfloor 3\frac{n}{6} \right\rfloor$, what rewrites as $ \left\lfloor \frac{n}{6} \right\rfloor + \left\lfloor \frac{n+2}{6} \right\rfloor + \left\lfloor \frac{n+4}{6} \right\rfloor = \left\lfloor \frac{n}{2} \right\rfloor$, as well as $ \left\lfloor \frac{n}{6} \right\rfloor + \left\lfloor \frac{n}{6}+\frac12 \right\rfloor = \left\lfloor 2\frac{n}{6} \right\rfloor$, what rewrites as $ \left\lfloor \frac{n}{6} \right\rfloor + \left\lfloor \frac{n+3}{6} \right\rfloor = \left\lfloor \frac{n}{3} \right\rfloor$. Thus, $ \left\lfloor \frac{n}{3} \right\rfloor + \left\lfloor \frac{n+2}{6} \right\rfloor + \left\lfloor \frac{n+4}{6} \right\rfloor = \left( \left\lfloor \frac{n}{3} \right\rfloor - \left\lfloor \frac{n}{6} \right\rfloor \right) + \left( \left\lfloor \frac{n}{6} \right\rfloor + \left\lfloor \frac{n+2}{6} \right\rfloor + \left\lfloor \frac{n+4}{6} \right\rfloor \right)$ $ = \left( \left\lfloor \frac{n}{3} \right\rfloor - \left\lfloor \frac{n}{6} \right\rfloor \right) + \left\lfloor \frac{n}{2} \right\rfloor = \left( \left\lfloor \frac{n}{2} \right\rfloor - \left\lfloor \frac{n}{6} \right\rfloor \right) + \left\lfloor \frac{n}{3} \right\rfloor$ $ = \left( \left\lfloor \frac{n}{2} \right\rfloor - \left\lfloor \frac{n}{6} \right\rfloor \right) + \left( \left\lfloor \frac{n}{6} \right\rfloor + \left\lfloor \frac{n+3}{6} \right\rfloor \right) = \left\lfloor \frac{n}{2} \right\rfloor + \left\lfloor \frac{n+3}{6} \right\rfloor$, and the problem is solved. Darij
25.03.2023 01:48
Another way to prove this theorem is by induction. One can check that it is true for $n = 1, 2, 3, 4, 5$ and $6$, where both sides are equal to $0, 1, 2, 3, 3$ and $4$, respectively. Now, assume that it is true for $k = n$; $$ \left \lfloor \frac{n}{3} \right \rfloor + \left \lfloor \frac{n+2}{6} \right \rfloor + \left \lfloor \frac{n+4}{6} \right \rfloor = \left \lfloor \frac{n}{2} \right \rfloor + \left \lfloor \frac{n+3}{6} \right \rfloor $$ We will now add $4$ to both sides of this equality and rewrite. \begin{align*} \left \lfloor \frac{n}{3} \right \rfloor + \left \lfloor \frac{n+2}{6} \right \rfloor + \left \lfloor \frac{n+4}{6} \right \rfloor + 4 &= \left \lfloor \frac{n}{2} \right \rfloor + \left \lfloor \frac{n+3}{6} \right \rfloor + 4\\ %\left(\left \lfloor \frac{n}{3} \right \rfloor + 2\right) + \left(\left \lfloor \frac{n+2}{6} \right \rfloor + 1\right) +\left(\left \lfloor \frac{n+4}{6} \right %\rfloor + 1\right) &= \left(\left \lfloor \frac{n}{2} \right \rfloor + 3\right) +\left (\left \lfloor \frac{n+3}{6} \right \rfloor + 1\right) \\ \left \lfloor \frac{n}{3} + 2 \right \rfloor + \left \lfloor \frac{n+2}{6} + 1\right \rfloor + \left \lfloor \frac{n+4}{6} + 1\right \rfloor &= \left \lfloor \frac{n}{2} + 3\right \rfloor + \left \lfloor \frac{n+3}{6} + 1\right \rfloor \\ \left \lfloor \frac{n+6}{3} \right \rfloor + \left \lfloor \frac{(n+6) + 2}{6}\right \rfloor + \left \lfloor \frac{(n+6) + 4}{6} \right \rfloor &= \left \lfloor \frac{n+6}{2} \right \rfloor + \left \lfloor \frac{(n+6) + 3}{6} \right \rfloor \\ \end{align*} We have now proven that it is also true for $k = n+6$, and we are done by induction.