I want to calculate the logarithm of any base completely by hand. I dont want to use a calculator, tables or predefined numbers. The only mathematical functions available for the calculation are addition, subtraction, multiplication, division and if needed square root (which can be calculated by hand). I dont want an approximation.

There are two ways to do that:

The first is by bruteforcing / trial and error:




10000 is bigger than 100, so make exponent smaller.


1000 is bigger than 100, so make exponent smaller.


100=100 so the solution for log10(100)=2

But this way of doing that is very limited and has no practical use. The second is using lookup tables. But this is also very limited and you cant store a infinite amount of values.

I want to calculate it completely by hand. There is a Taylor Series for the natural logarithm: enter image description here

$ln\left(1+x\right)=\frac{x^1}{1!}-\frac{x^2}{2!}+\frac{x^3}{3!}-\frac{x^4}{4!}+\frac{x^5}{5!}\cdot \cdot \cdot $

Is it maybe possible to use this for solving any logarithm?

  • $\begingroup$ Welcome to MSE. Please type your questions instead of posting images. Images can't be browsed and are not accessible to those using screen readers. If you need help formatting math on this site, here's a tutorial $\endgroup$ – saulspatz Jul 4 at 16:58
  • $\begingroup$ I edited the question and now ith should be readable to everyone. $\endgroup$ – Dieter Alfred Jul 4 at 17:09
  • 1
    $\begingroup$ Unfortunately, this series only converges for $|x| < 1.$ But you could use this as a formal power series to compute $\ln(1 + x)$ to a sufficient degree of accuracy. $\endgroup$ – Carlo Jul 4 at 17:15
  • 1
    $\begingroup$ You have copied the series incorrectly. The denominator of the $n$th term in the series for the logarithm is just $n$, not $n$ factorial. What you wrote is actually the series for $1-e^{-x}.$ $\endgroup$ – David K Jul 4 at 17:20
  • 2
    $\begingroup$ " I dont want an approximation." For an irrational number? Not possible. $\endgroup$ – fleablood Jul 4 at 17:20

Here are two methods of calculating any logarithm at all, though neither is of particularly rapid convergence.

My favorite is to use the little-known formula $$ \ln(x)=\lim_{n\to\infty}n\bigl(x^{1/n}-1\bigr)\,. $$ The limit is over all values of $n$, so you might as well restrict to $n=2^m$. On my trusty HP15C, I can do this by entering $x$, then hitting the square-root button $m$ times. Then I subtract $1$, and multiply by $2^m$. Try it.

Of course that’s only an approximation, and if you want something close, I fear that you need to go to unreasonably large values of $m$, not really practical.

Here’s a series, however, good for all $x$: notice that $\ln(1-x)=-\bigl(\sum_{n=1}^\infty\frac{x^n}n\bigr)$, and therefore we get $$ \ln\left(\frac{1+x}{1-x}\right)=2\sum_{n=0}^\infty\frac{x^{2n+1}}{2n+1}\,, $$ still valid only for $-1<x<1$. But that’s good enough for our purposes: solve $\xi=\frac{1+x}{1-x}$ for $x$, and get $x=\frac{\xi-1}{\xi+1}$. Thus, for instance, if you want $\ln5$, you set $\xi=5$, $x=\frac46=\frac23$. That’s what you plug into the series above to get $\ln(5)$.

To get $\log_b(x)$, you need only $\ln b$ and $\ln x$, as I’m sure you know.

| cite | improve this answer | |
  • $\begingroup$ Sweet...I love that formula at the start! Gotta put that in my bag of tricks. $\endgroup$ – John Hughes Jul 5 at 17:12
  • $\begingroup$ You probably never knew our former, late, colleague Kenneth Ireland. I heard that he used that as the definition of the log one year when teaching Calculus I (math 9). $\endgroup$ – Lubin Jul 6 at 2:08
  • $\begingroup$ I knew of him, of course, but just missed meeting him. Using that as a definition seems...risky (and perhaps fails to capture the intuition for why logs were even invented). $\endgroup$ – John Hughes Jul 6 at 2:19
  • $\begingroup$ I would never do it in Calculus I, but exactly that formula is what’s very useful for defining the $p$-adic logarithm. Allows a quick proof of why the log has a product expansion, and vanishes, as it must, on roots of unity within the log’s domain of convergence. $\endgroup$ – Lubin Jul 6 at 14:07

Almost all logarithms of almost all numbers in almost all bases are in fact irrational. When you say you don't want an approximation, how do you plan to write down these irrational numbers exactly? (By the way, the same goes for square roots: there's an algorithm for them, but for almost all inputs, computing the output exactly requires infinitely many steps.) If you're willing to allow infinitely many steps, then the Taylor series (with a little preliminary work) will do fine.

Here's a solution for when then base $b$ is bigger than $1$; I leave the other case to you.

The preliminary work is this: take your input (positive) number $x$. If it's between $1$ (inclusive) and $2$ (exclusive), write down $0$, and move on to the real work below, renaming your number $x''$.

Otherwise, if it's less than $1$, multiply $x$ by $b$ until you get a number $x'$ that's between $1$ (inclusive) and $b$ (exclusive). If you multiplied by $b$ some number, $k$, times, write down $-k$. $$ \log_b(x) = \log_b(x') + \log_b(b^{-k} = \log_b(x') -k $$ so all you need to do is compute $\log_b(x')$. A similar approach works for numbers larger than $b$.

So...after some number of multiplications/divisions by $k$, you get to a number $x'$ between $1$ and $k$. If $1 \le x' < 2$, move on; otherwise, compute the square root, and get that $$ \log_b(x') =2 \log_b \sqrt{x'}, $$ so you only need to compute the log of that square root. Repeatedly extract square roots until you get a number less than $2$, call it $x''$. Move on to the "real work" portion.

If $x$ is bigger than $b$, divide $x$ by $b$ until you get a number $x'$ that's between $1$ and $b$ as above. If you divided $k$ times, write down $+k$, and use this to show how $\log x'$ is related to $\log x$. Then use square roots, as before, to reduce to a number between $1$ and $2$, and call that $x''$.

The "real work": Now use the Taylor series (for $\log$, of course!) to compute $p = \log x''$; that'll take infinitely long in general, but you already indicated by your willingness to extract square roots that this was OK.

Your final answer for $\log x$ is $\frac{p}{\log b}$ plus the adjustments from the preliminary phases. Of course, this requires that you compute $\log b$... which you can do using the second phase (to reduce $b$ to a number smaller than $2$) and the third (using the Taylor series).

Thanks to @DavidK for pointing out that in an earlier version I was assuming convergence of the series for $\log_b$ on $1 \le u < b$, when I should only have used $1 \le b < 2$.

Note too, that if you like square roots, you can skip the first phase and just take square roots for longer (at least if $x$ starts out larger than $b$).


I don't claim any efficiency here. You win BIG by dividing/multiplying at least once more by $\sqrt{b}$, and then adding/subtracting $\frac12$ from the result, because convergence of the Taylor series is a LOT faster when you're in the first half of the domain of convergence.

N.B.: For an arbitrary input $x$ and base $b$, even expressing these numbers is likely to take infinitely long.

| cite | improve this answer | |
  • $\begingroup$ It might be worth saying what "the" Taylor series for $\log_b$ is. One possibility is just to multiply the series in the question by $1/\ln(b),$ but then it still converges only for $0<x\leq 2$ regardless how large $b$ is. $\endgroup$ – David K Jul 4 at 17:46
  • $\begingroup$ Good observation. I've edited. But frankly, it seems like a waste of time: "computing exactly" and "by hand" and "irrational numbers" sounds like a pretty ugly mix. $\endgroup$ – John Hughes Jul 4 at 18:01
  • 1
    $\begingroup$ I agree completely, including the part about "waste of time" (unless it's just as an exercise, once, to get a taste for just why it is that we rely on precomputed tables for all practical purposes, even in a calculator IIUC). $\endgroup$ – David K Jul 4 at 18:32
  • 1
    $\begingroup$ No, @DavidK , my understanding is that logs, exponentials, and trigonometric functions are gotten not by table look up, but by recomputation, using rapidly-convergent techniques. John, you must know all about this. $\endgroup$ – Lubin Jul 5 at 2:28
  • $\begingroup$ @Lubin I could have been more specific: I had the impression that most algorithms had an initial branching that was essentially a table lookup in order to get to the rapidly-converging stage. I could be mistaken. $\endgroup$ – David K Jul 5 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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