# How could I get the coordinates of the circumscribed circle giving the 3 points coords?

I have the coordinates of 3 points thrgouh which, a circle should pass . Having the coordinates of the points in 3D, how could I have the coordinates of the center of circumscribed circle ? also : if one of the points has some deviations and causes a circumscribed circle couldn't pass through the 3 points, is there a way to determine the required coordinates of the third point in a way that the circle could be constructed to find the deviation in space ?

• A circle can always pass trough 3 points. (Though, because of this its a bit bad for measurement errors) Just look up the geometric construction for on wikipedia. – joojaa Dec 28 '19 at 0:02
• What research did you do and where did you get stuck? – Transistor Dec 28 '19 at 11:40
• There's a clear explanation at Mathematics: math.stackexchange.com/q/213658/88836 – Wasabi Dec 28 '19 at 15:35
• @Wasabi That's a 2D solution. There's a fancy answer here - math.stackexchange.com/questions/1184038/…, by user 115161. But normally we just apply rigid motion transforms to a yield a 2D problem, then reverse the operations to get the 3D solution. – Phil Sweet Dec 29 '19 at 4:30

Solve the following four equations; here, A, B and C are the 3D-vectors of your three points. M is the center of the circle (what you are looking for), r is its unknown radius. x means "vector product".

 (A-M)² = r²
 (B-M)² = r²
 (C-M)² = r²
 ((C-A)x(C-B))(C-M) = 0


The first three equations say that the distance from the each point to the center must be r. These three conditions will, in 3D, have as solution a straight line of the centers of all spheres that go through points A,B,C.

To find the center of a circle, one must force the solution to the plane where A,B,C lie. There are many ways to accomplish this; the following one seems the easiest one: First, one creates the plane's normal vector: Two vectors in the plane are C-A and C-B, and their cross product is a normal vector. To force C-M (and hence M) also into the plane, the scalar product with normal vector must be 0 (so that they are at right angles, i.e., the normal vector of the plane is orthogonal to C-M).

Example:

A=(1,1,1), B=(2,3,1), C=(3,3,2)

M=(x,y,z)

Here are the four equations:

 (1-x)² + (1-y)² + (1-z)² = r²
 (2-x)² + (3-y)² + (1-z)² = r²
 (3-x)² + (3-y)² + (2-z)² = r²

(2,2,1) x (1,0,1) = (2,-1,-2), so
 2(3-x) - (3-y) - 2(2-z) = 0


With all parentheses expanded:

 1-2x+x² +  1-2y+y² + 1-2z+z² = r²
 4-4x+x² +  9-6y+y² + 1-2z+z² = r²
 9-6x+x² +  9-6y+y² + 4-4z+z² = r²
 6-2x    -  3+y     -4+2z     = 0


To get rid of all the squares in ..., subtract subsequent equations:

- is a linear equation in x,y,z

-3+2x -8+4y       = 0


- is also a linear equation in x,y,z

-8+4x -8+4y -3+2z = 0


 is anyway a linear equation in x,y,z

6-2x  - 3+y -4+2z = 0


This is now a simple system of three linear equations with three variables, which is easy to solve. The solution yields the coordinates of M:

x = 13/6, y = 5/3, z = 11/6


r can be computed from any of ...:

r = square root of ((1-13/6)² + (1-5/3)² + (1-11/6)²) = square root of 5/2


And as joojaa pointed out above, you can always find a circle through 3 points (unless they are on a straight line, which will make the equations above unsolvable).