vectors – How to Calculate the Vector Tangent to a Sphere and Plane

spherestangent linevectors

I have a sphere centred at a point (x, y, z) = (0, 0, 0) with radius r = 1.

I have a point P on the outside of the sphere.

How could I calculate a vector at P, which points along both the tangent plane and the y, z-plane at that point?

The following image demonstrates where the resulting vector is, that I would like to calculate. (At the intersection of the tangent plane and y, z-plane at that point)

Best Answer

You have a point $P$ on the sphere. This defines a vector, let's call it $p,$ equal to the distance and direction from the center of the sphere to $P.$

Since you want a vector $v$ parallel to the tangent plane at $P,$ the vector $v$ must be perpendicular to $p.$

Since you want $v$ also to be parallel to the $y,z$ plane, it must also be perpendicular to the vector $\hat x = (1,0,0),$ the vector in the direction of the $x$-axis.

Given two vectors, you can get a third vector perpendicular to the first two by taking the cross product of those two vectors:

$$ v = p \times \hat x. $$

Since the vectors $p$ and $\hat x$ both have unit length in this question, the magnitude of their cross product is the sine of the angle between them. If you want a different length you can multiply by a scalar.

Note that if $P$ is on the $x$ axis then $p$ and $\hat x$ are either in the exact same direction or in exact opposite directions, so the cross product will be zero. But in that case the tangent plane is already parallel to the $y,z$ plane, so any vector parallel to the $y,z$ plane is a solution, for example $(0,1,0).$