# Why is the domain of $x^x$ positive real numbers?

(What is this function called, is it an exponential function?)

Plot of $x^x$

I plotted this function and found that only positive part of it is shown. Also while computing derivative of this function we take log which also implies that $x$ has been taken to have only positive values.

But I can take individual negative numbers and easily find its value like $(-2)^{-2}=1/4.$ (This is not true for negative fractions though) What causes this discrepancy?

• $(-1)^{-1}=-1$ so negative number is possible. Is there something that I am missing? May 29 '18 at 0:15
• How would you define $(-\sqrt{2})^{-\sqrt{2}}$?
– user123641
May 29 '18 at 0:17
• When you say "range", do you actually mean "the set of $x$ values for which the expression $x^x$ is defined"? If so, that is called the domain; the word "range" refers to the set of results. May 29 '18 at 0:21
• @mweiss Edited. Thanks May 29 '18 at 0:28
• Related (maybe a duplicate)?: math.stackexchange.com/questions/1041559/… May 29 '18 at 0:32

There is more than one notion of exponentation; see this answer of mine.

The notion of exponentiation relevant to considering the function mapping $x$ to $x^x$ is the real, continuous exponentiation operation. It is only defined for positive bases (and depending on your conventions, also for a base of zero so long as the exponent is positive).

As an aside, a function isn't well-defined unless its domain and codomain is specified. The (presumed) intention here is that they should be inferred from context. The best inference here for the domain is the positive real numbers or nonnegative real numbers (since $x^x$ has a continuous extension to $x=0$).

When $x$ is a continuous, real variable, trying to consider $x^x$ defined for negative $x$ is extremely awkward, poorly behaved, and ambiguous, and furthermore I can only imagine extremely niche applications for it. You really shouldn't do so unless you have a crystal clear practical motivation making it necessary.

The definition of $a^x$ is $$a^x=e^{x\ln(a)}$$ when $a>0$ and $x\in \Bbb R$.

The reason why we can't use this definition for negative $a$'s is somewhat obvious: the logarithm function is not defined for negative numbers.

Well. It could be defined, but there is a choice to be made, which essentially boils down to: is $\ln(-1)$ equal to $i\pi$ or $-i\pi$ (or $3i\pi$, or...)? If you choose e.g. $\ln(-1)=i\pi$, then you will have $\ln(-3)=\ln(3)+i\pi$, and so on for all negative numbers.

In general this choice is going to make a difference regarding the result of $x^x$. For instance $$\left(-\frac{1}{2}\right)^{\large\frac{1}{2}}=e^{\large\frac{1}{2}\left[\ln\left(\frac{1}{2}\right)+i\pi\right]}$$ is not the same as $$\left(-\frac{1}{2}\right)^{\large\frac{1}{2}}=e^{\large\frac{1}{2}\left[\ln\left(\frac{1}{2}\right)-i\pi\right]}$$ because $$e^{\large \frac{i\pi} 2}\neq e^{\large -\frac{i\pi} 2}$$ They differ by a $-$ sign, which is somewhat expected because the two expressions above are both supposed to be a square root of the same number, which is $-\frac12$.

However, in the very special case when the exponent is an integer, then the result does not depend on what choice you make for the logarithm. The definition $a^n=e^{n\ln(a)}$ will output the same result for any choice of logarithm extension, because two different logarithms differ by $2i\pi$ and when $n\in\Bbb N$, $e^{n\cdot 2i\pi}=1$. This unique output, as you would expect, is equal to $$\underbrace{a\times\ldots\times a}_{n\text{ times}}$$