Geometry of Complex Arithmetic

by George Beck

The basic functions and arithmetic operations on complex numbers are discussed from the point of view of geometry.

Basic functions

Use BasicFunctions on your favorite complex number.

BasicFunctions[1 + 2 I];

Addition

Add the real parts and the imaginary parts separately.

(2 + 3 I) + (-3 + I)

Complex numbers are added together just as if they were vectors. This shows that complex numbers are added geometrically using the parallelogram law.

ComplexSum[2 + 3 I, -3 + I];

If the numbers are almost equal the parallelogeam is almost completely collapsed and the complex number is approximately doubled.

ComplexSum[2 + 3 I, 2.1 + 3 I];

If one number is almost the negative of the other then the sum is close to zero.

ComplexSum[2 + 3 I, -2.1 - 3 I];

Multiplication

The triangles {0, 1, w} and {0, z, w z} are similar, meaning their angles are equal.

ComplexProduct[2 + 3 I, 1 + 2 I];

Switching the order of the multiplication gives the same result. 
The triangles {0, 1, z} and {0, w, z w} are also similar.

ComplexProduct[1 + 2 I, 2 + 3 I];

Multiplying by I, the square root of -1, amounts to a rotation by 90 degrees.

ComplexProduct[2 + 3 I, I];

Similarly, multiplying by -1 amounts to a rotation by 180 degrees.

ComplexProduct[2 + 3 I, -1];

Multiplying by -I amounts to a clockwise rotation by 90 degrees.

ComplexProduct[2 + 3 I, -I];

A number times its reciprocal gives 1.

ComplexProduct[2 + 3 I, 1 / (2 + 3 I)];

The reciprocal of a complex number

If the number is on the unit circle , the reciprocal is its conjugate.

ComplexReciprocal[.6 + .8 I];

If the number is outside the unit circle:
1. Draw the tangents to the circle from that point. 
2. Draw the line m joining the points where the tangents touch the circle.
3. Find the point of intersection m with the line joining the original point to the origin. 
4. Reflect this point across the x axis.

ComplexReciprocal[1 + 3 I];

If the number is inside the unit circle:
1. Draw the perpendicular through the complex number to the line joining the complex number to the origin. 
2. Find the points of intersection of this line with the unit circle. 
3. Draw the two tangents to the unit circle at these two points.
4. Reflect the point where the tangents intersect across the x axis.

ComplexReciprocal[.5 +.2 I];

If the number is close to the real x axis then so is the reciprocal.

ComplexReciprocal[2 + .1 I];

The reciprocal of I is -I.

ComplexReciprocal[1.1 I];

The reciprocal of 1 is 1.

ComplexReciprocal[1.1 + .1 I];

The reciprocal of -1 is -1.

ComplexReciprocal[-1.1 + .1 I];

Be careful with the reciprocal of small numbers close to zero.

ComplexReciprocal[.1 I];

Powers

The powers of a number outside the unit circle spiral away from the origin.

ComplexPowers[.8 (1 + I), 7];

The powers of a complex number on the unit circle stay on the unit circle.

z = Cos[ 2. ] + I Sin[ 2. ];
ComplexPowers[z, 15];

If the argument  is a fraction of 2 pi and the absolute value is 1, the powers form a regular polygon.

z = Cos[ 2 N[Pi]/9 ] + I Sin[ 2 N[Pi]/9 ];
ComplexPowers[z, 9];

The powers of a number inside the unit circle spiral towards the origin.

ComplexPowers[.5 + .8 I, 9];

Roots (not implemented yet)

Implementation

Usage messages (not done yet)

ToPoint::usage = "ToPoint[z] ... .";

Definitions

(* Put in Print statements or labels for w+z, w z, etc.? *)

Needs["Graphics`Colors`"]

ToPoint[z_?NumberQ] := {Re[z], Im[z]}

PolarForm[z_?NumberQ /; z != 0] := {Abs[z], Arg[z]}

BasicFunctions[z_?NumberQ] := Module[
{p0, p1, pz, pc, px, py, a, na, arg, arc, 
		xmin, ymin, xmax, ymax, axisbound},
	(* make the following Print statements 
		into labels on the graph. *)
	Print["The complex number is:: ", z];
	Print["The real part is: ", Re[z]];
	Print["The imaginary part is: ", Im[z]];
	Print["The conjugate is: ", Conjugate[z]];
	Print["The absolute value (or modulus) is: ", Abs[z]];
	Print["The argument (or amplitude) is: ", Arg[z]];
	p1 = {1, 0};
	pz = ToPoint[z];
	pc = ToPoint[Conjugate[z]];
	px = {Re[z], 0};
	py = {0, Im[z]};
	a = Abs[z];
	na = N[a];
	arg = Arg[z];
	arc = Circle[p0, na/3, {0, arg}];
	xmin = Min[-1, Map[First, {pz, pc}]];
	ymin = Min[-1, Map[Last , {pz, pc}]];
	xmax = Max[ 1, Map[First, {pz, pc}]];
	ymax = Max[ 1, Map[Last , {pz, pc}]];
	axisbound = 1.1 Max[Map[Abs, 
		{xmin, xmax, ymin, ymax}]];
	Show[
		Graphics[{
			Green, 
			Line[{{-axisbound, 0}, {axisbound, 0}}],
			Line[{{0, -axisbound}, {0, axisbound}}],
			Blue, 
			Line[{p0, pz}], Line[{px, pz}], Line[{py, pz}], 
			arc, 
			AbsolutePointSize[5], 
			Green, Point[p0], Point[p1], 
			AbsolutePointSize[4], 
			Red, Map[Point, {px, py, pz, pc}],
			Point[psum]
		}],
		AspectRatio -> Automatic, 
		PlotRange -> All
	]
]

ComplexSum[w_?NumberQ, z_?NumberQ] := Module[
	{p0, p1, pw, pz, psum, xmin, ymin, xmax, ymax},
	p0 = {0, 0};
	p1 = {1, 0};
	pw = ToPoint[w];
	pz = ToPoint[z];
	psum = ToPoint[w + z];
	xmin = Min[-1, Map[First, {pw, pz, psum}]];
	ymin = Min[-1, Map[Last , {pw, pz, psum}]];
	xmax = Max[ 1, Map[First, {pw, pz, psum}]];
	ymax = Max[ 1, Map[Last , {pw, pz, psum}]];
	Show[
		Graphics[{
			Green, 
			Line[1.1 {{xmin, 0}, {xmax, 0}}],
			Line[1.1 {{0, ymin}, {0, ymax}}],
			Blue, 
			Line[{p0, pz, psum, pw, p0}], 
			AbsolutePointSize[5], 
			Green, Point[p0], Point[p1], 
			AbsolutePointSize[4], 
			Blue, Point[pw], Point[pz], 
			Red, Point[psum]
		}],
		AspectRatio -> Automatic, 
		PlotRange -> All
	]
]

ComplexProduct[w_?NumberQ, z_?NumberQ] := Module[
	{p0, p1, pw, pz, pwz, xmin, ymin, xmax, ymax},
	p0 = {0, 0};
	p1 = {1, 0};
	pw = ToPoint[w];
	pz = ToPoint[z];
	pwz = ToPoint[w z];
	xmin = Min[-1, Map[First, {pw, pz, pwz}]];
	ymin = Min[-1, Map[Last , {pw, pz, pwz}]];
	xmax = Max[ 1, Map[First, {pw, pz, pwz}]];
	ymax = Max[ 1, Map[Last , {pw, pz, pwz}]];
	Show[
		Graphics[{
			Green, 
			Line[1.1 {{xmin, 0}, {xmax, 0}}],
			Line[1.1 {{0, ymin}, {0, ymax}}],
			Circle[{0, 0}, 1], 		
			Blue, 
			Line[{p0, p1, pw, p0}], 
			Line[{p0, pz, pwz, p0}], 
			AbsolutePointSize[5], 
			Green, Point[p0], Point[p1], 
			AbsolutePointSize[4], 
			Blue, Point[pw], Point[pz], 
			Red, Point[pwz]
		}],
		AspectRatio -> Automatic, 
		PlotRange -> All
	]
]

ComplexReciprocal[z_?NumberQ /; z != 0] := Module[
	{p0, p1, pz, pc, pr, pw, 	(* pairs of numbers *)
		x, y, 	(* dummy variables for NSolve *)
		w, 		(* the center of the outside circle *)
		pa, pb, (* the tangent  points *)
		c, 		(* the conjugate reciprocal of z *) 
		r 		(* the reciprocal of z *), 
		xmin, ymin, xmax, ymax},
	p0 = {0, 0};
	p1 = {1, 0};
	pz = ToPoint[z];
	c = 1 / Conjugate[z];
	pc = ToPoint[c];
	pr = ToPoint[1 / z];
	w = .5 If[N[Abs[z]] <= 1, c, z];
	pw = ToPoint[w];
	{pa, pb} = {x, y} /. NSolve[
		{
			(x - Re[w])^2 + (y - Im[w])^2 == N[Abs[w]]^2,
			x^2 + y^2 == 1
		},
		{x, y}
	]; 	
	xmin = Min[-1, Map[First, {pz, pc, pr}]];
	ymin = Min[-1, Map[Last , {pz, pc, pr}]];
	xmax = Max[ 1, Map[First, {pz, pc, pr}]];
	ymax = Max[ 1, Map[Last , {pz, pc, pr}]];
	Show[
		Graphics[{
			Green, 
			Line[1.1 {{xmin, 0}, {xmax, 0}}],
			Line[1.1 {{0, ymin}, {0, ymax}}],
			Circle[{0, 0}, 1], 		
			Blue,  
			Circle[pw, Abs[w]],
			Line[{2 pw, p0}], 
			Line[{pz, pa}], Line[{pz, pb}], 
			Line[{pc, pa}], Line[{pc, pb}], 
			Line[{pa, pb}], 
			AbsolutePointSize[5], 
			Green, Point[p0], Point[p1], 
			AbsolutePointSize[4],  
			Red, Map[Point, {pz, pc, pa, pb, pr}]
		}],
		AspectRatio -> Automatic, 
		PlotRange -> All
	]
]

ComplexPowers[z_?NumberQ, n_?IntegerQ /; n >= 0] := Module[
	{p0, p1, powers, xmin, ymin, xmax, ymax},
	p0 = {0, 0};
	p1 = {1, 0};
	powers = Map[ToPoint, z ^ Range[0, n]];
	xmin = Min[-1, Map[First, powers]];
	ymin = Min[-1, Map[Last , powers]];
	xmax = Max[ 1, Map[First, powers]];
	ymax = Max[ 1, Map[Last , powers]];
	Show[
		Graphics[{
			Green, 
			Line[1.1 {{xmin, 0}, {xmax, 0}}],
			Line[1.1 {{0, ymin}, {0, ymax}}],
			Circle[{0, 0}, 1], 		
			Blue, Line[powers], 
			Map[Line[{p0, #}]&, powers], 
			AbsolutePointSize[5], 
			Point[p0], Point[p1], 
			AbsolutePointSize[4],  
			Red, Map[Point, powers]
		}],
		AspectRatio -> Automatic, 
		PlotRange -> All
	]
]