Do equal bases imply equal powers?

$$x^a = x^b \Rightarrow a =b$$

So, this is a concept I used in multiple math problems and they often turn out right. The thing is, today my math teacher told me that this is not necessarily true.
(He did not, however, give me a proper explanation as to why that is and no one expected him to because it seemed very trivial and seemed like something that everybody should have already known.)

I was wondering if someone could explain as to why he said that. I presume it has something to do with higher levels of math that I don't understand.

My logic is that since $\log_{x} a = \log_{x} b$, $a = b$.
But that's only true if $f(a) = f(b) \Rightarrow a = b$.
I only assume so because I did that in many trigonometry questions. But I don't believe that's enough proof to substantiate my claim. Please help.


Solution 1:

It works, provided that $x>0$ and $x\neq 1$ (these are the allowed values for a logarithm of base $x$). Otherwise, here are some counterexamples:

  • $(-1)^3 = -1 = (-1)^5 \qquad\text{ yet }\qquad 3 \neq 5$
  • $0^3 = 0 = 0^5 \qquad\text{ yet }\qquad 3 \neq 5$
  • $1^3 = 1 = 1^5 \qquad\text{ yet }\qquad 3 \neq 5$

Note that if $x<0$ and $x \neq -1$, we can actually get rid of the negative sign so that it works. For example, if $(-2)^a = (-2)^b$, then taking the absolute value of both sides yields $2^a = 2^b$, so we may take the log (base $2$) of both sides to obtain $a=b$.

Solution 2:

If you take logs in your original equation, then you obtain:

$x^a = x^b \\ \Rightarrow a\log x = b\log x \\ \Rightarrow (a-b)\log x = 0$

From this last equation, we see that either $a-b=0$, meaning $a=b$, or else $\log x = 0$, meaning $x=1$.

Other exceptions can occur for values of $x$ that aren't in the domain of the logarithm function at all. Dealing with negative values of $x$ can be done by canceling out any negatives before taking logs.

If you're allowing for complex numbers, the answer is somewhat more complicated. For example, $e^{2\pi i} = e^0$, but $2\pi i \neq 0$.