A point according to Euclid has no part. A point in two dimensional coordinate plane in coordinate geometry is represented by $(x,y)$.  The horizontal component is denoted by $x$ and the vertical component is $y$.

Line by definition is a infinite length single dimension geometrical object. It was first defined by Euclid in his book ELEMENTS as a straight line is of a breathless length where all its point are on itself.

In this lesson we shall look into find a formula to find the shortest distance between a point and a line.

## Formula

Distance between a point $(x_1,y_1)$ and a line $ax + by + c = 0$

The formula is

$D$ =  $\frac{\left | ax_1+by_2+c \right |}{\sqrt{a^2 + b^2}}$

Let us see how we can derive the formula

We know the shortest distance between two objects is a perpendicular line.  First we need to find a perpendicular line which joins the line and the point, and then we need to find the point of intersection of the perpendicular line.

Let us start with our given line $ax + by + c = 0$

$by = -ax - c$

$y$ = $\frac{-ax}{b}$ - $\frac{c}{b}$

The slope $\frac{-a}{b}$

The slope of perpendicular is negative reciprocal of the given slope

$m$ = $\frac{b}{a}$

Now let us find the equation of the perpendicular given the slope m and point $(x_1,y_1)$

$y - y_1 = m (x - x_1)$

$y - y_1$ = $\frac{b}{a(x - x_1)}$

Select

$a(y - y_1 ) = b(x - x_1)$

$ay - ay_1 = bx - bx_1$

$ay = bx - bx_1 + ay_1$

$-bx + ay = -bx_1 + ay_1$  ... (1)

Consider the given given equation

$ax + by + c = 0$

This equation can be written as

$ax + by = -c$  … (2)

Now solving the two equation simultaneously

$(2) \times b \Rightarrow abx + b^2 y = -bc$  … (3)

$(1) \times a \Rightarrow –abx + a^2 y = -abx_1 + a^2 y_1$ ...  (4)

$(1) + (2)$

$abx + b^2 y - abx + a^2 y = -bc - abx_1 + a^2 y_1$

$(b^2+a^2 )y$ = $-bc-abx_1 + a^2 y_1$

$y$ = $\frac{(-bc-abx_1+a^2 y_1)}{(b^2+a^2 )}$

$(1) \times -b \Rightarrow b^2 x - aby = b^2 x_1 - aby_1$  … (5)

$(2) \times a \Rightarrow a^2 x + aby = -ac$ ...(6)

$(5)+(6)$

$b^2 x - aby + a^2 x + aby = b^2 x_1 - aby_1 - ac$

$b^2 x + a^2 x = b^2 x_1 - aby_1 - ac$

$(b^2 + a^2)x$ = $b^2 x_1 - aby_1 - ac$

$x$ = $\frac{(b^2 x_1 - aby_1 - ac )}{(b^2 + a^2)}$

Point of intersection of the given line and its perpendicular is

$\left(\frac{(b^2 x_1 - aby_1 - ac )}{(b^2 + a^2 )}\right )$ ,$\left(\frac{(-bc - abx_1 + a^2 y_1)}{(b^2 + a^2)} \right )$

Distance between $(x_1,y_1 )$ and $\left (\frac{(b^2 x_1 - aby_1 - ac )}{(b^2 + a^2 )}\right )$ ,$\left (\frac{(-bc - abx_1 + a^2 y_1)}{(b^2 + a^2)}\right )$

$D^2$ = ${\left (\frac{(b^2 x_1 - aby_1 - ac )}{(b^2+a^2 )}- x_1 \right )}^2 + {\left (\frac{(-bc-abx_1+a^2 y_1)}{(b^2+a^2 )} - y_1 \right )}^2$

$D^2$ = ${\left (\frac{(b^2 x_1 - aby_1 - ac )}{(b^2+a^2)} - \frac{(x_1 (b^2+a^2)}{(b^2+a^2)} \right )}^2+ {\left (\frac{(-bc-abx_1+a^2 y_1)}{(b^2+a^2)} - \frac{y_1 (b^2+a^2)}{(b^2+a^2)}\right )}^2$

$D^2$ = ${\left ( \frac{(b^2 x_1-aby_1-ac )}{(b^2+a^2)} - \frac{(b^2 x_1+a^2 x_1)}{(b^2+a^2)} \right )}^2+ {\left(\frac{(-bc-abx_1+a^2 y_1)}{(b^2+a^2)} - \frac{(b^2 y_1+a^2 y_1)}{(b^2+a^2)} \right)}^2$

$D^2$ = ${\left (\frac{(b^2 x_1-aby_1-ac-b^2 x_1-a^2 x_1 )}{(b^2+a^2 )} \right)}^2+ {\left(\frac{(-bc-abx_1+a^2 y_1-b^2 y_1-a^2 y_1)}{(b^2+a^2)} \right )}^2$

$D^2$ = ${ \left (\frac{(b^2 x_1-aby_1-ac-b^2 x_1-a^2 x_1 )}{(b^2+a^2 )} \right )}^2+ {\left(\frac{(-bc-abx_1+a^2 y_1-b^2 y_1-a^2 y_1)}{(b^2+a^2 )}\right )}^2$

$D^2$ = ${\left(\frac{(-aby_1-ac-a^2 x_1 )}{(b^2+a^2)} \right )}^2+ {\left(\frac{(-bc-abx_1-b^2 y_1)}{(b^2+a^2)} \right )}^2$

$D^2$ = $a^2 {\left (\frac{(-by_1-c-ax_1 )}{(b^2+a^2)} \right ) }^2+ b^2{ \left(\frac{(-c-ax_1-by_1)}{(b^2+a^2)} \right)}^2$

$D^2$ = $a^2 {\left(\frac{(-ax_1-by_1-c )}{(b^2+a^2)} \right )}^2+ b^2 {\left(\frac{(-ax_1-by_1-c)}{(b^2+a^2)} \right )}^2$

$D^2$ = $(a^2+b^2){\left(\frac{(-ax_1-by_1-c )}{(b^2+a^2 )} \right )}^2$

$D^2$ = $(a^2+b^2){\left(\frac{(ax_1+by_1+c )}{(b^2+a^2 )} \right )}^2$

$D^2$ = $(a^2+b^2)\frac{{(ax_1+by_1+c)}^2}{{(b^2+a^2)}^2}$

$D^2$ = $\frac{{(ax_1+by_1+c)}^2}{(a^2+b^2 )}$

$D$ = $\sqrt \frac{{(ax_1+by_1+c)}^2}{(a^2+b^2)}$

$D$ = $\frac{\left | ax_1+by_1+c \right |}{(a^2+b^2 )}$  Formula proved.

How to find distance between point and line (steps)

Step 1: Write the equation of the line in the general form if it is not given.

Step 2: Identify $a,b$ and $c$.

Step 3: Use the given point and $a,b$ and $c$ and plug in the formula.

## Examples

Example 1:

Find the distance between the point $(2, 3)$ and the line  $2x + 3y$ = $5$

Solution:

The given line $2x + 3y$ = $5$ is in standard form, let us convert to general form $ax + by + c$ = $0$.

$2x + 3y - 5$ = $0$

Comparing with $ax + by + c$ = $0$

We get $a = 2,\ b$ = $3$ and $c$ = $-5$

The formula to find the distance between a point and the line is given by

$D$ =  $\frac{\left | ax_1+by_2+c \right |}{\sqrt{(a^2+b^2)}}$

$D$ = $\frac{\left | 2(2)+(3)(3)-5 \right |}{\sqrt{(2^2+3^2 )}}$

$D$ = $\frac{\left | 4 + 9 - 5 \right |}{\sqrt{(4 + 9 )}}$

$D$ = $\frac{\left | 8 \right |}{\sqrt{13}}$

$D$ = $\frac{8 \sqrt{13}}{13}$
Example 2:

Find the distance between a point $(-1, 4)$ and the line  $3x - 5y + 7$ = $0$

Solution :

The given line $3x - 5y + 7$ = $0$ is already in the general form we need to compare with $ax + by + c$ = $0$ and get $a, b$ and $c$.

$a$ = $3,\ b$ = $-5$ and $c$ = $7$

The point is $(-1,4)$.

The formula to find the  distance between point and a line is

$D$ =  $\frac{\left | ax_1+by_2+c \right |}{\sqrt{(a^2+b^2)}}$

$D$ = $\frac{\left | 3(-1)-5(4)+7 \right |}{\sqrt {(3)^2+(-5)^2}}$

$D$ = $\frac{\left | -3 - 20 + 7\right |}{\sqrt {9 + 25}}$

$D$ = $\frac{\left | -16 \right |}{\sqrt {34}}$

$D$ = $\frac{16}{\sqrt {34}}$

$D$ = $\frac{16 \sqrt{34}}{34}$

$D$ = $\frac{8 \sqrt{34}}{17}$
Example 3:

Find the distance between the point $(-2, -6)$ and the line  $y$ = $\frac{2}{3}$ $x + 7$

Solution:

The given equation is of slope intercept form, we need to convert it to $ax + by + c$ = $0$

$y$ = $\frac{2}{3}$ $x + 7$

$3y$ = $2x + 21$

$2x - 3y + 21$ = $0$

$a$ = $2,\ b$ = $-3$ and $c$ = $21$

The formula is

$D$ =  $\frac{\left | ax_1+by_2+c \right |}{\sqrt{(a^2+b^2)}}$

$D$ = $\frac{\left | 2(-2)-3(-6)+21 \right |}{\sqrt{(2^2+(-3)^2 )}}$

$D$ = $\frac{\left | -4 + 18 + 21 \right |}{\sqrt{4 + 9}}$

$D$ = $\frac{\left | 35 \right |}{\sqrt{13}}$

$D$ = $\frac{35 \sqrt{13}}{13}$