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.
 A: 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$.
A: Whether the stated rule is valid depends on what $x$ is, and on where the values $a,b$ are supposed to live. The most important cases where the rule holds are when $x$ in an indeterminate (in which case it does not much matter where $a,b$ are taken): if the monomials $x^a$ and $x^b$ are the same, then $a$ and $b$ must be the same. In the same vein, if $x^a$ and $x^b$ designate functions of say $x\in\Bbb R_{>0}$ (and $a,b$ are constants, expressions not containing$~x$), then the equality of functions $x^a=x^b$ (more properly $(x\mapsto x^a)=(x\mapsto x^b)$) implies $a=b$ (you can prove this by differentiating both sides and then putting $x=1$ in the derivatives).
Howerever if $x$ designates some concrete (though possibly unspecified) value, then the implication is in general not valid, as has been illustrated by many examples (the case $x=1$ is the most spectacular example of failure). Under some specific conditions the rule will still be valid (such as $x\in\Bbb R_{>1}$ and $a,b\in\Bbb R$), but you need to be very explicit about these conditions.
A lesson to learn from this is that an equation like $x^a=x^b$ does not have an unambiguous meaning in isolation, and it needs to be accompanied by an indication of what the symbols mean.
A: 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$.
A: That should be true if x does not equal to 0, 1 or -1.
A: Given $x^a = x^b$;
Then $\frac{x^a}{x^b} = x^{(a-b)} = 1$  ;
Let $a-b = n$ ; 
Then  $x = 1^{(1/n)} = 1^{1/n}$ ;
So $a=b$ only if $x$ is a real number , not one , not zero , not infinite.
