4
$\begingroup$

Why is $\lfloor n/3 \rfloor + \lceil 2n/3\rceil = n?$

It feels like I'm just doing basic fraction addition since

$$\frac{n}{3}+\frac{2n}{3}=n$$

So then how does ceil and floor play a role in addition?

$\endgroup$
  • 1
    $\begingroup$ $n/3$ and $2n/3$ are not always integral. So, for example, $n/3$ does not always equal $\lfloor n/3 \rfloor$. A natural way of approaching such a problem is to realize that any integer $n$ can be written as either $3k$, $3k+1$ or $3k+2$, with $k \in \mathbb{Z}$. Now we can check these $3$ cases separately. $\endgroup$ – Woett Jul 28 '17 at 17:27
  • $\begingroup$ If you check the plot wolframalpha.com/input/?i=floor(x%2F3)%2Bceil(2x%2F3),+x you'll notice that the equality only holds for integer $n$. The pure fractional equation holds for all numbers. $\endgroup$ – Thomas Ahle Jul 28 '17 at 18:08
3
$\begingroup$

Let $n=3k + r$, where $r\in \{0,1,2\}$. Then $\lfloor\frac{n}{3}\rfloor = k$. Also, $\lceil\frac{2n}{3}\rceil=\lceil\frac{6k + 2r}{3}\rceil=2k+\lceil \frac{2r}{3}\rceil$. Therefore, $$\left\lfloor\frac{n}{3}\right\rfloor + \left\lceil\frac{2n}{3}\right\rceil = 3k + \left\lceil\frac{2r}{3}\right\rceil.$$ The claim immediately follows by noting that $\lceil\frac{2r}{3}\rceil = r$ for $r \in \{0,1,2\}$.

$\endgroup$
4
$\begingroup$

Note that both $\frac n3-\left\lfloor\frac n3\right\rfloor$ and $\left\lceil\frac{2n}3\right\rceil-\frac{2n}3$ have a period of $3$. Subtracting we get that $$ \left\lceil\frac{2n}3\right\rceil+\left\lfloor\frac n3\right\rfloor-n\tag{1} $$ has a period of $3$. Thus, we only need to check $n=0,1,2$ to verify $$ \left\lceil\frac{2n}3\right\rceil+\left\lfloor\frac n3\right\rfloor=n\tag{2} $$ for all $n$.

$\endgroup$
2
$\begingroup$

Note that the following identities hold for all integer $n$, real $x$:

  • $\lceil n+x \rceil = n + \lceil x \rceil$ (and $\lfloor n+x \rfloor = n + \lfloor x \rfloor$, but we don't need that)
  • $\lceil -x \rceil = -\lfloor x \rfloor$

Thus, if $n$ is an integer, we have: $$\lceil 2n/3 \rceil=\lceil n+(-n/3)\rceil=n+\lceil -n/3\rceil=n-\lfloor n/3\rfloor$$

$\endgroup$
1
$\begingroup$

Hint: do the actual computation (with floor and ceiling) for various sample values of $n$ - say $1$ through $6$.

You'd better assume $n$ is an integer. Can you see why?

$\endgroup$
  • $\begingroup$ One can even spare one sample, $n=6$ is not needed. $\endgroup$ – egreg Jul 28 '17 at 17:27
1
$\begingroup$

For ease of typing let $f(z)=floor(z)$ and $c(z)=ceil(z).$

We have $n=3m+x$ where $m\in \mathbb Z$ and $x\in \{0,1,2\}.$

(i). If $x=0$ then $f(n/3)+c(2n/3)=f(m)+c(2m)=m+2m=3m=3m+x=n.$

(ii). If $x=1$ then $f(n/3)+f(2n/3)=f(m+1/3)+f(2m+1/3)=m+(2m+1)=3m+1=3m+x=n.$

(iii). If $x=2$ then $$f(n/3)+c(2x/3)=f(m+2/3)+c(2m+4/3=f(m+2/3)+c((2m+1)+1/3)=$$ $$=m+(2m+2)=3m+2=3m+x=n.$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.