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 am carrying out a review of a network protocol, and the author has provided a function to calculate the average steps a message needs to take to traverse a network.

It is written as $$\log_{2^b}(N)$$

Does the positioning of the $2^b$ pose any significance during calculation? I can't find an answer either way. The reason is, they have provided the results of their calculations and according to their paper, the result would be $1.25$ (given $b= 4$ and $N= 32$). Another example was given this time $N= 50$, $b=4$ giving a result of $1.41$.

I don't seem to be able to get the same result if I were to apply the calculation and so it's either my method/order of working or their result is incorrect (which I doubt).

Can someone help to provide the correct way of calculating the values, and confirm the initial results? My initial calculation was calculate $\log(2^4) \cdot 32$... Clearly it's totally wrong (maths is not a strong point for me).

share|cite|improve this question
@TMM - thanks for the edits! – Ollie Apr 9 '13 at 18:59
up vote 1 down vote accepted

The base of the logarithm is $2^b$. You want to find an $x$ such that $(2^b)^x = N$, i.e. $2^{bx} = N$.

You can rewrite that as $$x = \dfrac{\log N}{b}$$ if you take the $\log$ to base-2.

share|cite|improve this answer
@Ollie P.S. the logarithm function log provided in many programming languages (C, python, ...) is actually the natural log, i.e. the base-$e$ log, which is usually written $\ln$ on e.g. pocket calculators. In this case what you want is x = log(N)/( log(2)*b ); Also, in C log(2) is a pre-defined constant M_LN2, so you could write x = log(N)/( M_LN2*b ); – Douglas B. Staple Apr 9 '13 at 17:41
Got it - when the base was changed to 2 I can get the correct answer from the measurements. I'm still not to sure how you would realise to use base 2...but at least I have the correct data. Thanks so much for the answer - it really helped! – Ollie Apr 9 '13 at 19:03

What you want to compute in your given example $N = 32$, $b=4$ is $\log(32)$, in base $2^4 = 16$.

If you are using a calculator, the "log" function often computes $\log_{10}$ or $\log_e = \ln$ of an argument, so your result is likely computing the log with one of these bases.

You can perform a change of base from $2^b$ to $10$ or $e$ by using the following formula:
$$\log_{2^b} a = {\log_d a \over \log_d 2^b}= {\log_d a \over 2\log_d b} $$

Where $\log_d$ can be either $d = 10$, or $d = e$, or for your purposes, base $d = 2$.
In the last case, then, where $d = 2$, the given formula simplifies to the equation displayed in Aryabhata nice answer!

share|cite|improve this answer
Computer science usually (and perhaps not in this context) uses $\log_2$, but +1 anyway. – Aryabhata Apr 9 '13 at 17:24
Thanks! - I'm using Excel in this instance for input so I can easily specify the based - however its still a useful answer and much appreciated. – Ollie Apr 9 '13 at 19:04
sorry I couldn't be more helpful :-( – amWhy Apr 9 '13 at 19:09
Well someone will come by who needs to calculate it manually and your highly detailed answer is bound to help them out :) - shame I can't accept both answers...I can't even up vote yet – Ollie Apr 9 '13 at 19:18

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.