Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 unit vectors, o and v.

o is the orientation of a cylinder and v is a direction I wish to move inside this cylinder.

However, I want to allow v to only move perpendicular to the cylinder, so it cannot move along the axis defined as moving along o.

I've been banging my head together and trying various equations I can apply to v to get a vector that will move perpendicular to the cylinder in the direction of v, but not along that axis.

My current idea is to rotate o and v such that o points along one of the cardinal axes (I was thinking Z for visualization purposes) and then setting the Z component of v to 0, before rotating back, but there surely must be a more condensed way of doing this.

I think part of the problem is that I just cannot think of the correct search terms for this. Anybody got any ideas?


share|cite|improve this question
up vote 1 down vote accepted

$\frac{o\cdot v}{|o|}=|v|\cos(\theta)$ is the length of the component of $v$ that lies along $o$. Subtract that component from $v$ to get the perpendicular component. This is a part of what's known as the Gram-Schmidt orthogonalization process. So your formula for the perpendicular component is

$$v-\frac{o\cdot v}{|o|^2}o$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.