1
$\begingroup$

Using 2D cartesian co-ordinates:

$Point = (x, y)$

$Line = (x_1,y_1),(x_2,y_2)$

Here we are taking $(x_1,y_1)$ and $(x_2, y_2)$ as line segment ends, not points on the infinitely extended line between those points.

How can we calculate, if the point is perpendicular to the line, the distance between the two?

$\endgroup$
  • 2
    $\begingroup$ There is actually a distance formula you can look up. Alternatively find the vector perpendicular to your line. Then travel from the point to the line along this vector, and find the length of the. Alternative 2: find a vector between a point on your line and your point off the line. The project this vector onto your line. And subtract this projection from the original vector. $\endgroup$ – Doug M Dec 5 '17 at 19:03
  • $\begingroup$ one of the axioms is that given a line and a point not on the line, it's always possible to draw a perpendicular thru that point $\endgroup$ – Vasya Dec 5 '17 at 19:03
  • $\begingroup$ Are we considering $(x_1 , y_1)$ and $(x_2 , y_2)$ as line segment ends or just points along an infinite tine passes through those points? $\endgroup$ – Warren Hill Dec 5 '17 at 19:04
  • $\begingroup$ @WarrenHill, they are line segment ends. $\endgroup$ – Edward Dec 5 '17 at 19:05
  • $\begingroup$ @Edward updated your question to clarify intent. Question details should be in the question body. $\endgroup$ – Warren Hill Dec 5 '17 at 19:10
3
$\begingroup$

CASE 1 - "INFINITE" LINE

Suppose we are given a infinite line through two points: $P_1(x_1,y_1)$ and $P_2(x_2,y_2)$; the aim is to determine the the distance between a point $Q(x_0,y_0)$ and the infinite line $\vec{P_1P_2}$.

The equation of the line through $P_1(x_1,y_1)$ and $P_2(x_2,y_2)$ in the general implicit form

$$Ax + By + C = 0$$

can be easlily found expanding the following:

$$(y-y_1)(x_2-x_1)+(x-x_1)(y_2-y_1)=0$$

Finally the distance between the point $(x_0,y_0)$ and the line $Ax + By + C = 0$ is given by:

$$\text{Distance QP} = \frac{\left | Ax_{0} + By_{0} + C\right |}{\sqrt{A^2 + B^2} }$$

NOTE

It is meaningless define a “point perpendicular to a line”.

What is true is that the minimum distance between the point Q and a point P on the line is attained at $P$ such that the line $\vec{QP}$ is perpendicular to the line $\vec{P_1P_2}$.

CASE 2 - "FINITE" LINE

Suppose we are given a finite line between two points: $P_1(x_1,y_1)$ and $P_2(x_2,y_2)$ and the aim is to determine the the distance between a point $Q(x_0,y_0)$ and the line $\vec{P_1P_2}$.

In the simple case of 2D cartesian coordinates you can proceed firstly to draw a graph of the line $\vec{P_1P_2}$ and the point $Q(x_0,y_0)$ in order to verify whether or not the pependicular line from $Q$ to $\vec{P_1P_2}$ lies internally to $\vec{P_1P_2}$.

If the pependicular line from $Q$ to $\vec{P_1P_2}$ lies internally to $\vec{P_1P_2}$ you can determine the distance $QP$ as for the CASE 1.

If the pependicular line from $Q$ to $\vec{P_1P_2}$ lies externally to $\vec{P_1P_2}$ you can determine the distance $QP$ as:

$$QP=Minimum(QP_1,QP_2)$$

where (by Phytagorean Theorem):

$$QP_1= \sqrt{(x_1-x_0)^2+(y_1-y_0)^2}$$ $$QP_2= \sqrt{(x_2-x_0)^2+(y_2-y_0)^2}$$

NOTE

It would be possible solve the problem without any graphing in a pure algebric way but for this simple case it is not necessary.

$\endgroup$
  • $\begingroup$ Does this account for the fact that the line is of a fixed length? where would you plug in x2 and y2? $\endgroup$ – Edward Dec 6 '17 at 14:02
  • $\begingroup$ No the given formula do not take into account the finite length os the line (i.e. segment). Im going to update the aswer to take into account this possibility. $\endgroup$ – user Dec 6 '17 at 14:08
  • $\begingroup$ An example: line between {5,10} and {12,15}, and point {2,5} $\endgroup$ – Edward Dec 6 '17 at 14:08
  • $\begingroup$ If you could update your answer using my example, I'll select your question. $\endgroup$ – Edward Dec 6 '17 at 15:01
  • $\begingroup$ I've just update a full answer. $\endgroup$ – user Dec 6 '17 at 15:19
0
$\begingroup$

the slope of your line lets say $l$ is given by $$m_1=\frac{y_2-y_1}{x_2-x_1}$$ and then we have $$y=\frac{y_2-y_1}{x_2-x_1}x+n$$ with $$P(x_1,y_1)$$ we get $n$; the line perpendicular to the given line has the slope $$m_2=-\frac{1}{m_1}$$ Can you proceed?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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