Proof of an equation containing the ceiling and floor functions

306 Views Asked by At

Given $ n = r- p + 1,$ where $n,r,$ and $p$ are all positive integers and $1\le p \lt r \le n$. I'm trying to prove that $\lfloor \frac{r+p}2 \rfloor - p + 1 = \lceil\frac n2\rceil$. I tried first to examine the four cases that arise depending on whether each of p and r is odd or even, but I couldn't reach anything.

I also tried to prove it directly using some properties of the floor and ceiling functions:

$\lfloor \frac{r+p}2 \rfloor - p + 1 = \lfloor \frac{r+p-2p+2}2\rfloor = \lfloor \frac{r-p+2}2 \rfloor$.

And we know that $ \lceil \frac n2 \rceil = \lceil \frac{r-p+1}2 \rceil. $ Therefore, the only thing left to prove is that $\lfloor r-p+2 \rfloor = \lceil r-p+1 \rceil $.

I'm not seeing how to continue, perhaps I did something wrong on the way?

1

There are 1 best solutions below

0
On BEST ANSWER

As commented we have $p=1$ so that proving: $$\lfloor\frac{r+1}2\rfloor=\lceil\frac{r}2\rceil\tag1$$ for integer $r$ is enough.

We discern two cases:

  • $r$ is odd, or equivalently $r=2m+1$ for some integer $m$.

Then $\frac{r+1}2=m+1$ so that the LHS of $(1)$ equals $m+1$.

So it remains to prove that the RHS of $(1)$, which is $\lceil m+\frac12\rceil$ also equals $m+1$ (which is obviously true by definition).

  • $r$ is even, or equivalently $r=2m$ for some integer $m$.

Try this yourself.