page_title: Distance from a point to a line
section_title: A geometric proof
hierarchical_section_title: Distance from a point to a line / Proofs / A geometric proof
context_page_description: 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 formula for calculating it can be derived and expressed in several ways.
  Knowing the distance from a point to a line can be useful in various situations—for 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.
context_section_description: This proof is valid only if the line is not horizontal or vertical.
  Drop a perpendicular from the point P with coordinates (x₀, y₀) 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). Corresponding sides of these triangles are in the same ratio, so:
  If point S has coordinates (x₀,m) then |PS| = |y₀ - 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:
  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.
caption: Diagram for geometric proof