Associated Topics || Dr. Math Home || Search Dr. Math

### Finding Arctan of a Complex Number

```Date: 08/18/2008 at 14:19:29
From: BCox
Subject: Arctan(x+iy)= Real() + Im()

Can we separate the real and imaginary parts of arctan(x+iy)
expression?  I am not sure how to answer this using

Asin/acos/atan for Complex Numbers
http://mathforum.org/library/drmath/view/52235.html

We have that Arctan(x+iy) = -i*Arctanh(ix-y)

This is only useful if we already knew how to separate the real from
the imaginary part of Arctanh(ix-y).

so that if

theta = arctan( x+iy  /  v+iw )
= arctan [ (x+iy)(v-iw) / (v^2+w^2) ]
= arctan [ (xv+yw)/(v^2+w^2) + i (yv-wx)/(v^2+w^2) ]
= ?

(i/2)log{ (xv+yw)/(v^2+w^2) + i* [1+(yv-wx)/(v^2+w^2)] }
-(i/2)log{ -(xv+yw)/(v^2+w^2) + i* [1-(yv-wx)/(v^2+w^2)] }

```

```
Date: 08/23/2008 at 15:49:37
From: Doctor Vogler
Subject: Re: Arctan(x+iy)= Real() + Im()

Hi,

Thanks for writing to Dr. Math.  Using the method from the article you
referenced, we would solve for arctan(x+iy) as follows.  First let's write

z = x + iy

and do the first part in complex numbers, and we'll also write

w = arctan(x + iy)

so that

tan(w) = z

and we want to solve for w.  So first we use

sin(w) = (e^(iw) - e^(-iw))/(2i)

and

cos(w) = (e^(iw) + e^(-iw))/2

to get

tan(w) = (e^(iw) - e^(-iw))/(i(e^(iw) + e^(-iw)))

Letting p = e^(iw), so that 1/p = e^(-iw), the equation

tan(w) = z

becomes

(p - 1/p)/(i(p + 1/p)) = z
(p^2 - 1)/(p^2 + 1) = iz
p^2 - 1 = iz(p^2 + 1)
(1 - iz)p^2 = 1 + iz
p^2 = (1 + iz)/(1 - iz)

which is equivalent to

e^(2iw) = (1 + iz)/(1 - iz).

So the solution for w is

w = 1/(2i) * ln ((1 + iz)/(1 - iz)).

Now, to get the real and imaginary parts of this, you need the real
and imaginary parts of the natural logarithm.  You do this by thinking
in terms of converting between polar and rectangular coordinates, since

e^(x + iy) = e^x * cos y + i * e^x * sin y.

Namely, the real part of ln(z) is ln |z|, the natural logarithm of the
absolute value (a.k.a. norm or modulus) of z, or

re(ln(z)) = ln |z| = ln sqrt(re(z)^2 + im(z)^2)
= (1/2) ln (re(z)^2 + im(z)^2).

The imaginary part is the angle at which z is found, which is either

arctan( im(z)/re(z) ),

plus any integer multiple of 2*pi, when re(z) > 0, or

pi + arctan( im(z)/re(z) ),

plus any integer multiple of 2*pi, when re(z) < 0; when re(z) = 0, it
is pi/2 when im(z) > 0, or -pi/2 when im(z) < 0.  You can alternately
compute

pi/2 - arctan( re(z)/im(z) ),

when im(z) > 0, or

-pi/2 - arctan( re(z)/im(z) ),

when im(z) < 0, and then when im(z) = 0, you take 0 for re(z) > 0 and
pi for re(z) < 0.

Now, let's put all this together:  First you have

z = x + iy

and you need to take the log of

(1 + iz)/(1 - iz) = (1 + ix - y)/(1 - ix + y)
= (1 - y + ix)(1 + y + ix)/((1 + y)^2 + x^2)
= (1 - x^2 - y^2 + 2ix)/((1 + y)^2 + x^2).

So the real part of the log is

(1/2) ln ( (1 - x^2 - y^2)^2 + (2x)^2 ) - ln ( (1 + y)^2 + x^2 ).

Since the sign of the imaginary part of the complex number whose log
you are taking is the same as the sign of x, the imaginary part of the
log is

pi/2 - arctan ( (1 - x^2 - y^2)/(2x) )

when x > 0, or

-pi/2 - arctan ( (1 - x^2 - y^2)/(2x) )

when x = 0, or

0

when x = 0 and 1 > x^2 + y^2, or

pi

when x = 0 and 1 < x^2 + y^2, plus any integer multiple of 2*pi.

Finally, we multiply this log by 1/(2i), and we get

im(arctan(x + iy)) =
-(1/4) ln ((1 - x^2 - y^2)^2 + (2x)^2) + (1/2) ln ((1 + y)^2 + x^2)

and

re(arctan(x + iy)) = pi/4 - (1/2) arctan ( (1 - x^2 - y^2)/(2x) )

when x > 0, or

re(arctan(x + iy)) = -pi/4 - (1/2) arctan ( (1 - x^2 - y^2)/(2x) )

when x < 0, or

re(arctan(x + iy)) = 0

when x = 0 and -1 < y < 1, or

re(arctan(x + iy)) = pi/2

when x = 0 and 1 < y^2, where each of these real parts can be
increased by any integer multiple of pi (which makes perfect sense,
since it is well-known that tan(x + n*pi) = tan(x)).  Note that tan(z)
can never equal i or -i, so arctan(i) and arctan(-i) are undefined.

back and show me what you have been able to do, and I will try to
offer further suggestions.

- Doctor Vogler, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
College Imaginary/Complex Numbers
College Trigonometry

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
Math Forum Home || Math Library || Quick Reference || Math Forum Search