Difference between revisions of "Distance formula"

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

Revision as of 19:26, 7 November 2013

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}$


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

--Shortest distance from a point to a line-- the distance between the line $ax+by+c = 0$ and point $(x_1,y_1)$ is \[|ax_1+by_1+c|/\sqrt(a^2+b^2)\]

---Proof--- The equation $ax + by + c = 0$ can be written as $y = -(a/b)x - (c/a)$ So the perpendicular line through $(x_1,y_1)$ is: \[(x-x_1)/a=(y-y_1)/b=t/\sqrt(a^2+b^2)\] where $t$ is a 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 * t/\sqrt(a^2+b^2)\] and \[y = y_1 + b* t/\sqrt(a^2+b^2)\]

This meets the given line $ax+by+c = 0$ where: \[a(x_1 + a * t/\sqrt(a^2+b^2)) + b(y1 + b* t/\sqrt(a^2+b^2)) + c = 0\] \[ax_1 + by_1 + c + t(a^2+b^2)/\sqrt(a^2+b^2) + c = 0\] \[ax_1 + by_1 + c + t * \sqrt(a^2+b^2) = 0\]

so \[t * sqrt(a^2+b^2) = -(ax_1+by_1+c)\] \[t = -(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| = (ax_1 + by_1 + c)/\sqrt(a^2+b^2)\]