[Math] Distance from a sphere to a plane

calculus

If I have a sphere $x^2+y^2+z^2=R^2$ and a plane $ax + by + cz = k$,
how do I find the distance between them?

This is what I have so far and I'm right.
Let C be the centre of the sphere, (0,0,0) and the $\vec{n}=\langle a,b,c\rangle$.
The equation of the line from C to a point on the plane P that is perpendicular to the plane is $x=at, y=bt, z=ct$.
So I substitute these equations into $ax + by + cz = k$.

$a(at)+b(bt)+c(ct)=k \\
=a^2t+b^2t+c^2t=k \\
=t(a^2+b^2+c^2)=k \\
t\Vert \vec{CP} \Vert^2=k$

Is this correct so far. I also know that I have to subtract $R^2$ from it but not sure really where to go from here, what actually the k represents in this instance.
Any help would be appreciated.

Best Answer

You're on the right track. Without loss of generality we may assume that $k\geq 0$. You've started in $CP=t\vec n$ and arrived in $t=k/\|\vec n\|^2$. Hence $CP=\frac{k}{\|\vec n\|^2}\vec n$. It's length is $k/\|\vec n\|$, which is the plane's distance from the origin.