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,1), −1x+1y=0\left(1, 1\right),\ -1x + 1y = 0

0\displaystyle 0

Distance

0\displaystyle 0

Foot of the perpendicular

(1,1)\displaystyle \left(1, 1\right)

Decimal

0\displaystyle 0
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=1B = 1 and C=0C = 0, which is the line −1x+1y=0-1x + 1y = 0.

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

    The distance from the point (x0,y0)=(1,1)(x_0, y_0) = \left(1, 1\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)×1+1×1−0∣(−1)2+12=∣0∣2=02=0\begin{aligned} d &= \frac{\left|Ax_0 + By_0 - C\right|}{\sqrt{A^2 + B^2}} \\ &= \frac{\left|\left(-1\right) \times 1 + 1 \times 1 - 0\right|}{\sqrt{\left(-1\right)^2 + 1^2}} \\ &= \frac{\left|0\right|}{\sqrt{2}} \\ &= \frac{0}{\sqrt{2}} \\ &= 0 \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=02=0(xf,yf)=(1−(−1)×0,1−1×0)=(1,1)\begin{gathered} t = \frac{0}{2} = 0 \\ \left(x_f, y_f\right) = \left(1 - \left(-1\right) \times 0, 1 - 1 \times 0\right) = \left(1, 1\right) \end{gathered}
  4. Result

    So the distance is 00: the point is on the line.

Worked examples