Notes
From analytic geometry, we know that there is a unique sphere that
passes through four noncoplanar points if, and only if, they are
not on the same plane. If they are on the same plane, either there
are no spheres through the 4 points, or an infinite number of them
if the 4 points are on a circle. Given 4 points,
{x_{1}, y_{1}, z_{1}}, {x_{2}, y_{2}, z_{2}}, {x_{3}, y_{3}, z_{3}}, {x_{4}, y_{4}, z_{4}}
how does
one find the center and radius of a sphere exactly fitting those points?
They can be found by solving the following determinant equation:
x^{2}
+ y^{2} + z^{2} 
x_{
} 
y_{
} 
z_{
} 
1

=
0 
x_{1}^{2}
+ y_{1}^{2} + z_{1}^{2}

x_{1}

y_{1}

z_{1}

1

x_{2}^{2}
+ y_{2}^{2} + z_{2}^{2}

x_{2}

y_{2}

z_{2}

1

x_{3}^{2}
+ y_{3}^{2} + z_{3}^{2}

x_{3}

y_{3}

z_{3}

1

x_{4}^{2}
+ y_{4}^{2} + z_{4}^{2}

x_{4}

y_{4}

z_{4}

1 
Evaluating
the cofactors for the first row of the determinant can give us a
solution. The determinant equation can be written as an equation
of these cofactors:
(x^{2} + y^{2} + z^{2})·M_{11}  x·M_{12} + y·M_{13}  z·M_{14} + M_{15} = 0
This can
be converted to the canonical form of the equation of a sphere:
x^{2} + y^{2} + z^{2}  (M_{12}/M_{11})·x + (M_{13}/M_{11})·y  (M_{14}/M_{11})·z + M_{15}/M_{11} = 0
Completing
the squares in x and y and z gives:
x_{0} = 0.5·M_{12}/M_{11}
y_{0} = 0.5·M_{13}/M_{11}
z_{0} = 0.5·M_{14}/M_{11}
r_{0}^{2} = x_{0}^{2} + y_{0}^{2} + z_{0}^{2}  M_{15}/M_{11}
Note
that there is no solution when M_{11} is equal
to zero. In this case, the points are not on a sphere; they may
all be on a plane or three points may be on a straight line.
Copyright © 2004, Stephen R. Schmitt 