Navigation 
 Home 
 Search 
 Site map 

 Contact Graeme 
 Home 
 Email 
 Twitter

 Skip Navigation LinksMath Help > Geometry > Circles, Conic Sections > Eq of Sphere given 4 points

Previously, we found the equation of a circle, given three points on the circle.  Now I wish to apply a similar method, with one more dimension.  Please take the time to read the method we used for the circle, first, and then you will be in a much better position to appreciate the admittedly somewhat tedious calculations on this page!

Equation of a Sphere, given four points

Problem: Give the general solution to this question:

Find a sphere given 4 points (a1, a2, a3), (b1, b2, b3), (c1, c2, c3), and (d1, d2, d3)

Your answer should be in the form of an equation of the circle centered at point (f1, f2, f3) with radius r, and should look like this:

(x-f1)² + (y-f2)² + (z-f3)² = r²

Solve for f1, f2, f3, and r in terms of a1, a2, a3, b1, b2, b3, c1, c2, c3, d1, d2, and d3.

Solution:

Start with these four equations:

(a1-f1)² + (a2-f2)² + (a3-f3)² = r²
(b1-f1)² + (b2-f2)² + (b3-f3)² = r²
(c1-f1)² + (c2-f2)² + (c3-f3)² = r²
(d1-f1)² + (d2-f2)² + (d3-f3)² = r²

Multiply them out, and you get these four equations, equivalent to the four above:

a1² - 2a1f1 + f1² + a2² - 2a2f2 + f2² + a3² - 2a3f3 + f3² = r²
b1² - 2b1f1 + f1² + b2² - 2b2f2 + f2² + b3² - 2b3f3 + f3² = r²
c1² - 2c1f1 + f1² + c2² - 2c2f2 + f2² + c3² - 2c3f3 + f3² = r²
d1² - 2d1f1 + f1² + d2² - 2d2f2 + f2² + d3² - 2d3f3 + f3² = r²

Multiply the first by (c2 d3 + d2 b3 + b2 c3 - d2 c3 - b2 d3 - c2 b3), the second by (d2 c3 + c2 a3 + a2 d3 - c2 d3 - a2 c3 - d2 a3), the third by (a2 b3 + b2 d3 + d2 a3 - b2 a3 - d2 b3 - a2 d3), and the fourth by (b2 a3 + a2 c3 + c2 b3 - a2 b3 - c2 a3 - b2 c3):

(a1²-2a1f1+f1²+a2²-2a2f2+f2²+a3²-2a3f3+f3²)(c2d3+d2b3+b2c3-d2c3-b2d3-c2b3)=
   r²(c2d3+d2b3+b2c3-d2c3-b2d3-c2b3)
(b1²-2b1f1+f1²+b2²-2b2f2+f2²+b3²-2b3f3+f3²)(d2c3+c2a3+a2d3-c2d3-a2c3-d2a3)=
   r²(d2c3+c2a3+a2d3-c2d3-a2c3-d2a3)
(c1²-2c1f1+f1²+c2²-2c2f2+f2²+c3²-2c3f3+f3²)(a2b3+ b2d3+d2a3-b2a3-d2b3-a2d3)=
   r²(a2b3+b2d3+d2a3-b2a3-d2b3-a2d3)
(d1²-2d1f1+f1²+d2²-2d2f2+f2²+d3²-2d3f3+f3²)(b2a3+a2c3+c2b3-a2b3-c2a3-b2c3)=
   r²(b2a3+a2c3+c2b3-a2b3-c2a3-b2c3)

Multiply out these three equations, then add 'em up.  Amazingly, all the terms with unknowns other than f1 magically disappear, and the f1² terms go away, too.

+c2d3a1²-2c2d3a1f1+c2d3f1²+c2d3a2²-2c2d3a2f2+c2d3f2²+c2d3a3²-2c2d3a3f3+c2d3f3²+c2d3
+d2b3a1²-2d2b3a1f1+d2b3f1²+d2b3a2²-2d2b3a2f2+d2b3f2²+d2b3a3²-2d2b3a3f3+d2b3f3²+d2b3
+b2c3a1²-2b2c3a1f1+b2c3f1²+b2c3a2²-2b2c3a2f2+b2c3f2²+b2c3a3²-2b2c3a3f3+b2c3f3²+b2c3
-d2c3a1²+2d2c3a1f1-d2c3f1²-d2c3a2²+2d2c3a2f2-d2c3f2²-d2c3a3²+2d2c3a3f3-d2c3f3²-d2c3
-b2d3a1²+2b2d3a1f1-b2d3f1²-b2d3a2²+2b2d3a2f2-b2d3f2²-b2d3a3²+2b2d3a3f3-b2d3f3²-b2d3
-c2b3a1²+2c2b3a1f1-c2b3f1²-c2b3a2²+2c2b3a2f2-c2b3f2²-c2b3a3²+2c2b3a3f3-c2b3f3²-c2b3r² = 0
+d2c3b1²-2d2c3b1f1+d2c3f1²+d2c3b2²-2d2c3b2f2+d2c3f2²+d2c3b3²-2d2c3b3f3+d2c3f3²+d2c3
+c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-2a2c3d1f1+a2c3f1²+a2c3d2²-2a2c3d2f2+a2c3f2²+a2c3d3²-2a2c3d3f3+a2c3f3²+a2c3
+c2b3d1²-2c2b3d1f1+c2b3f1²+c2b3d2²-2c2b3d2f2+c2b3f2²+c2b3d3²-2c2b3d3f3+c2b3f3²+c2b3
-a2b3d1²+2a2b3d1f1-a2b3f1²-a2b3d2²+2a2b3d2f2-a2b3f2²-a2b3d3²+2a2b3d3f3-a2b3f3²-a2b3
-c2a3d1²+2c2a3d1f1-c2a3f1²-c2a3d2²+2c2a3d2f2-c2a3f2²-c2a3d3²+2c2a3d3f3-c2a3f3²-c2a3
-b2c3d1²+2b2c3d1f1-b2c3f1²-b2c3d2²+2b2c3d2f2-b2c3f2²-b2c3d3²+2b2c3d3f3-b2c3f3²-b2c3r² = 0
----------------------------------------------------------------------------------
-2c2d3a1f1 + c2d3a1² + c2d3a2² + c2d3a3²
-2d2b3a1f1 + d2b3a1² + d2b3a2² + d2b3a3²
-2b2c3a1f1 + b2c3a1² + b2c3a2² + b2c3a3²
+2d2c3a1f1 - d2c3a1² - d2c3a2² - d2c3a3²
+2b2d3a1f1 - b2d3a1² - b2d3a2² - b2d3a3²
+2c2b3a1f1 - c2b3a1² - c2b3a2² - c2b3a3²
-2d2c3b1f1 + d2c3b1² + d2c3b2² + d2c3b3²
-2c2a3b1f1 + c2a3b1² + c2a3b2² + c2a3b3²
-2a2d3b1f1 + a2d3b1² + a2d3b2² + a2d3b3²
+2c2d3b1f1 - c2d3b1² - c2d3b2² - c2d3b3²
+2a2c3b1f1 - a2c3b1² - a2c3b2² - a2c3b3²
+2d2a3b1f1 - d2a3b1² - d2a3b2² - d2a3b3²
-2a2b3c1f1 + a2b3c1² + a2b3c2² + a2b3c3²
-2b2d3c1f1 + b2d3c1² + b2d3c2² + b2d3c3²
-2d2a3c1f1 + d2a3c1² + d2a3c2² + d2a3c3²
+2b2a3c1f1 - b2a3c1² - b2a3c2² - b2a3c3²
+2d2b3c1f1 - d2b3c1² - d2b3c2² - d2b3c3²
+2a2d3c1f1 - a2d3c1² - a2d3c2² - a2d3c3²
-2b2a3d1f1 + b2a3d1² + b2a3d2² + b2a3d3²
-2a2c3d1f1 + a2c3d1² + a2c3d2² + a2c3d3²
-2c2b3d1f1 + c2b3d1² + c2b3d2² + c2b3d3²
+2a2b3d1f1 - a2b3d1² - a2b3d2² - a2b3d3²
+2c2a3d1f1 - c2a3d1² - c2a3d2² - c2a3d3²
+2b2c3d1f1 - b2c3d1² - b2c3d2² - b2c3d3²=0

Now get all the "f1" terms to one side, and solve:

f1=((a1²+a2²+a3²)(c2d3 + d2b3 + b2c3 - d2c3 - b2d3 - c2b3) +
    (b1²+b2²+b3²)(d2c3 + c2a3 + a2d3 - c2d3 - a2c3 - d2a3) +
    (c1²+c2²+c3²)(a2b3 + b2d3 + d2a3 - b2a3 - d2b3 - a2d3) +
    (d1²+d2²+d3²)(b2a3 + a2c3 + c2b3 - a2b3 - c2a3 - b2c3)) /
           (2(a1)(c2d3 + d2b3 + b2c3 - d2c3 - b2d3 - c2b3) +
             (b1)(d2c3 + c2a3 + a2d3 - c2d3 - a2c3 - d2a3) +
             (c1)(a2b3 + b2d3 + d2a3 - b2a3 - d2b3 - a2d3) +
             (d1)(b2a3 + a2c3 + c2b3 - a2b3 - c2a3 - b2c3))

Solve for f2 and f3 similarly, by "rotating" the coordinates, replacing 1 with 2, 2 with 3, and 3 with 1.

f2=((a2²+a3²+a1²)(c3d1 + d3b1 + b3c1 - d3c1 - b3d1 - c3b1) +
    (b2²+b3²+b1²)(d3c1 + c3a1 + a3d1 - c3d1 - a3c1 - d3a1) +
    (c2²+c3²+c1²)(a3b1 + b3d1 + d3a1 - b3a1 - d3b1 - a3d1) +
    (d2²+d3²+d1²)(b3a1 + a3c1 + c3b1 - a3b1 - c3a1 - b3c1)) /
           (2(a2)(c3d1 + d3b1 + b3c1 - d3c1 - b3d1 - c3b1) +
             (b2)(d3c1 + c3a1 + a3d1 - c3d1 - a3c1 - d3a1) +
             (c2)(a3b1 + b3d1 + d3a1 - b3a1 - d3b1 - a3d1) +
             (d2)(b3a1 + a3c1 + c3b1 - a3b1 - c3a1 - b3c1))

f3=((a3²+a1²+a2²)(c1d2 + d1b2 + b1c2 - d1c2 - b1d2 - c1b2) +
    (b3²+b1²+b2²)(d1c2 + c1a2 + a1d2 - c1d2 - a1c2 - d1a2) +
    (c3²+c1²+c2²)(a1b2 + b1d2 + d1a2 - b1a2 - d1b2 - a1d2) +
    (d3²+d1²+d2²)(b1a2 + a1c2 + c1b2 - a1b2 - c1a2 - b1c2)) /
           (2(a3)(c1d2 + d1b2 + b1c2 - d1c2 - b1d2 - c1b2) +
             (b3)(d1c2 + c1a2 + a1d2 - c1d2 - a1c2 - d1a2) +
             (c3)(a1b2 + b1d2 + d1a2 - b1a2 - d1b2 - a1d2) +
             (d3)(b1a2 + a1c2 + c1b2 - a1b2 - c1a2 - b1c2))

Now, to find r², just plug your f1, f2, and f3 into one of the original equations:

r² = (a1-f1)² + (a2-f2)² + (a3-f3)² 

Related pages in this website

Find the equation of a circle, given three points

Find the points of intersection of two circles.

Find the equations of the (up to) four tangent lines to two circles.


The webmaster and author of this Math Help site is Graeme McRae.