# How to find the coordinates of tangency of an external point to a sphere?

I have a similar problem to this problem. I have to external points A and B and a sphere with radius r. I want to find out the point of tangency T. Below is the illustration:

So far I have applied the sine rule to find out the angle CAT, but not sure on how to make use of it.

Any help is appreciated.

The fact that $T$ lies on the tangent line is characterised by the existence of a real number $t$ such that $$\left(\matrix{x_3\\y_3\\z_3}\right)=\left(\matrix{tx_1+(1-t)x_4\\ty_1+(1-t)y_4\\tz_1+(1-t)z_4}\right)$$
The fact that it is the tangency point is characterised by $CT$ being orthogonal to $AB$. If you write down $$\vec{CT}\cdot\vec {AB}=0$$ you get a linear equation of degree $1$ in $t$.
The solution is $$t=\frac{(x_2-x_4)(x_1-x_4)+(y_2-y_4)(y_1-y_4)+(z_2-z_4)(z_1-z_4)}{(x_1-x_4)^2+(y_1-y_4)^2+(z_1-z_4)^2}$$
The “point” of tangency to a sphere is a circle, specifically, the intersection of the polar plane to $A$ and the sphere. If you have a specific tangent line in mind, then its point of tangency is the intersection of the line and this plane.
Working in homogeneous coordinates and denoting points with lower-case letters, we write the equation of the sphere in matrix form: $$\mathbf x^T C \mathbf x = \begin{bmatrix}x&y&z&1\end{bmatrix} \left[\begin{array}{c|c} I_3 & -\mathbf c \\ \hline -\mathbf c^T & \mathbf c^T\mathbf c-r^2 \end{array}\right] \begin{bmatrix}x\\y\\z\\1\end{bmatrix} = 0.$$ The polar plane of the point $\mathbf a$ is then $C\mathbf a$ and the intersection with the line through $\mathbf a$ and $\mathbf b$ can be computed directly using the Plücker matrix $\mathbf a\mathbf b^T-\mathbf b\mathbf a^T$ of the line as $$\mathbf t = (\mathbf b^TC\mathbf a)\mathbf a - (\mathbf a^TC\mathbf a)\mathbf b.$$ Divide through by the last coordinate to convert back into inhomogeneous Cartesian coordinates.