<s>[INST] What am I doing wrong to finding the perpendicular distance between a point and a plane? From this post How to prove that a plane is a tangent plane to a sphere?, I went and attempted to show that $4x+3z+29=0$ is tangent to the sphere $(x+1)^2+(y-3)^2+z^2=25$. However I keep getting a different distance from the plane to the centre, the goal being to show that the distance between the plane and the centre is equal to the radius.
To find the distance of the plane from $(-1,3,0)$ I did the following:
The normal vector to the plane is $\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}$. Another random point on the plane is $(-2,0,-7)$. This means the vector from that random point to the centre is $\begin{bmatrix}
1 \\3\\7\\\end{bmatrix}$. So from what I know, the perpendicular distance should then be the length of the projection of $\begin{bmatrix}
1 \\3\\7\\\end{bmatrix}$ onto $\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}$. However when I do that I get:
$\left|\frac{\begin{bmatrix}
1 \\3\\7\\\end{bmatrix}\cdot\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}}{\sqrt{1^2+3^3+7^2}\sqrt{4^2+3^2}}\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}\right|$
=$\left|\frac{25}{\sqrt{1475}}\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}\right|$
$=\sqrt{\frac{625}{59}}$, which is clearly not the desired answer of $5$.
So what am I doing wrong in this calculation?
 [/INST] The $\sqrt{1^2+3^2+7^2}$ should be $\sqrt{4^2+3^2}$.
The length of the projection of $\begin{bmatrix}
1 \\3\\7\\\end{bmatrix}$ onto $\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}$ is given by
$$\left|\frac{\begin{bmatrix}
1 \\3\\7\\\end{bmatrix}\cdot\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}}{\color{red}{\sqrt{4^2+3^2}}}\frac{\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}}{\sqrt{4^2+3^2}}\right|=5$$
where $\dfrac{\begin{bmatrix}
1 \\3\\7\\\end{bmatrix}\cdot\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}}{\color{red}{\sqrt{4^2+3^2}}}$ is the scalar projection of $\begin{bmatrix}
1 \\3\\7\\\end{bmatrix}$ onto $\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}$, and $\dfrac{\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}}{\sqrt{4^2+3^2}}$ is the unit vector in the direction of $\begin{bmatrix}
4 \\0\\3\\\end{bmatrix}$.
You might want to see here.
</s>