Distance from a Point to a Line Calculator

Enter a point and the equation of a line to find how far apart they are.

The x-coordinate of the point.

The y-coordinate of the point.

An equation of a line, like 3x + 4y = 5, y = 2x - 1 or x = 4.

Try

Result

You entered(3,4), 1x+0y=1\left(3, 4\right),\ 1x + 0y = 1

2\displaystyle 2

Distance

2\displaystyle 2

Foot of the perpendicular

(1,4)\displaystyle \left(1, 4\right)
Show the work
  1. Line in the form Ax + By = C

    The distance formula needs the line written as Ax+By=CAx + By = C, so the typed line is first rearranged to that form. Here A=1A = 1, B=0B = 0 and C=1C = 1, which is the line 1x+0y=11x + 0y = 1.

    A=1B=0C=1\begin{gathered} A = 1 \\ B = 0 \\ C = 1 \end{gathered}
  2. Distance from a point to a line

    The distance from the point (x0,y0)=(3,4)(x_0, y_0) = \left(3, 4\right) to the line is measured along the perpendicular, which is the shortest path. Put the point into Ax+By−CAx + By - C and divide its absolute value by A2+B2\sqrt{A^2 + B^2}.

    d=∣Ax0+By0−C∣A2+B2=∣1×3+0×4−1∣12+02=∣2∣1=21=2\begin{aligned} d &= \frac{\left|Ax_0 + By_0 - C\right|}{\sqrt{A^2 + B^2}} \\ &= \frac{\left|1 \times 3 + 0 \times 4 - 1\right|}{\sqrt{1^2 + 0^2}} \\ &= \frac{\left|2\right|}{\sqrt{1}} \\ &= \frac{2}{1} \\ &= 2 \end{aligned}
  3. Foot of the perpendicular

    The foot of the perpendicular is the point of the line nearest to the given point: move from the point along the normal direction (A,B)(A, B) by exactly the amount that lands on the line.

    Using t=Ax0+By0−CA2+B2(xf,yf)=(x0−At,y0−Bt)t = \frac{Ax_0 + By_0 - C}{A^2 + B^2} \quad \left(x_f, y_f\right) = \left(x_0 - At, y_0 - Bt\right)

    t=21=2(xf,yf)=(3−1×2,4−0×2)=(1,4)\begin{gathered} t = \frac{2}{1} = 2 \\ \left(x_f, y_f\right) = \left(3 - 1 \times 2, 4 - 0 \times 2\right) = \left(1, 4\right) \end{gathered}
  4. Result

    So the distance from the point to the line is 22 units.

Worked examples