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

Given that I know the point coordinates of point $A$ and point $B$ on segment $AB$ and the expected length of a perpendicular segment $CA$ (perpendicular over $AB$), how do I calculate the point coordinates of the point $C$?

share|cite|improve this question

There are, in general, multiple possible solutions for $C$, depending on which direction you go from A. If you restrict yourself to points on a plane, then there are two possible solutions.

Say that the length of $CA$ is known to be $l$. We want to find a perpendicular to $AB$. Say $B-A = (x,y)$ then we want $(a,b)$ with $(x,y) \cdot (a,b) = 0$. Check for yourself that $(-y,x) \cdot (x,y) = 0$.

But we also want $(a,b)$ to have length $l$. To get something in the same direction as $(-y,x)$, but with length $l$, divide $(-y,x)$ by it's length and multiply by $l$. This gives $(a,b) = \frac{l}{\sqrt{x^2+y^2}}(-y,x)$.

So with this choice $(a,b)$ has both the right magnitude and direction. Since this is the displacement from $A$ to $C$, let $C = A + (a,b)$. As I said above, this choice is not unique; you can check that even in the plane $C = A - (a,b)$ gives another valid solution.

share|cite|improve this answer
Thank you for your answers - they helped me solve the problem. – crerem May 18 '12 at 11:06

You have apparently $2$ possible solutions. Consider the vectors $A=(a_1,a_2)$ and $B=(b_1,b_2)$. Then, the vector $B-A=(b_1-a_1,b_2-a_2)$ is the director vector of $AB$. Hence, $u=(a_2-b_2,b_1-a_1)$ is orthogonal to $B-A$. Therefore,

$$C=A\pm|CA|\cdot \frac{u}{\|u\|}$$

are your two desired points.

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.