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(1,2), 3x+4y=5\left(1, 2\right),\ 3x + 4y = 5

1.2\displaystyle 1.2

Distance

1.2\displaystyle 1.2

Foot of the perpendicular

(0.28,1.04)\displaystyle \left(0.28, 1.04\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=3A = 3, B=4B = 4 and C=5C = 5, which is the line 3x+4y=53x + 4y = 5.

    A=3B=4C=5\begin{gathered} A = 3 \\ B = 4 \\ C = 5 \end{gathered}
  2. Distance from a point to a line

    The distance from the point (x0,y0)=(1,2)(x_0, y_0) = \left(1, 2\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=∣3×1+4×2−5∣32+42=∣6∣25=65=1.2\begin{aligned} d &= \frac{\left|Ax_0 + By_0 - C\right|}{\sqrt{A^2 + B^2}} \\ &= \frac{\left|3 \times 1 + 4 \times 2 - 5\right|}{\sqrt{3^2 + 4^2}} \\ &= \frac{\left|6\right|}{\sqrt{25}} \\ &= \frac{6}{5} \\ &= 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=625=0.24(xf,yf)=(1−3×0.24,2−4×0.24)=(0.28,1.04)\begin{gathered} t = \frac{6}{25} = 0.24 \\ \left(x_f, y_f\right) = \left(1 - 3 \times 0.24, 2 - 4 \times 0.24\right) = \left(0.28, 1.04\right) \end{gathered}
  4. Result

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

Worked examples