Distance from a Point to a Line Calculator 2D

(
,
)
x +
y +
= 0
X Y
━━ Line Point ┈┈ Shortest Distance

Enter the coordinates of the point and the coefficients of the line to calculate the distance. See Example

Distance from a Point to a Line Calculator 2D

What is the Distance from a Point to a Line?

The distance from a point to a line in 2D space is the length of the shortest line segment that can be drawn from the point to the line. This shortest line segment is always perpendicular to the given line.

How to Calculate the Distance from a Point to a Line

To calculate the distance from a point to a line in 2D space, we use the following steps:

  1. Identify the coordinates of the point and the equation of the line
  2. Apply the distance formula
  3. Simplify and calculate the result

Formula

The formula for the distance \(d\) from a point \((x_0, y_0)\) to a line \(Ax + By + C = 0\) is:

\[ d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}} \]

Where:

  • \((x_0, y_0)\) are the coordinates of the point
  • \(A\), \(B\), and \(C\) are the coefficients in the general form of the line equation
  • \(|\cdot|\) denotes the absolute value

Calculation Steps

  1. Identify the point \((x_0, y_0)\) and the line equation \(Ax + By + C = 0\)
  2. Substitute the values into the formula: \(d = \frac{|Ax_0 + By_0 + C|}{\sqrt{A^2 + B^2}}\)
  3. Calculate the numerator: \(|Ax_0 + By_0 + C|\)
  4. Calculate the denominator: \(\sqrt{A^2 + B^2}\)
  5. Divide the numerator by the denominator to get the final distance

Example and Visual Representation

Let's calculate the distance from the point P(2, 3) to the line 3x - 4y + 5 = 0:

Step 1: We have \(x_0 = 2\), \(y_0 = 3\), \(A = 3\), \(B = -4\), and \(C = 5\)

Step 2: \(d = \frac{|3(2) + (-4)(3) + 5|}{\sqrt{3^2 + (-4)^2}}\)

Step 3: \(d = \frac{|6 - 12 + 5|}{\sqrt{9 + 16}} = \frac{|-1|}{\sqrt{25}} = \frac{1}{5}\)

Therefore, the distance from the point P(2, 3) to the line 3x - 4y + 5 = 0 is \(\frac{1}{5}\) or 0.2 units.

X Y 1 2 -1 -2 1 2 -1 -2 3x - 4y + 5 = 0 P(2,3) d = 0.2 d = |3(2) + (-4)(3) + 5| / √(3² + (-4)²) d = |6 - 12 + 5| / √(9 + 16) = 1/5 = 0.2 ━━ Line ● Point ┈┈ Shortest Distance

In this diagram, the blue line represents the equation 3x - 4y + 5 = 0. The red point P is at coordinates (2, 3). The green line segment shows the shortest distance from point P to the line, which we calculated to be 0.2 units.