0
$\begingroup$

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?

$\endgroup$
2
  • 1
    $\begingroup$ If $r-p+1=n\geq r$ then $p\leq1$. Combining this with $1\leq p$ we find that $p=1$. $\endgroup$
    – drhab
    Commented Feb 4, 2020 at 9:23
  • $\begingroup$ I see, so now that we have $ p = 1$ , how do we prove that $ \lfloor \frac{r+1}2 \rfloor = \lceil \frac r2 \rceil$ ? I'm still a beginner with these functions sorry if my question is silly :p $\endgroup$
    – user821
    Commented Feb 4, 2020 at 9:38

1 Answer 1

1
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .