Jump to a key chapter

One such fundamental way of relating them is the distance between them, and that’s what we shall attempt to find out in this article: **the distance from a point to a line**.

## Distance from a point to a line definition

Let us analyze this problem using the diagram below.

A line

*l*and a point A with some of the possible distances between them, StudySmarter Originals

If one was asked to find the distance between the point A and line *l *then it would be really ambiguous since there are several, in fact, infinite ways we can connect the point and the line.

Hence, one has to be specific about which distance is asked about. Some of the distances are shown by the green segments in the above diagram.

But the only specific distance that can be named and one can quantify is the **shortest distance between the point and the line**.

The shortest distance between the line and the point i**s shown by the pink line segment in the above diagram. **

The distance between a point and a line is given by the shortest distance between them.

The shortest line segment is perpendicular to the line itself. Because any other line segment will make an acute or obtuse angle with the line, the shortest distance will only be possible when it will be perpendicular to the line.

This distance can alternatively be seen as the shortest way by which point A can be brought to line *l*.

But how can one determine the distance between a point and a line using the equation of a line and the coordinates of the point? Let us explore how we can come up with such a formula.

## Distance from a point to a line formula

Let D be a straight line whose equation is given by $ax+by+c=0$ where $a,b$ are not simultaneously 0, and a point A $\left({x}_{0},{y}_{0}\right)$ outside the line, that is not belonging to the line.

The goal is to find the shortest distance between the line D and point P. Let the point where the shortest line segment intersects the line be Q whose coordinates are $\left({x}_{1},{y}_{1}\right)$.

The distance between the point and the line D is the same as the length of the line segment formed by points A and Q or the distance between them. We can use the distance formula to do so but we need to know the coordinates of Q in terms of ${x}_{0}and{y}_{0}$ for that purpose.

Recall that the gradient of a line with equation $ax+by+c=0$ is given by ${m}_{1}=-\frac{a}{b}$. Now the line segment AQ is perpendicular to the line so its slope will be ${m}_{2}=\frac{b}{a}$. The reason being that the product of slopes of two perpendicular lines is always -1 that is${m}_{1}{m}_{2}=-1$.

We now have the slope of the line joining AQ and the coordinates of a point A on it. Using this information, we can now form the equation of line AQ,

$y-{y}_{0}={m}_{2}\left(x-{x}_{0}\right)$

$y-{y}_{0}=\frac{b}{a}\left(x-{x}_{0}\right)$

$ay-a{y}_{0}=bx-b{x}_{0}$

Since Q lies on this line, we can substitute $\left({x}_{1},{y}_{1}\right)$ for $\left(x,y\right)$ to find the unknowns ${x}_{1}and{y}_{1}$.

$a{y}_{1}-a{y}_{0}=b{x}_{1}-b{x}_{0}$

But Q also lies on the line $ax+by+c=0$$ax+by+c=0$, so it will satisfy the equation of line D, hence we have

$a{x}_{1}+b{y}_{1}+c=0$$a{x}_{1}+b{y}_{1}+c=0$

The above two lines intersect at Q and hence can be solved simultaneously in order to determine the unknowns ${x}_{1}and{y}_{1}$, writing the first equation in terms of ${x}_{1}$,

${x}_{1}=\frac{-c-b{y}_{1}}{a}$

Substituting the expression of ${x}_{1}$ in $a{y}_{1}-a{y}_{0}=b{x}_{1}-b{x}_{0}$, we get

$a{y}_{1}-a{y}_{0}=b\left(\frac{-c-b{y}_{1}}{a}\right)-b{x}_{0}$$-bc-{b}^{2}{y}_{1}-{a}^{2}{y}_{1}+{a}^{2}{y}_{0}-ab{x}_{0}=0$

Solving for${y}_{1}$ we get,

$a{y}_{1}=a{y}_{0}-\frac{b}{a}\left(c+b{y}_{1}\right)-b{x}_{0}$

Expanding the brackets and rearranging the terms, we get

$a{y}_{1}=\frac{{a}^{2}{y}_{0}-bc-{b}^{2}{y}_{1}-ab{x}_{0}}{a}$

Multiplying both sides by $a$, we get

${a}^{2}{y}_{1}+{b}^{2}{y}_{1}={a}^{2}{y}_{0}-ab{x}_{0}-bc$

$\left({a}^{2}+{b}^{2}\right){y}_{1}={a}^{2}{y}_{0}-ab{x}_{0}-bc$

Now we shall divide by ${a}^{2}+{b}^{2}$, to get

${y}_{1}=\frac{{a}^{2}{y}_{0}-ab{x}_{0}-bc}{{a}^{2}+{b}^{2}}$

Substituting this back into ${x}_{1}=\frac{-c-b{y}_{1}}{a}$ to determine ${x}_{1}$, we get

${x}_{1}=\frac{-c}{a}-\frac{b}{a}\left(\frac{{a}^{2}{y}_{0}-ab{x}_{0}-bc}{{a}^{2}+{b}^{2}}\right)$

Reducing to a common denominator, we get

${x}_{1}=\frac{-c({a}^{2}+{b}^{2})-b{a}^{2}{y}_{0}+a{b}^{2}{x}_{0}+{b}^{2}c}{a\left({a}^{2}+{b}^{2}\right)}$

Upon simplification, we have

${x}_{1}=\frac{-{a}^{2}c-{b}^{2}c-{a}^{2}b{y}_{0}+a{b}^{2}{x}_{0}+{b}^{2}c}{a({a}^{2}+{b}^{2})}$

Upon further simplification by eliminating the like terms, we get

${x}_{1}=\frac{{b}^{2}{x}_{0}-ab{y}_{0}-ac}{{a}^{2}+{b}^{2}}$

Now we have obtained the coordinates of point Q in terms of the constants we know,

$Q\left(\frac{{b}^{2}{x}_{0}-ab{y}_{0}-ac}{{a}^{2}+{b}^{2}},\frac{{a}^{2}{y}_{0}-ab{x}_{0}-bc}{{a}^{2}+{b}^{2}}\right)$

Now we can calculate the distance between A and Q using the distance, which is nothing but the **distance from the point to the line **as we discussed earlier. Let us denote it by *d* and apply the distance formula,

${d}^{2}={\left({x}_{1}-{x}_{0}\right)}^{2}+{\left({y}_{1}-{y}_{0}\right)}^{2}$

Substituting for ${x}_{1},{y}_{1}$ we get

${d}^{2}=\left(\frac{{b}^{2}{x}_{0}-ab{y}_{0}-ac-{a}^{2}{x}_{0}-{b}^{2}{x}_{0}}{{a}^{2}+{b}^{2}}\right)+\left(\frac{{a}^{2}{y}_{0}-ab{y}_{0}-bc-{a}^{2}{y}_{0}-{b}^{2}{y}_{0}}{{a}^{2}+{b}^{2}}\right)$

Upon further simplification, we get

${d}^{2}=\frac{{a}^{2}{\left(a{x}_{0}+b{y}_{0}+c\right)}^{2}+{b}^{2}{\left(a{x}_{0}+b{y}_{0}+c\right)}^{2}}{{({a}^{2}+{b}^{2})}^{2}}$

${d}^{2}=\frac{\left({a}^{2}+{b}^{2}\right){\left(a{x}_{0}+b{y}_{0}+c\right)}^{2}}{{\left({a}^{2}+{b}^{2}\right)}^{2}}$

${d}^{2}=\frac{{\left(a{x}_{0}+b{y}_{0}+c\right)}^{2}}{{a}^{2}+{b}^{2}}$

Taking the square root on both sides, we get,

$d=\pm \frac{a{x}_{0}+b{y}_{0}+c}{\sqrt{{a}^{2}+{b}^{2}}}$

Since *d *is distance, it cannot be negative so we reject the negative root, giving us,

$d=\frac{a{x}_{0}+b{y}_{0}+c}{\sqrt{{a}^{2}+{b}^{2}}}$

But there is still a possibility when the numerator $a{x}_{0}+b{y}_{0}+c$ is negative. To avoid it being negative, its modulus has to be taken,

$d=\frac{\left|a{x}_{0}+b{y}_{0}+c\right|}{\sqrt{{a}^{2}+{b}^{2}}}$

We don’t run into that problem since the denominator is a sum of squares of non-zero numbers, so it will always be positive.

To write the same expression in a more convenient (and easy to remember) form, let us define the equation of the line as $f\left(x,y\right)=ax+by+c$ to get $f\left({x}_{0},{y}_{0}\right)=a{x}_{0}+b{y}_{0}+c$, leaving us with,

$d=\frac{\left|f\left({x}_{0},{y}_{0}\right)\right|}{\sqrt{{a}^{2}+{b}^{2}}}$

Now let us apply this formula through a couple of examples.

## Calculating the distance from a point to a line

Calculating the distance from a line to a point is a relatively straightforward process. The equation of a line shall be given and the point to which the distance should be calculated.

Find the distance between the line $4x+3y-2=0$ and the point $\left(2,4\right)$.

**Solution**

Comparing the given equation to the general form, we get a=4, b=3 and c=-2, and x_{0}=2, y_{0}=4.

Recalling the distance formula and substituting all the corresponding values we get,

$d=\frac{\left|a{x}_{0}+b{y}_{0}+c\right|}{\sqrt{{a}^{2}+{b}^{2}}}=\frac{\left|4\left(2\right)+3\left(4\right)-2\right|}{\sqrt{{4}^{2}+{3}^{2}}}=\frac{18}{5}$

Thus, the distance between the line $4x+3y-2=0$ and $\left(2,4\right)$ is $\frac{18}{5}$ units.

Find the distance between the line $5x-2y=0$ and the point $\left(3,0\right)$.

**Solution**

Comparing the given equation to the general form, we get a=5, b=-2 and c=0, and $\left({x}_{1},{y}_{1}\right)=\left(3,0\right)$.

Recalling the distance formula and substituting all the corresponding values we get,

$d=\frac{\left|a{x}_{0}+b{y}_{0}+c\right|}{\sqrt{{a}^{2}+{b}^{2}}}=\frac{\left|5\left(3\right)+0+0\right|}{\sqrt{{5}^{2}+{(-2)}^{2}}}=\frac{15}{\sqrt{29}}$

Thus, the distance between the line $5x-2y=0$ and (3,0) is $\frac{15}{\sqrt{29}}$ units.

## Distance from a point to a line example

Find the distance between the two lines whose equations are given by $y=2x-5$ and $y=2x+3$.

**Solution**

Notice that the two lines have the same slope, 2, which implies that they are parallel.

To find the distance between the two lines, we can take a point on one of those lines and use the ‘distance from a point to a line’ formula to get the distance.

Let us find the point on the first line $y=2x-5$ by substituting x=0 (as it is easy to calculate, any other value of x would have been equally valid),

$y=2\left(0\right)-5=-5$

Thus one point on the line is (0,-5). Now we can use the formula we derived earlier to find the distance between this point and the line $y=2x+3$.

$d=\frac{\left|a{x}_{1}+b{y}_{1}+c\right|}{\sqrt{{a}^{2}+{b}^{2}}}$

But first, we rewrite y=2x+3 in the general form to get, -2x+y-3=0, and hence we have a=-2, b=1 and c=-3, which we substitute in the above equation to get *d*:

$d=\frac{\left|0-5-3\right|}{\sqrt{5}}=\frac{8}{\sqrt{5}}$

Therefore, the distance between the point (0,-5) and the line $y=2x+3$ is $\frac{8}{\sqrt{5}}$ units.

But remember that this point lies on the line $y=2x-5$ and these lines are parallel, so the distance between the two lines is also $\frac{8}{\sqrt{5}}$ as described earlier.

## Distance from a Point to a Line - Key takeaways

- The distance between a point and a line can be measured in many distinct ways but the shortest distance between them is the one that counts.
- The distance between a point and a line is measured by the shortest distance between them, it is also the same as the perpendicular distance between them.
- Let a line be given by $ax+by+c=0$, then the distance between this line and the point $\left({x}_{1},{y}_{1}\right)$ is given by the formula $d=\frac{\left|a{x}_{1}+b{y}_{1}+c\right|}{\sqrt{{a}^{2}+{b}^{2}}}$.

###### Learn with 2 Distance from a Point to a Line flashcards in the free StudySmarter app

We have **14,000 flashcards** about Dynamic Landscapes.

Already have an account? Log in

##### Frequently Asked Questions about Distance from a Point to a Line

How do you find the closest distance from a point to a line?

The closest distance between a line given by f(x,y)=ax+by+c=0 and a point (x_{1},y_{1}) is given by d=|f(x_{1},y_{1})|/(a^{2}+b^{2})^{1/2}

Why is the shortest distance from a point to a line perpendicular?

The shortest distance between a point and a line is the same as the perpendicular distance between them.

What is the distance from a point to a line?

The distance from a point to a line is the measure of the shortest path between them.

What is the distance of point (- 3, 4) from the origin?

The distance from any point from to the origin is the root of the sum of squares of its coordinates: d^{2}=(-3)^{2}+4^{2}

which gives us d=5. Hence the distance of that point is 5 units from the origin.

What is the distance of the point P (- 6, 8) from the origin?

The distance from any point from to the origin is the root of the sum of squares of its co-ordinates: d^{2}=(-6)^{2}+8^{2}

which gives us d=10. Hence the distance of that point is 10 units from the origin.

##### About StudySmarter

StudySmarter is a globally recognized educational technology company, offering a holistic learning platform designed for students of all ages and educational levels. Our platform provides learning support for a wide range of subjects, including STEM, Social Sciences, and Languages and also helps students to successfully master various tests and exams worldwide, such as GCSE, A Level, SAT, ACT, Abitur, and more. We offer an extensive library of learning materials, including interactive flashcards, comprehensive textbook solutions, and detailed explanations. The cutting-edge technology and tools we provide help students create their own learning materials. StudySmarter’s content is not only expert-verified but also regularly updated to ensure accuracy and relevance.

Learn more