0

My question is this: In a logarithm, given a base and an argument, how do you derive the exponent (without counting, trial and error or educated guessing)?

e.g.

log2 (2048) = ?

If:

log() = e

I would like to know the algebra/formula for deriving the exponent(e) when you plug in a base(x) and an argument (y).

What I am seeking is not an algorithm but rather a formula, if there is one.

Thank you for reading

  • 2
    Can you write $2048$ as a power of $2$? – Eric Towers Oct 02 '21 at 22:17
  • 1
    What kind of "method" do you want? Do you understand why $2^{11} = 2048$? Do you understand why any other number other than $11$ will not give you a true equation? That's exactly what it means that $\log_2(2048)$ is $11.$ Or are you looking for an algorithm where you can plug in any positive real numbers $x$ and $y$ as decimal numerals and the algorithm will give you the value of $\log_x(y)$, just like the way long multiplication gives you the product $xy$? Such algorithms exist but they're not fun. – David K Oct 02 '21 at 23:34
  • Hint: $\log_2(2048) = x \iff 2^x = 2048$. Now, express $2048$ as a power of $2$, and then use the fact that the function $f(x) = 2^x$ is one-to-one (i.e. injective). – Jose Arnaldo Bebita Dris Oct 03 '21 at 01:26
  • Hi David, I think what I am looking for is a mathematical formula for deriving e given x and y in log() = e (which I believe you wouldn't classify as an algorithm) – user13764383 Oct 03 '21 at 02:18
  • What do you mean by "mathematical formula"? A fixed-size expression using just the four basic arithmetic operations (addition, subtraction, multiplication, division) where you can plug in $b$ and $y$, and get exact value of $\log_b (y)$? There is no such formula. So what operations are you then willing to accept? – Jukka Kohonen Oct 03 '21 at 03:15

3 Answers3

2

If $log_b(a)=x$ and you were asked to find x then this means you need to find some number x such that: $b^x=a$

In your example you are asked to find x in this: $log_2(2048)=x$

So you need some value for x such that: $2^x=2048$

x=11 satisfies this condition.

If you want to calculate $log_b(a)$ on a calculator that only has the $log_{10}$ function then you can use the change of base formula as follows:

$log_b(a)$=$\frac{log_{10}(a)}{log_{10}(b)}$

If you would like to calculate it by hand then, for your example, you would start with 2 and keep multiplying it by itself until you reached the answer. This would only be possible if the answer is an integer. So again for your example you would do:

2

2x2=4

4x2=8

8x2=16

16x2=32

1024x2=2048

And then count how many steps this took which should be 11 for your example.

If you want an algebraic formula then here is one that is valid for x>0:

$ln(x)=2\sum_{n=1}^{\infty}\frac{(\frac{x-1}{x+1})^{2n-1}}{2n-1}$

The above is an infinite expansion for log base e of x, typically written as $ln(x)$. So, if you want to calculate the log in some other base then you would first need to use the change of base formula to convert it to log base e.

Mufasa
  • 5,434
  • Hi Mufasa, thanks for your response, what I would like to know is how I can derive the value x=11 from the values of b and a, without using trial and error. If I gave you the question: log2 (2048) = ? ; how would you solve it? – user13764383 Oct 02 '21 at 23:55
  • @user13764383, what's wrong in trial and error? By "method" do you mean by hand? With calculator? With logarithm tables? – Jukka Kohonen Oct 03 '21 at 00:38
  • Well you can always just use a calculator to work out the value. If your calculator only has the $log_{10)$ or $log_e$ functions available then you can use the log base change formula to work it out for any other base. – Mufasa Oct 03 '21 at 01:11
0

So, by hand, with no calculator, logarithm tables or mechanical devices? Also, I understand that $2048$ and $2$ are just examples, and you would like a general method?

The simplest way is trial and error: Given base $b>1$ and argument $y>0$, try different values $x$ in order to find $b^x = y$. Do the exponentations by hand (by repeated multiplication).

Now of course you can be clever about what values $x$ you try. Surely if you tried some $x$ and got $b^x < y$, then you don't try that $x$ again (it will give the same answer again), nor do you try any smaller values of $x$ (they will give smaller $b^x$). So you increase your $x$ in order to increase $b^x$. Perhaps you increment $x$ by one, or perhaps more. Incrementing $x$ by one means you multiply $b^x$ by $b$; there are other methods, for example doubling $x$ means squaring $b^x$.

So perhaps you can find two values $x_1$ and $x_2$, such that $b^{x_1} < y < b^{x_2}$. This is called bracketing the solution: because $b^x$ is an increasing function of $x$, you know that the solution is somewhere between $x_1$ and $x_2$. The simplest thing you could now do is try some value $x_3$ strictly between $x_1$ and $x_2$ and try again: this way you can narrow down your bracket, as narrow as you want.

Now if the solution is actually an integer, this process will terminate when you find the integer. If not, you will have to use rational noninteger exponents $x=p/q$; either by taking $q$th roots by hand (not so nice but doable), or by observing that $b^{p/q}=y$ is equivalent to $b^p = y^q$ (probably nicer for hand calculations). But of course it could be that the solution is not even a rational number. Then the best you can do (by hand) is an approximation, or lower and upper bounds on where the solution is, to some accuracy that you are satisfied with. Repeated bracketing will do that for you.

There are other, more sophisticated methods but usually it is wise to start from understanding the simplest methods first.

Let's see how the bracketing might work with $b=2$ and $y=2048$, if we are not clever or lucky enough to know already the solution.

  • Try $x=1$, so $b^x=2$. Oops, too small. Double the $x$ (and square the $b^x$).
  • Try $x=2$, so $b^x=2^2=4$. Oops, too small. Double the $x$.
  • Try $x=4$, so $b^x=4^2=16$. Oops, too small. Double the $x$.
  • Try $x=8$, so $b^x=16^2=256$. Oops, too small. Double the $x$.
  • Try $x=16$, so $b^x=256^2=65536$. Oops, too big. Try something between $8$ and $16$.
  • Try $x=12=8+4$, so $b^x = 256\times 16 = 4096$. Oops, too big. Try something between $8$ and $12$.
  • Try $x=10=8+2$, so $b^x = 256\times 4 = 1024$. Oops, too small. Try something between $10$ and $12$.
  • Try $x=11=10+1$, so $b^x = 1024\times 2= 2048$. Success. We are done.

Note that at many points of the process you might have made "better" choices by educated guessing (e.g., after $x=12$ you might notice that $4096$ is not too badly off, only by a factor of two so you could try $x=11$ next). But since you specify "no educated guessing", you need a mechanical rule: halving the bracket each time is one, and gives you an algorithm that is guaranteed to finish if the result is an integer, and is guaranteed to give ever finer approximations otherwise.


Update (after edits on the question). Originally your question asked for "the method" that produces the result. Then it changed to "the algorithm/algebra/formula". But then the whole question turned upside down: now it is "not an algorithm but rather a formula". I am afraid that answering a question that moves goalposts is going to be difficult. It is not at all clear what kind of "formula" you're willing to accept.

At any rate, there is no fixed-size formula using just the four elementary arithmetic operations ($+-\times\div$) where you could plug in the two numbers and get an exact result. So something more will be needed, whether it is formula size (would a series expansion be allowed?), allowed elementary operations (would you have natural logarithm available?), method (can you do the calculation in steps and make choices on the way? That leads to an algorithm, and I don't understand what is wrong with that), or accuracy (for an approximation you could use, for example, a truncated series expansion). Second-guessing your thoughts (what is acceptable and what is not) may be difficult, to put it mildly.

At some point perhaps one needs to say:

Looks like the original problem ("the method that produces the result") is solved isn't it? As for "not an algorithm", that would be a different question, consider posting it separately.

Peter O.
  • 931
  • Hi Jukka, thank you for your detailed response - its useful to have this algorithm explicit - unfortunately due to not really knowing the correct terminology - I think I asked for the wrong thing - what I (think) I’m looking for is a mathematical formula and not an algorithm - the formula might be way more complicated than I can handle and I would definitely day-to-day use this algorithm as its undoubtedly way more practical (if I didn’t have a calculator at hand) - but I wonder - is there a more formal, nonalgorithmic (algabraic?) way of deriving e from log() in log() = e. ? – user13764383 Oct 03 '21 at 02:24
  • You seem to be changing the question many times. Also I don't see why an algorithm would not be formal. – Jukka Kohonen Oct 03 '21 at 02:25
0

There's no easily useable formula. There are quick algorithms though (continually square, therefore double your counter)

An example is $$\log_2(2^{2^{20}})$$ which is calculatable in just $21$ steps (assuming you can't see if off hand) .