Find the equation of a plane containing two points and tangent to a sphere? The plane contains points $A ( p_1, p_2, p_3 )$ and $B ( q_1, q_2, q_3 )$ and is tangent to sphere with centre at $( c_1, c_2, c_3 )$ and radius r? 
Approach: 
Consider the eq of plane: $$a(x-p_1) + b(y-p_2) + c(z-p_3)= 0 \qquad \qquad (eq.1)  $$
The point B lies on the plane, therefore $$ a(q_1-p_1) + b( q_2-p_2 ) + c( q_3-p_3)= 0 \qquad \qquad (eq.2) $$
The normal vector to the plane is given by $$ \hat n= a\hat i + b\hat j +c\hat k \qquad \qquad \qquad \qquad \qquad \qquad \quad \; \; \; (eq.3) $$
And I am stuck at this point. I cannot find a cleaner way to do this as I am given only coordinates not their values?
 A: HINT
To find the planes containing $A$ and $B$ and tangent to the sphere, we can set $ax+by+cz+1=0$ and use


*

*$(a,b,c)\cdot (A-B)=0$

*$A\in$ plane

*tangency condition to the sphere

A: I doubt that there’s a “clean” approach in that any general solution, when expanded, is going to involve rather lengthy algebraic expressions that will only become sources of error. However, it’s certainly possible to more-or-less compute these tangent planes directly by reducing the dimension of the problem.  
Consider the plane $P$ through the sphere’s center $C$ and perpendicular to the line $\overline{AB}$. The intersection of the sphere and tangent planes with $P$ give us a “side view” of the problem, which then becomes one of finding the tangent lines to a circle of radius $r$ from a point at a distance of $d$ from its center, where $d$ is the distance from $C$ to $\overline{AB}$. This distance can be computed  several ways, e.g., $d = {\|(B-A)\times(A-C)\| \over \|B-A\|}$ or $d = {\|(C-A)\times(C-B)\| \over \|B-A\|}$. We may as well place this circle at the origin and the point at $(d,0)$. The endpoints of the chord of contact are easily found to be $\frac rd\left(r,\pm\sqrt{d^2-r^2}\right)$ by comparing similar triangles.   
These tangent points (if any), then need to be mapped back onto the sphere. The required mapping is also easily constructed from the given data. After lifting the tangent points to the $x$-$y$ plane in $\mathbb R^3$, we just need a rotation and translation. Let $\mathbf v = (B-A)\times(C-A)$, normalized. This will be the image of the unit $y$-direction vector. The image $\mathbf u$ of the unit $x$-direction vector is then $(B-A)\times\mathbf v$, also normalized, and the resulting rotation matrix is then $R=\begin{bmatrix}\mathbf u & \mathbf v & \mathbf u\times\mathbf v\end{bmatrix}$, but we don’t really need the third column of this matrix. The mapping $$\begin{bmatrix}\mathbf u & \mathbf v & C \\ 0 & 0 & 1\end{bmatrix} \begin{bmatrix} x \\ y \\ 1 \end{bmatrix} = x\mathbf u+y\mathbf v+C$$ takes points in the reduced 2-D space directly to the corresponding points on $P$ in $\mathbb R^3$.  
Once you have the two points of tangency on the sphere, you have three known points on each tangent plane, so from there you can construct the plane(s) using your favorite method. A direct way to compute them is to use a pole-polar relationship. Working in homogeneous coordinates, the equation of the sphere can be written in the form $\mathbf x^TQ\mathbf x=0$, where $$Q = \begin{bmatrix}1&0&0&-c_1\\0&1&0&-c_2\\0&0&1&-c_3\\-c_1&-c_2&-c_3&c_1^2+c_2^2+c_3^2-r^2\end{bmatrix}.$$ If we represent a plane $ax+by+cz+d=0$ by the homogeneous vector $\mathbf\pi=(a,b,c,d)^T$, then the tangent plane at a point $\mathbf p$ on the sphere is simply $Q\mathbf p$. Combining this with the transformation above, we eventually get the following expression for the tangent planes in terms of $\mathbf u$, $\mathbf v$ and the point-line distance $d$: $$\mathbf\pi = \frac{r^2}d \begin{bmatrix}\mathbf u \\ -\mathbf u^TC\end{bmatrix} \pm \frac rd\sqrt{d^2-r^2} \begin{bmatrix}\mathbf v \\ -\mathbf v^TC\end{bmatrix} + \begin{bmatrix}\mathbf 0 \\ -r^2\end{bmatrix}.$$  
There will be zero, one or two solutions, depending on the sign of $d^2-r^2$. Geometrically, this value tells us whether the line $\overline{AB}$ has two, one or no intersections, respectively, with the sphere.

One can make a similar and slightly less involved direct calculation by using Rodrigues rotation formula with a different rotation. Examining once again the “side view”—the intersection of $P$ with the sphere and tangent planes—we can find that the dihedral angle $\phi$ between a tangent plane and the central plane through points $A$, $B$ and the center $C$ of the sphere satisfies $\sin\phi = r/d$. Rotating this central plane through an angle of $\pm\phi$ about the line $\overline{AB}$ will give us the tangent plane(s). A normal to the central plane is $\mathbf n = (A-C)\times(B-C)$. Setting $\mathbf k = {B-A\over\|B-A\|}$, a unit direction vector of $\overline{AB}$, we can then apply the rotation formula to get $$\begin{align} \mathbf n' &= \mathbf n\cos\phi \pm (\mathbf k\times\mathbf b)\sin\phi + \mathbf k(\mathbf k\cdot\mathbf n)(1-\cos\phi) \\
&= \left(\frac1d\sqrt{d^2-r^2}\right)\mathbf n \pm \frac rd(\mathbf k\times\mathbf n) + \left(1-\frac1d\sqrt{d^2-r^2}\right)(\mathbf k\cdot\mathbf n)\mathbf k\end{align}$$ for the normals to the tangent planes, from which their equations are, in point-normal form, $\mathbf n'\cdot(\mathbf x-A)=0$. If you compare the geometrical meaning of the terms that appear in Rodrigues formula to the vectors computed in the first derivation, you’ll find that they’re parallel: this derivation “factors out” some of the normalization that was required the first way. Of course, if you didn’t happen to know Rodrigues’ formula, you’d have to go through a more involved derivation to compute this rotation, effectively recreating the formula.
