Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was reading some algorithm's analysis and I came across the following in the proof:

$\log_2(n+1) \le h \le 1 + \log_2(n) \implies h = \lceil \log_2(n+1)\rceil$

Here both $h$ and $n$ are integral. Why is the above true ?

share|cite|improve this question
Should the logarithm on the right be logarithm base 2? – Arturo Magidin Oct 28 '11 at 17:15
yes ! thanks for noticing – AnkurVijay Oct 28 '11 at 17:19
Hint: $log_2(n)<log_2(n+1)$ So $log_2(n)<h\leq 1+log_2(n)$. How many different integers $h$ can be in the range $(x,x+1]$ for any real number $x$? And is $\lceil \log_2(n+1)\rceil$ in that range when $x=log_2(n)$? – Thomas Andrews Oct 28 '11 at 17:32
@Thomas thanks, got it. If you put the hint as an answer, Ill accept it. – AnkurVijay Oct 28 '11 at 17:35
up vote 4 down vote accepted

The ceiling function $\lceil x\rceil$ can be defined as the unique integer in the interval $[x,x+1)$.
But $1+\log_2(n)< 1+\log_2(n+1)$, so $h$ is an integer in the interval $[\log_2(n+1),1+\log_2(n+1))$. That means that $h=\lceil \log_2(n+1)\rceil$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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