The function $f(x) = a^x$ is generally taught to only allow $a > 0$. This is usually justified by giving a few examples of complex points in cases where $a < 0$. For example:
$f(x) = (-2)^x$, if $x = 0.5, f(x)=sqrt(-2)$, which of course is $0+sqrt(2)i$, a complex number. That being said, can't any number be approximated using odd denominators, and thus be put in the function?
Example:
$x=3/4$ can be approximated using increasingly large powers of 3 in the denominator
$2/3<x<3/3$
$6/9<x<7/9$
$20/27<x<21/27$
and so on, in this way a real value of $f(x)$ can be always determined for any real $x$, even if $a<0$.
So why do teachers and graphing software refuse to consider $f(x)=(-e)^x$ (or similar) as functions?

- 35
2 Answers
Even though another answer has already been accepted, I'm posting this answer as I believe the previously accepted answer to be at least partially incorrect which is illustrated by the following table of evaluations
$$\begin{array}{cc} x & (-2)^x \\ 1 & -2. \\ 2 & 4. \\ \frac{3}{2} & 0.\, -2.82843 i \\ \frac{5}{3} & 1.5874\, -2.74946 i \\ \frac{8}{5} & 0.936764\, -2.88306 i \\ \frac{13}{8} & 1.18036\, -2.84963 i \\ \end{array}$$
whereas $(-2)^{\phi}\approx 1.11233\, -2.86093 i$.
Also, the previously accepted answer didn't seem to specifically address the question which as I understand it is for example whether $\Re\left((-2)^{3/4}\right)$ could be approximated by $-(2)^{a/b}$ where $\frac{a}{b}$ is a rationale approximating $\frac{3}{4}$ and $b$ is odd. I believe this approach is misguided which is illustrated by the following table of evaluations
$\begin{array}{cccc} n & x=\frac{a}{3^n} & \frac{3}{4}-x & -2^x \\ 1 & \frac{2}{3} & \frac{1}{12} & -1.5874 \\ 2 & \frac{7}{9} & -\frac{1}{36} & -1.71449 \\ 3 & \frac{20}{27} & \frac{1}{108} & -1.67103 \\ 4 & \frac{61}{81} & -\frac{1}{324} & -1.68539 \\ 5 & \frac{182}{243} & \frac{1}{972} & -1.68059 \\ 6 & \frac{547}{729} & -\frac{1}{2916} & -1.68219 \\ 7 & \frac{1640}{2187} & \frac{1}{8748} & -1.68166 \\ 8 & \frac{4921}{6561} & -\frac{1}{26244} & -1.68184 \\ 9 & \frac{14762}{19683} & \frac{1}{78732} & -1.68178 \\ 10 & \frac{44287}{59049} & -\frac{1}{236196} & -1.6818 \\ 100 & \frac{386533140549008498277345847324215954526580641501}{515377520732011331036461129765621272702107522001} & -\frac{1}{2061510082928045324145844519062485090808430088004} & -1.68179 \\ \end{array}$
whereas $(-2)^{3/4}\approx -1.18921+1.18921 i$.
For $a>0$, the function $f_a(x)=(-a)^x$ can be evaluated as
$$f_a(x)=a^x\, e^{i \pi x}=a^x\, (\cos(\pi x)+i\, \sin(\pi x))\,,\quad a>0\tag{1}$$
which leads to
$$\Re(f_a(x))=a^x\, \cos(\pi x)\,,\quad a>0\land x\in\mathbb{R}\tag{2}.$$

- 7,363
-
Oops. I fixed my obvious arithmetic error in $\sqrt{-8}$. We still differ on some other results, but that's because I chose to evaluate $(-2)^{p/q}$ as $\sqrt[q]{(-2)^p}$ instead of as $\exp(\frac{p}{q} \log(-2))$. The former is more intuitive for algebra students, but the latter is what calculators tend to use. – Dan Aug 31 '23 at 15:39
-
@Dan You need to use formula (1) above which provides the correct and unambiguous result. I think choosing to evaluate differently will just mislead others that are already confused on the power function which can also be defined as the Maclaurin series $z^s=\sum\limits_{k=0}^{\infty} \frac{\log^k(z)}{k!}, s^k$. – Steven Clark Aug 31 '23 at 16:02
Let's consider the expression $(-2)^{\phi}$, where $\phi = \frac{1 + \sqrt2}{2} \approx 1.618034$ is the Golden Ratio. I picked $\phi$ because it has a conveniently-described series of fractional approximations: The ratio of consecutive Fibonacci numbers.
Let $\frac{p}{q}$ be a rational approximation of $\phi$. Then $(-2)^{\phi}$ can be approximated by $(-2)^{p/q} = \sqrt[q]{2^p}$. This gives us the approximation sequence
$$(-2)^{1/1} = -2$$ $$(-2)^{2/1} = 4$$ $$(-2)^{3/2} = \sqrt[]{-8} = -2.828427i$$ $$(-2)^{5/3} = \sqrt[3]{-32} \approx -3.174802$$ $$(-2)^{8/5} = \sqrt[5]{256} \approx 3.031433$$ $$(-2)^{13/8} = \sqrt[8]{-8192} \approx 2.849634 + 1.180357i$$
If you continue this series, you'll find that the magnitude of the numbers converges to $2^\phi \approx 3.069565$, but the direction ($\theta$) on the complex plane jumps around wildly. If $p$ happens to be even, you get a positive number for $2^p$ and thus a real number for $2^{p/q}$. But if $p$ is odd, then $2^{p/q}$ might be negative or complex. Which makes it hard to pin down the limit of the sequence.
Now, there are some calculators and programming languages that will let you just evaluate $(-2)^\phi$ directly.
>>> (-2)**1.618033988749895
(1.1123331010556903-2.8609336481188627j)
But understanding that requires knowing calculus and Euler's formula and branch cuts, as I've explained in my most popular answer on this site. And as far as I can tell from your comments, you're only in Algebra II or Precal. So your teacher is just giving the standard response to problems that require math you haven't learned yet: Don't do that.

- 14,978
-
I have no idea if I’m in Algebra II or anything else because in Italy we use a different system. Thank you! – fedsavi Aug 30 '23 at 20:55
-
@fedsavi: No problem. Point is, think of "you can't raise a negative number to a real power" as one of those simplifying lies like "you can't subtract a big number from a small number" (until you learn about negatives) or "you can't take the square root of a negative number" (until you learn about imaginary numbers). – Dan Aug 30 '23 at 22:55