Art of Problem Solving

Distance formula: Difference between revisions

Indymathk (talk | contribs)
Rairac (talk | contribs)
 
(3 intermediate revisions by the same user not shown)
Line 3: Line 3:


==Shortest distance from a point to a line==
==Shortest distance from a point to a line==
the distance between the line <math>ax+by+c = 0</math> and point <math>(x_1,y_1)</math> is
The distance between the line <imath>ax+by+c = 0</imath> and point <imath>(x_1,y_1)</imath> is
<cmath>\dfrac{|ax_1+by_1+c|}{\sqrt{a^2+b^2}}</cmath>
<cmath>\dfrac{|ax_1+by_1+c|}{\sqrt{a^2+b^2}}.</cmath>


===Proof===
===Proof===
The equation <math>ax + by + c = 0</math> can be written as <math>y = -\dfrac{a}{b}x - \dfrac{c}{b}</math>
The equation <imath>ax + by + c = 0</imath> can be written as <imath>y = -\dfrac{a}{b}x - \dfrac{c}{b}.</imath>
Thus, the perpendicular line through <math>(x_1,y_1)</math> is:
Thus, the perpendicular line through <imath>(x_1,y_1)</imath> is:
<cmath>\dfrac{x-x_1}{a}=\dfrac{y-y_1}{b}=\dfrac{t}{\sqrt{a^2+b^2}}</cmath>
<cmath>\dfrac{x-x_1}{a}=\dfrac{y-y_1}{b}=\dfrac{t}{\sqrt{a^2+b^2}},</cmath>
where <math>t</math> is the parameter.
where <imath>t</imath> is the parameter.


<math>t</math> will be the distance from the point <math>(x_1,y_1)</math> along the perpendicular line to <math>(x,y)</math>.
<imath>t</imath> will be the distance from the point <imath>(x_1,y_1)</imath> along the perpendicular line to <imath>(x,y)</imath>.
So <cmath>x = x_1 + a \cdot \dfrac{t}{\sqrt{a^2+b^2}}</cmath> and <cmath>y = y_1 + b \cdot \dfrac{t}{\sqrt{a^2+b^2}}</cmath>
So <cmath>x = x_1 + a \cdot \dfrac{t}{\sqrt{a^2+b^2}}</cmath> and <cmath>y = y_1 + b \cdot \dfrac{t}{\sqrt{a^2+b^2}}.</cmath>


This meets the given line <math>ax+by+c = 0</math>, where:
This meets the given line <imath>ax+by+c = 0</imath>, where:
<cmath>a\left(x_1 + a \cdot \dfrac{t}{\sqrt{a^2+b^2}}\right) + b\left(y_1 + b \cdot  \dfrac{t}{\sqrt{a^2+b^2}}\right) + c = 0</cmath>
<cmath>a\left(x_1 + a \cdot \dfrac{t}{\sqrt{a^2+b^2}}\right) + b\left(y_1 + b \cdot  \dfrac{t}{\sqrt{a^2+b^2}}\right) + c = 0</cmath>
<cmath>\implies ax_1 + by_1 + c + \dfrac{t(a^2+b^2)}{\sqrt{a^2+b^2}} + c = 0</cmath>
<cmath>\implies ax_1 + by_1 + c + \dfrac{t(a^2+b^2)}{\sqrt{a^2+b^2}} + c = 0</cmath>
<cmath>\implies ax_1 + by_1 + c + t \cdot \sqrt{a^2+b^2} = 0</cmath>
<cmath>\implies ax_1 + by_1 + c + t \cdot \sqrt{a^2+b^2} = 0,</cmath>


, so:
So,
<cmath> t \cdot \sqrt{a^2+b^2} = -(ax_1+by_1+c)</cmath>
<cmath> t \cdot \sqrt{a^2+b^2} = -(ax_1+by_1+c)</cmath>
<cmath>\implies t = \dfrac{-(ax_1+by_1+c)}{\sqrt{a^2+b^2}}</cmath>
<cmath>\implies t = \dfrac{-(ax_1+by_1+c)}{\sqrt{a^2+b^2}}.</cmath>


Therefore the perpendicular distance from <math>(x_1,y_1)</math> to the line <math>ax+by+c = 0</math> is:
Therefore, the perpendicular distance from <imath>(x_1,y_1)</imath> to the line <imath>ax+by+c = 0</imath> is:


<cmath>|t| = \dfrac{|ax_1 + by_1 + c|}{\sqrt{a^2+b^2}}</cmath>
<cmath>|t| = \dfrac{|ax_1 + by_1 + c|}{\sqrt{a^2+b^2}}.</cmath>




{{stub}}
{{stub}}

Latest revision as of 23:44, 10 November 2025

The distance formula is a direct application of the Pythagorean Theorem in the setting of a Cartesian coordinate system. In the two-dimensional case, it says that the distance between two points $P_1 = (x_1, y_1)$ and $P_2 = (x_2, y_2)$ is given by $d = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2}$. In the $n$-dimensional case, the distance between $(a_1,a_2,...,a_n)$ and $(b_1,b_2,...,b_n)$ is $\sqrt{(a_1-b_1)^2+(a_2-b_2)^2+\cdots+(a_n-b_n)^2}$.


Shortest distance from a point to a line

The distance between the line $ax+by+c = 0$ and point $(x_1,y_1)$ is \[\dfrac{|ax_1+by_1+c|}{\sqrt{a^2+b^2}}.\]

Proof

The equation $ax + by + c = 0$ can be written as $y = -\dfrac{a}{b}x - \dfrac{c}{b}.$ Thus, the perpendicular line through $(x_1,y_1)$ is: \[\dfrac{x-x_1}{a}=\dfrac{y-y_1}{b}=\dfrac{t}{\sqrt{a^2+b^2}},\] where $t$ is the parameter.

$t$ will be the distance from the point $(x_1,y_1)$ along the perpendicular line to $(x,y)$. So \[x = x_1 + a \cdot \dfrac{t}{\sqrt{a^2+b^2}}\] and \[y = y_1 + b \cdot \dfrac{t}{\sqrt{a^2+b^2}}.\]

This meets the given line $ax+by+c = 0$, where: \[a\left(x_1 + a \cdot \dfrac{t}{\sqrt{a^2+b^2}}\right) + b\left(y_1 + b \cdot  \dfrac{t}{\sqrt{a^2+b^2}}\right) + c = 0\] \[\implies ax_1 + by_1 + c + \dfrac{t(a^2+b^2)}{\sqrt{a^2+b^2}} + c = 0\] \[\implies ax_1 + by_1 + c + t \cdot \sqrt{a^2+b^2} = 0,\]

So, \[t \cdot \sqrt{a^2+b^2} = -(ax_1+by_1+c)\] \[\implies t = \dfrac{-(ax_1+by_1+c)}{\sqrt{a^2+b^2}}.\]

Therefore, the perpendicular distance from $(x_1,y_1)$ to the line $ax+by+c = 0$ is:

\[|t| = \dfrac{|ax_1 + by_1 + c|}{\sqrt{a^2+b^2}}.\]


This article is a stub. Help us out by expanding it.