Why is $\log_{-7}49$ undefined instead of $2$?

In general it is not possible to take a number $x$ and a negative number $n$ and find an exponent $y$ such that $n^y=x.$ For example, it won't work if $x=7$ and $n=-7.$ It works out in the specific case of $x=49$ and $n=-7$, but it's just not useful enough to define the logarithm function for a few special values where logarithm by a negative number actually works.


When working in the real numbers, we require that the base of the logarithm is greater than $0$ (and not equal to $1$). While the expression $$ \log_{-7}(49)=2 $$ does have some sense to it, it is formally incorrect for this simple reason.

This begs the question—why do we avoid negative bases? This is because the function $\log_{-7}$ would be ugly. It would only be defined for a limited subset of the real numbers, and it wouldn't be differentiable, unlike other logarithm functions. The exponential function $(-7)^x$ only makes sense for some rational $x$ (where the denominator is odd), and so exponentiation of negative numbers is a touchy subject in general. Note that the definition of $a^x$ is $$ \exp(x\log(a)) $$ where $\log$ is the natural logarithm and $\exp$ is the exponential function ($\exp(x)=e^x$). Negative bases have to be dealt with separately, as $\log(a)$ is undefined for $a \leq 0$.