Distance from a point to a line

Last updated

In Euclidean geometry, the distance from a point to a line is the shortest distance from a given point to any point on an infinite straight line. It is the perpendicular distance of the point to the line, the length of the line segment which joins the point to nearest point on the line. The algebraic expression for calculating it can be derived and expressed in several ways.

Contents

Knowing the distance from a point to a line can be useful in various situationsfor example, finding the shortest distance to reach a road, quantifying the scatter on a graph, etc. In Deming regression, a type of linear curve fitting, if the dependent and independent variables have equal variance this results in orthogonal regression in which the degree of imperfection of the fit is measured for each data point as the perpendicular distance of the point from the regression line.


Line defined by an equation

In the case of a line in the plane given by the equation ax + by + c = 0, where a, b and c are real constants with a and b not both zero, the distance from the line to a point (x0, y0) is [1] [2] :p.14

The point on this line which is closest to (x0, y0) has coordinates: [3]

Horizontal and vertical lines

In the general equation of a line, ax + by + c = 0, a and b cannot both be zero unless c is also zero, in which case the equation does not define a line. If a = 0 and b ≠ 0, the line is horizontal and has equation y = −c/b. The distance from (x0, y0) to this line is measured along a vertical line segment of length |y0 − (−c/b)| = |by0 + c|/|b| in accordance with the formula. Similarly, for vertical lines (b = 0) the distance between the same point and the line is |ax0 + c|/|a|, as measured along a horizontal line segment.

Line defined by two points

If the line passes through two points P1 = (x1, y1) and P2 = (x2, y2) then the distance of (x0, y0) from the line is: [4]

The denominator of this expression is the distance between P1 and P2. The numerator is twice the area of the triangle with its vertices at the three points, (x0, y0), P1 and P2. See: Area of a triangle § Using coordinates. The expression is equivalent to h = 2A/b, which can be obtained by rearranging the standard formula for the area of a triangle: A = 1/2bh, where b is the length of a side, and h is the perpendicular height from the opposite vertex.

Line defined by point and angle

If the line passes through the point P = (Px, Py) with angle θ, then the distance of some point (x0, y0) to the line is

Proofs

An algebraic proof

This proof is valid only if the line is neither vertical nor horizontal, that is, we assume that neither a nor b in the equation of the line is zero.

The line with equation ax + by + c = 0 has slope a/b, so any line perpendicular to it will have slope b/a (the negative reciprocal). Let (m, n) be the point of intersection of the line ax + by + c = 0 and the line perpendicular to it which passes through the point (x0, y0). The line through these two points is perpendicular to the original line, so

Thus, and by squaring this equation we obtain:

Now consider,

using the above squared equation. But we also have,

since (m, n) is on ax + by + c = 0. Thus,

and we obtain the length of the line segment determined by these two points,

[5]

A geometric proof

Diagram for geometric proof Point-to-line2.svg
Diagram for geometric proof

This proof is valid only if the line is not horizontal or vertical. [6]

Drop a perpendicular from the point P with coordinates (x0, y0) to the line with equation Ax + By + C = 0. Label the foot of the perpendicular R. Draw the vertical line through P and label its intersection with the given line S. At any point T on the line, draw a right triangle TVU whose sides are horizontal and vertical line segments with hypotenuse TU on the given line and horizontal side of length |B| (see diagram). The vertical side of ∆TVU will have length |A| since the line has slope -A/B.

PRS and ∆TVU are similar triangles, since they are both right triangles and ∠PSR ≅ ∠TUV since they are corresponding angles of a transversal to the parallel lines PS and UV (both are vertical lines). [7] Corresponding sides of these triangles are in the same ratio, so:

If point S has coordinates (x0,m) then |PS| = |y0 - m| and the distance from P to the line is:

Since S is on the line, we can find the value of m,

and finally obtain: [8]

A variation of this proof is to place V at P and compute the area of the triangle ∆UVT two ways to obtain that where D is the altitude of ∆UVT drawn to the hypotenuse of ∆UVT from P. The distance formula can then used to express , , and in terms of the coordinates of P and the coefficients of the equation of the line to get the indicated formula.[ citation needed ]

A vector projection proof

Diagram for vector projection proof Vectorpoint-to-line.svg
Diagram for vector projection proof

Let P be the point with coordinates (x0, y0) and let the given line have equation ax + by + c = 0. Also, let Q = (x1, y1) be any point on this line and n the vector (a, b) starting at point Q. The vector n is perpendicular to the line, and the distance d from point P to the line is equal to the length of the orthogonal projection of on n. The length of this projection is given by:

Now,

so and

thus

Since Q is a point on the line, , and so, [9]

Although the distance is given as a modulus, the sign can be useful to determine which side of the line the point is on, in a sense determined by the direction of normal vector (a,b)

Another formula

It is possible to produce another expression to find the shortest distance of a point to a line. This derivation also requires that the line be not vertical or horizontal.

The point P is given with coordinates (). The equation of a line is given by . The equation of the normal of that line which passes through the point P is given .

The point at which these two lines intersect is the closest point on the original line to the point P. Hence:

We can solve this equation for x,

The y coordinate of the point of intersection can be found by substituting this value of x into the equation of the original line,

Using the equation for finding the distance between 2 points, , we can deduce that the formula to find the shortest distance between a line and a point is the following:

Recalling that m = -a/b and k = - c/b for the line with equation ax + by + c = 0, a little algebraic simplification reduces this to the standard expression. [3]

Vector formulation

Illustration of the vector formulation. Distance from a point to a line.svg
Illustration of the vector formulation.

The equation of a line can be given in vector form:

Here a is a point on the line, and n is a unit vector in the direction of the line. Then as scalar t varies, x gives the locus of the line.

The distance of an arbitrary point p to this line is given by

This formula can be derived as follows: is a vector from a to the point p. Then is the projected length onto the line and so

is a vector that is the projection of onto the line and represents the point on the line closest to . Thus

is the component of perpendicular to the line. The distance from the point to the line is then just the norm of that vector. [4] This more general formula is not restricted to two dimensions.

Another vector formulation

If the vector space is orthonormal and if the line goes through point a and has a direction vector n, the distance between point p and the line is [10]

Note that cross products only exist in dimensions 3 and 7.

See also

Notes

  1. Larson & Hostetler 2007 , p. 452
  2. Spain 2007
  3. 1 2 Larson & Hostetler 2007 , p. 522
  4. 1 2 Sunday, Dan. "Lines and Distance of a Point to a Line". softSurfer. Archived from the original on 2021-05-07.
  5. Between Certainty and Uncertainty: Statistics and Probability in Five Units With Notes on Historical Origins and Illustrative Numerical Examples
  6. Ballantine & Jerbert 1952 do not mention this restriction in their article
  7. If the two triangles are on opposite sides of the line, these angles are congruent because they are alternate interior angles.
  8. Ballantine & Jerbert 1952
  9. Anton 1994 , pp. 138-9
  10. Weisstein, Eric W. "Point-Line Distance--3-Dimensional". mathworld.wolfram.com. Retrieved 2021-06-06.

Related Research Articles

<span class="mw-page-title-main">Analytic geometry</span> Study of geometry using a coordinate system

In mathematics, analytic geometry, also known as coordinate geometry or Cartesian geometry, is the study of geometry using a coordinate system. This contrasts with synthetic geometry.

<span class="mw-page-title-main">Ellipse</span> Plane curve: conic section

In mathematics, an ellipse is a plane curve surrounding two focal points, such that for all points on the curve, the sum of the two distances to the focal points is a constant. It generalizes a circle, which is the special type of ellipse in which the two focal points are the same. The elongation of an ellipse is measured by its eccentricity , a number ranging from to .

<span class="mw-page-title-main">Inner product space</span> Generalization of the dot product; used to define Hilbert spaces

In mathematics, an inner product space is a real vector space or a complex vector space with an operation called an inner product. The inner product of two vectors in the space is a scalar, often denoted with angle brackets such as in . Inner products allow formal definitions of intuitive geometric notions, such as lengths, angles, and orthogonality of vectors. Inner product spaces generalize Euclidean vector spaces, in which the inner product is the dot product or scalar product of Cartesian coordinates. Inner product spaces of infinite dimension are widely used in functional analysis. Inner product spaces over the field of complex numbers are sometimes referred to as unitary spaces. The first usage of the concept of a vector space with an inner product is due to Giuseppe Peano, in 1898.

<span class="mw-page-title-main">Parabola</span> Plane curve: conic section

In mathematics, a parabola is a plane curve which is mirror-symmetrical and is approximately U-shaped. It fits several superficially different mathematical descriptions, which can all be proved to define exactly the same curves.

<span class="mw-page-title-main">Euclidean planes in three-dimensional space</span> Flat surface

In Euclidean geometry, a plane is a flat two-dimensional surface that extends indefinitely. Euclidean planes often arise as subspaces of three-dimensional space . A prototypical example is one of a room's walls, infinitely extended and assumed infinitesimal thin. While a pair of real numbers suffices to describe points on a plane, the relationship with out-of-plane points requires special consideration for their embedding in the ambient space .

<span class="mw-page-title-main">Ellipsoid</span> Quadric surface that looks like a deformed sphere

An ellipsoid is a surface that may be obtained from a sphere by deforming it by means of directional scalings, or more generally, of an affine transformation.

<span class="mw-page-title-main">Normal (geometry)</span> Line or vector perpendicular to a curve or a surface

In geometry, a normal is an object that is perpendicular to a given object. For example, the normal line to a plane curve at a given point is the (infinite) line perpendicular to the tangent line to the curve at the point. A normal vector may have length one or its length may represent the curvature of the object ; its algebraic sign may indicate sides.

<span class="mw-page-title-main">Centroid</span> Mean ("average") position of all the points in a shape

In mathematics and physics, the centroid, also known as geometric center or center of figure, of a plane figure or solid figure is the arithmetic mean position of all the points in the surface of the figure. The same definition extends to any object in n-dimensional Euclidean space.

<span class="mw-page-title-main">Green's theorem</span> Theorem in calculus relating line and double integrals

In vector calculus, Green's theorem relates a line integral around a simple closed curve C to a double integral over the plane region D bounded by C. It is the two-dimensional special case of Stokes' theorem.

<span class="mw-page-title-main">Euler's rotation theorem</span> Movement with a fixed point is rotation

In geometry, Euler's rotation theorem states that, in three-dimensional space, any displacement of a rigid body such that a point on the rigid body remains fixed, is equivalent to a single rotation about some axis that runs through the fixed point. It also means that the composition of two rotations is also a rotation. Therefore the set of rotations has a group structure, known as a rotation group.

<span class="mw-page-title-main">Line (geometry)</span> Straight figure with zero width and depth

In geometry, a line is an infinitely long object with no width, depth, or curvature. Thus, lines are one-dimensional objects, though they may exist embedded in two, three, or higher dimensional spaces. The word line may also refer to a line segment in everyday life that has two points to denote its ends (endpoints). A line can be referred to by two points that lie on it or by a single letter.

<span class="mw-page-title-main">Ternary plot</span> Barycentric plot on three variables

A ternary plot, ternary graph, triangle plot, simplex plot, Gibbs triangle or de Finetti diagram is a barycentric plot on three variables which sum to a constant. It graphically depicts the ratios of the three variables as positions in an equilateral triangle. It is used in physical chemistry, petrology, mineralogy, metallurgy, and other physical sciences to show the compositions of systems composed of three species. In population genetics, a triangle plot of genotype frequencies is called a de Finetti diagram. In game theory, it is often called a simplex plot. Ternary plots are tools for analyzing compositional data in the three-dimensional case.

<span class="mw-page-title-main">Circumscribed circle</span> Circle that passes through all the vertices of a polygon

In geometry, the circumscribed circle or circumcircle of a polygon is a circle that passes through all the vertices of the polygon. The center of this circle is called the circumcenter and its radius is called the circumradius.

<span class="mw-page-title-main">Trilinear coordinates</span> Coordinate system based on distances from the sidelines of a given triangle

In geometry, the trilinear coordinatesx : y : z of a point relative to a given triangle describe the relative directed distances from the three sidelines of the triangle. Trilinear coordinates are an example of homogeneous coordinates. The ratio x : y is the ratio of the perpendicular distances from the point to the sides opposite vertices A and B respectively; the ratio y : z is the ratio of the perpendicular distances from the point to the sidelines opposite vertices B and C respectively; and likewise for z : x and vertices C and A.

In Euclidean space, the distance from a point to a plane is the distance between a given point and its orthogonal projection on the plane, the perpendicular distance to the nearest point on the plane.

In Euclidean plane geometry, a tangent line to a circle is a line that touches the circle at exactly one point, never entering the circle's interior. Tangent lines to circles form the subject of several theorems, and play an important role in many geometrical constructions and proofs. Since the tangent line to a circle at a point P is perpendicular to the radius to that point, theorems involving tangent lines often involve radial lines and orthogonal circles.

<span class="mw-page-title-main">Interval finite element</span>

In numerical analysis, the interval finite element method is a finite element method that uses interval parameters. Interval FEM can be applied in situations where it is not possible to get reliable probabilistic characteristics of the structure. This is important in concrete structures, wood structures, geomechanics, composite structures, biomechanics and in many other areas. The goal of the Interval Finite Element is to find upper and lower bounds of different characteristics of the model and use these results in the design process. This is so called worst case design, which is closely related to the limit state design.

<span class="mw-page-title-main">Pythagorean theorem</span> Relation between sides of a right triangle

In mathematics, the Pythagorean theorem or Pythagoras' theorem is a fundamental relation in Euclidean geometry between the three sides of a right triangle. It states that the area of the square whose side is the hypotenuse is equal to the sum of the areas of the squares on the other two sides.

In classical mechanics, the central-force problem is to determine the motion of a particle in a single central potential field. A central force is a force that points from the particle directly towards a fixed point in space, the center, and whose magnitude only depends on the distance of the object to the center. In a few important cases, the problem can be solved analytically, i.e., in terms of well-studied functions such as trigonometric functions.

The distance between two parallel lines in the plane is the minimum distance between any two points.

References

Further reading