Why does a base of Log or exponential function have to be positive? I've been wondering that for a long time, since Log with negative bases can totally work, isn't it? For example $(-3)^2 = 9$, we can express it like $\log_{-3}9$, so it's not like the function will be undefined when the base is negative. Same with exponential, why can't we have $f(x)=a^x$, $a<0$?
I know this might be stupid but I'm really confused.
 A: Taking negative bases is much more complex than what you may initially think. When you do so, you travel to complex land. Recall the change of base formula $\log_{b}(x)=\frac{\ln x}{\ln b}$. To use your example, consider
$$\log_{-3}(9) = \frac{\ln(9)}{\ln(-3)},$$
by the change-of-base formula. Now, if $\ln(-3)=k$, then $e^k=-3$. Of course, this has no real solutions, but we know Euler's identity: $e^{i\pi}=-1$. Using this, we have that $3e^{i\pi}=-3$. Therefore, $$\ln(-3)=\ln(3e^{i\pi})=\ln(3)+\ln(e^{i\pi})=\ln(3)+i\pi.$$ Hence, our original $\log$ becomes
$$\log_{-3}(9) = \frac{\ln(9)}{\ln(3)+i\pi}.$$
Here's where the issue comes in. We "know" that $\log_{-3}(9)=2$, but that means that $\frac{\ln(9)}{\ln(3)+i\pi}=2,$ which can't be possible, since the LHS of that equation is non-real, while the RHS is. So, there must be some deeper issue that broke math.
The issue here is that $\ln(-3)$ isn't actually a single value, its entire family of values: $\ln(-3)=\ln(3)+ni\pi$, for every odd $n\in\mathbb Z$. That is, $\log_{-3}(9)$ isn't just $2$. If you delve into a complex analysis class, you will find that the complex logarithm is a multi-valued function.
A: Well of course you can always define a function like $f(x)=a^x$ with a<0, as long as you restrict the domain quite heavily. The problem being that not all powers of negative numbers are real numbers, take for example $-1^{1/2}$; not to mention all the irrational numbers.


Therefore there wouldn't be a useful function with real values, because when we define elementary functions like log and exp we are aiming to have well-behaved "smooth" functions. ( I used the inverted commas because smooth has a very precise meaning which at your level you can probably just guess)


If there is something unclear or something you wish to get deeper about, let me know!

ps: I just wrote about the exponential function but the problem is the same with the logarithm.
