# James Bloody Grime and his blasted logarithms

It’s typical of James Grime to ask a really interesting question just as I’m going to bed. I was going to sleep like a log, but suddenly I was awake liking logarithms.

I've been asked, for what base a does the equation $\log_a(x) = a^x$ have only one solution. If that's something you want to spend time on, go.

— James Grime ([twit handle='jamesgrime']) January 15, 2013

Now, the question isn’t quite perfect as specified: in fact, there are an infinite number of bases that work perfectly well, and an infinite number of those aren’t particularly interesting. There’s only one interesting answer: $a = e^{1/e}$, which is about 1.445. It’s also an unexpected answer, and I’ll show you how to work it out.

Before I tell you more, I suggest (a) you try to solve it on paper using MATHS, and/or (b) go to my handy-dandy Desmos graph and play around with it.

### Clue #1: inverses make this much easier

The first thing to notice is that the two functions $f(x) = \log_a (x)$ and $g(x) = a^x$ are inverses of each other: $fg(x) = gf(x) = x$, for all $x$ in the appropriate domains. If you know your C3, you’ll know that that means the curves are reflections in the line $y=x$ - which means in turn that when the curves cross, they also have to cross the line $y=x$.

So, instead of solving the fairly awful $\log_a(x) = a^x$, we can just say $a^x = x$. Taking logs, $x \ln(a) = \ln(x)$, or $\ln(a) = \frac{1}{x}\ln(x)$.

### Clue #2: draw a graph

How does that help? Well, we can think about where the graph of $y = \frac{1}{x}\ln(x)$ has only one solution. You can plot it with Desmos, of course (which is precisely what I did), or you can figure out its behaviour, which is what I’ll pretend I did.

First up, the domain is clearly $x>0$: you can’t put a non-positive number into logarithms (really). There’s an obvious solution to $y=0$ when $x=1$, where $\ln(x) = 0$, but no others. How about the behaviour at each end of the domain? As $x \rightarrow +\infty$, $\frac{1}{x}$ dominates - but both parts are positive, so the curve stays above the $x$-axis: $y \rightarrow 0_+$. As $x \rightarrow 0_+$, $\frac{1}{x}$ becomes a huge positive number and $\ln(x)$ a huge negative number, so $y \rightarrow -\infty$.

That means we have a graph that comes up from (very loosely) $(0,-\infty)$, crosses the $x$-axis at $(1,0)$, and then (again, loosely) ends up at $(+\infty, 0)$.

### How many solutions?

To find out how many solutions there are for any value, you can just draw a horizontal line ($y=k$, for whatever value of $k$ you’re interested in) - across the page. However many times that line crosses the curve is the number of solutions.

If you pick any $k \le 0$, there’s only one solution to $y=k$, and it’s for $0 \lt x \le 1$. All of those give valid answers for $a$ *except* $x=1$, which would give us $a=1$ - not a valid log base. Those are the infinitely many uninteresting solutions. Forget about them.

### You gotta Rolle with it

Back to the curve! A wise man - some claim it was Newton ((Rolle got the credit, though.)) - once said “What goes up, must come down.” That means, if you’ve got a continuous function (this one doesn’t have gaps in) and two places where it has the same value (for instance, $f(1) = 0$ and $\lim_{x \rightarrow +\infty} f(x) = 0$), it must have at least one turning point in between. Let’s find it!

You can differentiate $y = \frac{1}{x} \ln(x)$ using the quotient rule to get $\frac{dy}{dx} = \frac{1 - \ln(x)}{x^2}$, which has a turning point when the top of the fraction is 0 - when $1 - \ln(x) = 0$, which gives $x=e$. Neat!

Why am I bothering with the turning point? It’s because that’s the other place where $y=k$ has only one solution - the line just grazes the curve there. For all other $y$ values, the line either cuts the curve twice, or not at all.

When $x = e$, $y = \frac{1}{e} \ln(e)$, which is just $\frac{1}{e}$. So, the only *interesting* solution is when $\ln(a) = \frac{1}{e}$, giving $a = e^{\frac{1}{e}} \simeq 1.4447$.