We are given four spheres Sk, k=1..4, with centers sk and radii rk, and seek to determine all lines L that are tangent to those four spheres. The problem arises, for example, in spatial geometric constraint solving, either as stated, or else when we seek to construct a line L that is to have a specific distance rk from known points sk, where k=1...4. We prove that there can be up to 12 such tangents in general, using the method of  and refer to a recent result  that shows that this bound is exact.
Assume that L has the coordinates (x,y,z;u,v,w), where (x,y,z) is the point of L closest to the origin and (u,v,w) is the line direction vector. Note that the same line in the opposite direction has the coordinates (x,y,z;-u,-v,-w). Now choose a coordinate system in which the first sphere has its center s1=(0,0,0) at the origin, the second sphere has s2=(a,0,0) on the x-axis, the center s3=(b,c,0) is in the xy-plane, and the center s4=(d,e,f) is in general position. We obtain six equations that express the constraints on the line L, namely:
where Rk = rk2.
The algebraic degree of that system is 64. Furthermore, note that if (x,y,z;u,v,w) is a solution of the system, then so is (x,y,z;-u,-v,-w).
We can use equations (2), (3) and (4) to solve for x, y, and z. We obtain the following expressions:
|z=||-(K0 + K1uv + 2acefvw + 2acdfuw + K2u2 + K3v2 + acf2w2) / (2fac)|
|K0=||ace2+dcR0-dcR1+dca2 -acd2+aeR0-aeR2+aec2-ebR0+ebR0-eba2 +aeb2-acR0+acR3-acf2|
|K1=||2acde - 2abce|
|K2=||acd2 - dca2 - aeb2 + bea2|
|K3=||ace2 - aec2|
Substituting them into equations (1), (5) and (6) results in three equations in the unknowns u, v, and w, where the algebraic degrees are 4, 3, and 2, respectively. Thus, the new system has a total degree of 24.
Note that in the expressions for x, y, and z the variables u, v, and w appear only quadratically. Therefore, the new system also has the property that for each solution (x,y,z;u,v,w) there is a solution (x,y,z;-u,-v,-w). Therefore, at most 12 geometrically distinct tangents can exist.
In , the authors consider the case of equal radii and analyze both the general position and the degenerate positions. They give an example of four unit spheres that are centered at the vertices of a tetrahedron and have exactly 12 real tangents. Therefore, the bound of 12 tangents is exact.