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 sorry if this is a noob question, I need help with relatively simple math problem and assurance that I understand the problem correctly.

I have a map-like program that zooms in and zooms out if you press the + and - icons (much like google map). Every time you zoom the map size doubles or halves. I know the minimum and maximum size of the map, how do I calculate the number of the doubling steps?

I was thinking of this:

A on power of 2*x equals B, where A is the minimal zoom, B is the maximal zoom a x is the number of steps between them. Am I right?

How do I calculate x form that formula?

Many thanks

share|cite|improve this question
I see you have tagged logarithms - have you tried what happens when you take the logarithm of your formula? – Mark Bennet Jul 3 '11 at 19:55
@daniel.sedlacek: You are certainly right that if $x$ is the number of steps then $(2^x)A=B$. – André Nicolas Jul 3 '11 at 20:17
up vote 2 down vote accepted

If I understand the question right, after the step $1$ you doubled $A$; after the step $2$, you have $2^{2}A$; after step $x$ you have $$2^{x}A=B.$$ Applying logarithms we get

$$\ln \left( 2^{x}A\right) =\ln B\Leftrightarrow \ln \left( 2^{x}\right) +\ln A=\ln B$$

$$\Leftrightarrow x\ln 2+\ln A=\ln B\Leftrightarrow x=\frac{\ln B-\ln A}{\ln 2}$$

If $x\notin \mathbb{Z}$, then you have to take

$$\left\lceil x\right\rceil =\left\lceil \frac{\ln B-\ln A}{\ln 2}% \right\rceil $$


$$\left\lfloor x\right\rfloor =\left\lfloor \frac{\ln B-\ln A}{\ln 2}\right\rfloor .$$

i.e. $n$ steps

$$\left\lfloor \frac{\ln B-\ln A}{\ln 2}\right\rfloor \leq n\leq \left\lceil \frac{\ln B-\ln A}{\ln 2}\right\rceil $$

share|cite|improve this answer
I think that's exactly it. Many thanks. – daniel.sedlacek Jul 3 '11 at 22:26
You are welcome! – Américo Tavares Jul 3 '11 at 22:44
Does this formula have a name? I am trying it with my application, but it doesn't like that formula. – John Riselvato Apr 16 '12 at 17:30
@JohnRiselvato: I don't know if it has a name in this context. – Américo Tavares Apr 16 '12 at 17:37
For solving for a step, what can i look into? – John Riselvato Apr 16 '12 at 17:44

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.