How do I calculate the equation of a circle given 3 complex numbers? Given three complex values (for example, $2i, 4, i+3$), how would you calculate the equation of the circle that contains those three points?  I know it has something to do with the cross ratio of the three points and $z$ and the fact that the cross ratio is a real number, but I don't know what to do with that information.
 A: Might as well flesh out Theo's comments a bit...
If you have four points $z_i,\quad i=1\dots4$, in the following configuration:

the cross ratio of these four points is
$$\Delta=\frac{z_1-z_3}{z_1-z_4}\left(\frac{z_2-z_3}{z_2-z_4}\right)^{-1}$$
If $\Delta$ is real, this means that
$$\arg\left(\frac{z_1-z_3}{z_1-z_4}\right)-\arg\left(\frac{z_2-z_3}{z_2-z_4}\right)=0$$
Interpreted geometrically, the angles $\angle z_3 z_1 z_4$ and $\angle z_3 z_2 z_4$ are congruent, and must thus be inscribed angles in a circle; i.e. all four points are concyclic.
If we let $z_4$ be a variable point $z$ tracing the circle and $\Delta$ be a varying parameter, we obtain an equation for the circle through $z_1,z_2,z_3$:
$$\Delta=\frac{z_1-z_3}{z_1-z}\left(\frac{z_2-z_3}{z_2-z}\right)^{-1}$$
Solving for $z=x+iy$ gives
$$z=\frac{z_2(z_1-z_3)-z_1(z_2-z_3)\Delta}{z_1-z_3-(z_2-z_3)\Delta}$$
which as Theo says is a Möbius transformation. Taking real and imaginary parts and eliminating $\Delta$ should yield a Cartesian equation. (Obtaining the center and radius of this circle is a bit messy and is left as an exercise in algebraic manipulation.)
A: "Might as well flesh out" @Dinesh's comment.
This solution uses algebraic manipulations and consideration of the geometry of the figures. [A more concise solution might leverage vector formality.]
The solution is the equation in the form (x-h)^2+(y-k)^2=r^2, where we give the values of the 3 parameters, h, k, and r.
First, we convert to Cartezian coordinates:
2i -> (0,2)
4 -> (4,0)
i+3 -> (3,1)

1 -- To find the center of the circle (h,k), we need the equations of two lines that are perpendicular bisectors of any two of the sides of the implied triangle above. The intersection of these lines is the center of the circle.
2 -- A perpendicular bisector will have a slope, M, of -1/m, where m is the slope of the corresponding side of the triangle. We get the slope of a side, m, easily from the two given points for that side. We also can easily derive a point, P, on the perpendicular bisector: the midpoint of the side of the triangle. With a point and slope we essentially have the line equations we need.
3 -- To get the length of the radius, r, we compute the distance between the center of the circle and any of the points on the circle.
The perpendicular bisectors of the sides of a triangle intersect in the center of the circumscribing circle of that triangle. The proof is easy, as we note that every point along one of these perpendicular bisectors is equidistance from each of the two points that form the ends of the corresponding triangle side. Thus, the center of this circle (being the intersection of these perpendicular bisectors) has the property that it is equidistant from each of the 3 points, ie, it is a circumscribing circle. Note that given any 3 points, there is a single triangle implied by them (so we can use the perpendicular bisector argument to conclude that a single circle exists).
Now, for key calculations:
2:
m_1 = (0-1)/(4-3) = -1
m_2 = (2-1)/(0-3) = - 1/3
M_1 = -1/(-1) = 1
M_2 = -1/(-1/3) = 3
P_1 = ( (4+3)/2 , (0+1)/2 ) = (7/2,1/2)
P_2 = ( (0+3)/2 , (2+1)/2 ) = (3/2,3/2)

1:
EQN_1
P_1y = (M_1)(P_1x) + B_1
1/2 = (1)(7/2) + B_1
B_1 = -3

Y = X - 3

EQN_2
P_2y = (M_2)(P_2x) + B_2
3/2 = (3)(3/2) + B_2
B_2 = -3

Y = 3X - 3

Intersection
X - 3 = 3X - 3
X = 0

Y = (0) - 3
Y = -3

Thus, h = 0 and k = -3
3:
We can calculate distance from (h,k) to (0,2)
r = sqrt [ (0 - 0)^2 + (-3 - 2)^2 ]
r = 5

More specifically, the equation of the circle is:
(x)^2 + (y + 3)^2 = 25

A: This worked for me in python:
def three_point_circle(z1,z2,z3):
    a = 1j*(z1-z2)
    b = 1j*(z3-z2)
    if a.real:
        m1 = a.imag/a.real
        c = (z1-z2)/2
        p1 = z2+c
        b1 = p1.imag-m1*p1.real
    if b.real:
        m2 = b.imag/b.real
        d = (z3-z2)/2
        p2 = z2+d
        b2 = p2.imag-m2*p2.real
    if a.real and b.real:
        x = (b2-b1)/(m1-m2)
        y = (m2*b1-m1*b2)/(m2-m1)
    elif a.real:
        x,y = 0,b1
    elif b.real:
        x,y = 0,b2
    else:
        x,y = 0,0
    center = x+1j*y
    radius = abs(center-z1)
    return x,y,radius

In a script I uploaded here:
https://github.com/peawormsworth/tools/blob/master/three_point_circle/three_point_circle.py
To produce images like these:

Update: I have not tested the special cases in this code. But maybe if the points are in a line, the circle is also and radii are irrelevant.
