# How to calculate all perpendicular unit vectors to a line through a point

A question was asked concerning the calculation of perpendicular unit vectors to a line at a point in 3-dimensional space. It was put on hold for reasons that were not entirely clear to me, but I think it is a reasonable mathematical question that gives a chance to show how to do geometrical calculations using Grassmann algebra. So I am going to ask and answer the question myself. It was a learning experience. I hope I am not violating protocol and ask your forgiveness if I am. The rephrased question is:

How to find an expression for all the unit vectors perpendicular to a known vector (a,b,c) and passing through a point (X0 ,Y0 ,Z0 ) in 3-dimensional space.

-
A vector can be translated parallel to itself. So should n't the minimal pedal distance from origin be specified to fix it in 3-space? –  Narasimham Mar 28 at 23:46

Although this can be done with purely symbolic variables, I am going to do this for specific numerical values. The expressions will be clearer and shorter and we can avoid considerations of checking whether specific vector components are zero. (Of course the vector has to be non-zero.)

This is done with a developmental Mathematica Application in conjunction with John Browne (who is the real mathematician here). If there are people seriously interested in exploring the application - it is rather extensive and the calculus part is mostly missing - they can contact me from my profile page.

<< GrassmannCalculus
SetPreferences["Grassmann3Space", "Vector"]
DeclareExtraScalarSymbols[θ]


Define a point and a vector through the point:

point = Origin + {2, 2, 3}.FreeBasis
vector = {1, 2, 1}.FreeBasis


Giving:

Find the vector space complement to the vector. This gives us a (unlocated) plane as a sum of bivectors.

VectorSpaceComplement[vector]
orthogonalPlane0 = % // ConvertComplements


Giving:

Let's check that this is orthogonal to the vector by taking the interior product (CircleMinus symbol) with the vector. The result should be zero.

orthogonalPlane0\[CircleMinus]vector
% // ToMetricElements


Giving:

0

In Grassmann algebra a simple element is one that can be factored into an exterior product of vectors. Let's check that this is the case.

SimpleQ[orthogonalPlane0]


True

It is simple so we obtain a factored form.

orthogonalPlane1 = ExteriorFactorize[orthogonalPlane0]


Giving:

These factors are neither unit vectors, nor are they orthogonal to each other. We will extract the first factor, normalize it, and then rotate it by an angle θ in the orthogonal plane.

firstPerpendicularVector = GrassmannNormalize[First[orthogonalPlane1]]
step1 = GrassmannPlaneRotation[θ, orthogonalPlane1][
firstPerpendicularVector] // ToMetricElements


Giving:

Then write the general perpendicular as a function of θ.

generalPerpendicular[θ_] = Collect[step1, FreeBasis, Simplify]


We check that it is a unit vector and that it is perpendicular to the initial vector.

Measure[generalPerpendicular[θ]] // Simplify
generalPerpendicular[\[Theta]]\[CircleMinus]vector // ToMetricElements
`

1

0

The following gives a snapshot of a Mathematica dynamic display which shows the position vector (in black), the line vector (in red), a segment of the perpendicular plane, and one of the orthogonal vectors (in blue) which can be rotated (within Mathematica) in the plane by the control. Also, within Mathematica we could rotate the image to visually see that the plane is orthogonal to the red vector and the blue vectors rotate within the plane. θ is the angle of rotation within the plane from the initial orthogonal vector, which was somewhat arbitrary.

-

I don't know what you mean by a "vector that passes through a point", since a vector has direction and magnitude, but no location.

Say you're given a unit vector $\mathbf{A} = (a,b,c)$ and you want to find all unit vectors perpendicular to it. First you need to find a single perpendicular unit vector. Since $\mathbf{A}$ is a unit vector, at least one of $a$, $b$, and $c$ must be nonzero. Assume $a$ is nonzero. Then $(-b, a, 0)$ is a perpendicular nonzero vector, and $\mathbf{B} = (\frac{-b}{\sqrt{a^2 + b^2}}, \frac{a}{\sqrt{a^2 + b^2}}, 0)$ is a perpendicular unit vector.

We can find another unit vector perpendicular to $\mathbf{A}$ and $\mathbf{B}$ by taking their cross product.

$$\mathbf{C} = \mathbf{A} \times \mathbf{B} = \left|\begin{array}{ccc} \mathbf{i} & \mathbf{j} & \mathbf{k} \\ a & b & c \\ \frac{-b}{\sqrt{a^2 + b^2}} & \frac{a}{\sqrt{a^2 + b^2}}& 0\\ \end{array}\right| = \left(\frac{-ac}{\sqrt{a^2 + b^2}}, \frac{-bc}{\sqrt{a^2 + b^2}}, \sqrt{a^2 + b^2})\right)$$

Now we can parameterize over all unit-length linear combinations of $\mathbf{B}$ and $\mathbf{C}$.

\begin{align}\mathbf{D}(\theta) & = \mathbf{B} \sin \theta + \mathbf{C} \cos \theta\\ & = \left(-\frac{b \sin \theta + ac \cos \theta}{\sqrt{a^2 + b^2}}, \frac{a \sin \theta - bc \cos \theta}{\sqrt{a^2 + b^2}}, \sqrt{a^2 + b^2} \cos \theta\right) \end{align}

Now vary $\theta$ from $0$ to $2\pi$ and you will cover all unit vectors perpendicular to $\mathbf{A}$.

Checking:

\begin{align} \mathbf{A} \cdot \mathbf{D}(\theta) & = (a,b,c) \cdot \left(-\frac{b \sin \theta + ac \cos \theta}{\sqrt{a^2 + b^2}}, \frac{a \sin \theta - bc \cos \theta}{\sqrt{a^2 + b^2}}, \sqrt{a^2 + b^2} \cos \theta\right)\\ & = -\frac{ab \sin \theta + a^2c \cos \theta}{\sqrt{a^2 + b^2}}+ \frac{ab \sin \theta - b^2c \cos \theta}{\sqrt{a^2 + b^2}} + c\sqrt{a^2 + b^2} \cos \theta\\ & = \frac{ab \sin \theta - ab \sin \theta}{\sqrt{a^2 + b^2}} - \frac{a^2 c \cos \theta + b^2 c \cos \theta}{\sqrt{a^2 + b^2}} + c \sqrt{a^2 + b^2} \cos \theta\\ & = 0 - c \sqrt{a^2 + b^2}\cos \theta + c \sqrt{a^2 + b^2}\cos \theta\\ & = 0 \end{align}

-