Drexel dragonThe Math ForumDonate to the Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math


Date: 08/16/97 at 21:28:11
From: Andrew Pomerance
Subject: Exponentiation

How do I calculate x^y using only exp, ln, log, and the trigonometric 
functions?  I know exp(y*ln(x)) works, but only for x > 0.

Date: 08/21/97 at 16:29:28
From: Doctor Rob
Subject: Re: Exponentiation

The key is DeMoivre's Law:

e^(i*t) = cos(t) + i*sin(t),

where i is the square root of -1, that is, i^2 = -1.  Even if x and y 
are real, ln(x) may not be, because x may be negative.  What is ln(x)?
It is a number z such that x = exp(z).  In fact, there may be several
values of z that work.  From DeMoivre's Law, we see that

   -1 = cos(Pi) + i*sin(Pi) = e^(i*Pi),

so ln(-1) = i*Pi.  This is not the only answer, however!  It is true 

   -1 = cos(Pi + 2*Pi*k) + i*sin(Pi + 2*Pi*k) = e^(i*Pi*[2*k+1]),

so ln(-1) = i*Pi*(2*k+1), for any integer k.  This should remind you
of inverse trigonometric functions, which also have multiple values.
Using this fact, and the definition you started with, x^y = e^(y*
ln(x)), and the properties of logarithms, you should be able to define 
x^y for all real x and y now.

Let's try

   (-2)^(1/2) = e^((1/2)*ln(-2))
              = e^([ln(-1) + ln(2)]/2)
              = e^([i*Pi + 2*Pi*i*k + ln(2)]/2)
              = e^(i*Pi/2 + Pi*i*k + ln(2)/2)
              = [cos(Pi/2 + Pi*k) + i*sin(Pi/2 + Pi*k)]*2^(1/2)
              = [0 + i*(-1)^k]*2^(1/2)
              = (-1)^k*i*Sqrt[2]
              = + or - i*Sqrt[2]

This seems to make sense.  You even get both signs!

Furthermore, this same method can be used to define x^y when both
are complex numbers, although it may be a multi-valued "function."

   i^i = e^(i*ln(i)),
       = e^[i*(Pi*i/2 + 2*Pi*i*k)], for any integer k
                  (because  e^(Pi*i/2) = cos(Pi/2) + i*sin(Pi/2) = i),
       = e^[-Pi/2 - 2*Pi*k], for any integer k.

It seems paradoxical that i^i should be real, but that is correct.

-Doctor Rob,  The Math Forum
 Check out our web site!  http://mathforum.org/dr.math/   
Associated Topics:
College Imaginary/Complex Numbers

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.