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 am trying to find the relationship between the vertical distance (V) from the center of the square to the line to the perpendicular distance (P) from the center of the square to the line in terms of slope.

I know the answer. The vertical distances are related to the perdendicular distances by a factor of such that p=cv where dx=x2-x1 and dy = y2-y1

However I do not know how to find this relationship...can someone step through the math that arrives at this?

In the image I have increased the size of the square. In my problem I am trying to find this relationship for each square in the grid that the line cuts through. Then I can find P at any square on the grid. I believe the relationship should be the same in either case.

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

First, note that the square has nothing to do with it -- you never talk about the square in any way other than referring to its center, so it's easier to just talk about points.

The relationship arises because the triangle you drew has the same angles as a triangle demonstrating the slope of the line. If you draw a triangle underneath the line with one horizontal side of length $\Delta x$ and one vertical side of length $\Delta y$, that triangle has the same angles, since it has a right angle and the two angles between the vertical lines and the given line are the same.

That means that the ratios of corresponding sides must be the same. The side corresponding to $P$ has length $\Delta x$, and the side corresponding to $V$ is the hypotenuse, which by Pythagoras has length $\sqrt{\Delta x^2 + \Delta y^2}$.

share|cite|improve this answer
Wow thank you, I understand now. I never thought of creating a triangle with sides dx and dy which is the first obvious thing to do. Also, forgot about how the ratios are the same when the angles are same. – juxstapose Apr 22 '11 at 8:55

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.