how to simplify $\log_{a/b}(n)$

45 Views Asked by At

This is stemming from a programming problem, and I am trying to figure out if there is an easier way to go about the issue.

I need to get $\log_{a/b}(n)$, with $0 < a/b < 1$.

Is is possible to rewrite $\log_{a/b}(n)$ as something along the lines of $\frac{\log_{a}(n_1)}{\log_b(n_2)}$?

Yes I know that $\log_{a/b}(n) \neq \frac{\log_{a}(n_1)}{\log_b(n_2)}$, but I was wondering if there was some conversion that could work, possibly similar to this.

I know that $\frac{\log(a)}{\log(b)} = \log_{b}(a)$ (99% sure at least). but this is different enough that I'm don't really think that this is a similar solution.

1

There are 1 best solutions below

0
On BEST ANSWER

We can write $\log_{a/b} n$ as $\frac{\log_c n}{\log_c(a/b)} = \frac{\log_c n}{\log_c a - \log_c b}$ for any choice of $c$. In particular, we could:

  1. Take $c = a$ and write $$\log_{a/b} n = \frac{\log_a n}{1 - \log_a b}.$$

  2. Take $c = b$ and write $$\log_{a/b} n = \frac{\log_b n}{\log_b a - 1}.$$

  3. Write $$\log_{a/b} n = \frac{\log n}{\log a - \log b}$$ for whatever happens to be your default choice of base for the logarithm, whether that's $2$, $e$, or $10$.

It's actually also possible to express the whole thing in terms of $\log_a n$ and $\log_b n$, but it's a more complicated journey. Starting with taking $c=n$, we get $$\log_{a/b} n = \frac{1}{\log_n a - \log_n b} = \frac1{\frac1{\log_a n} - \frac1{\log_b n}} = \frac1{\frac{\log_b n - \log_a n}{\log_a n \log_b n}} = \frac{\log_a n \log_b n}{\log_b n - \log_a n}.$$