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

Express $$ T(2^k)=\frac{k(k+1)}{2}. $$

In terms of $n$, where $n = 2^k$.

I'm not sure how to go about with the conversion. Can someone concisely explain?

Thank you.

share|cite|improve this question
up vote 5 down vote accepted


share|cite|improve this answer
This may be a dumb question, but if the equation had been $ T(2^k)=\frac{k(k+1)}{2} +1. $ would the result be what you've written +1 ? – Bob John Feb 6 '13 at 4:18
@BobJohn: take a look at anorton's answer for more details. The answer is yes, if you add +1, then the result would be the same as what I wrote with a $+1$ as well. By saying $n=2^k$, you need to find how $k$ depends on $n$ and then plug that into every instance of $k$ in your equation. – Alex R. Feb 6 '13 at 4:21

Alex's answer is correct; I thought I'd work the problem in "slow motion:"

$$n=2^k$$ We have an exponential. We want to solve for $k$, which essentially begs for a $\log$ function. $\log_2$ is an ideal choice, as it cancels out the $2^k$ in the definition of $T$.

So, taking the $\log_2$ of both sides: $$\log_2 n = \log_2(2^k)$$ $$\log_2 n = k\log_2(2)$$ $$\log_2 n = k$$

Substituting: $$T(2^k) = \frac{k(k+1)}{2}$$ $$T(2^{\log_2 n}) = \frac{\left(\log_2{n}\right)(\log_2 n+1)}{2}$$ Simplify: $$T(n) = \frac{\left(\log_2{n}\right)(\log_2 n+1)}{2}$$

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.