Content deleted Content added
Citation bot (talk | contribs) Altered isbn. Add: jstor, issue. Upgrade ISBN10 to 13. | Use this bot. Report bugs. | #UCB_CommandLine |
|||
(37 intermediate revisions by 27 users not shown) | |||
Line 1:
{{Short description|Geometry problem}}
Knowing the shortest distance from a point to a line can be useful in various situations—for example, finding the shortest distance to reach a road, quantifying the scatter on a graph, etc. In [[Deming regression]], a type of linear curve fitting, if the dependent and independent variables have equal variance this results in [[orthogonal regression]] in which the degree of imperfection of the fit is measured for each data point as the perpendicular distance of the point from the regression line.
==Cartesian coordinates==
===Line defined by an equation===
In the case of a line in the plane given by the equation {{
:<math>\operatorname{distance}(ax+by+c=0, (x_0, y_0)) = \frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}. </math>
The point on this line which is closest to
:<math>x = \frac{b(bx_0 - ay_0)-ac}{a^2 + b^2} \text{ and } y = \frac{a(-bx_0 + ay_0) - bc}{a^2+b^2}.</math>
'''Horizontal and vertical lines'''
In the general equation of a line,
===Line defined by two points===
If the line passes through two points
:<math>\operatorname{distance}(P_1, P_2, (x_0, y_0)) = \frac{|(
The denominator of this expression is the distance between
== Line defined by point and angle ==
▲The denominator of this expression is the distance between {{math|''P''<sub>1</sub>}} and {{math|''P''<sub>2</sub>}}. The numerator is twice the area of the triangle with its vertices at the three points, {{math|(''x''<sub>0</sub>, ''y''<sub>0</sub>)}}, {{math|''P''<sub>1</sub>}} and {{math|''P''<sub>2</sub>}}. See: {{slink|Area of a triangle|Using coordinates}}. The expression is equivalent to {{math|1=''h'' = {{sfrac|2''A''|''b''}}}}, which can be obtained by rearranging the standard formula for the area of a triangle: {{math|1=''A'' = {{sfrac|1|2}} ''bh''}}, where {{mvar|b}} is the length of a side, and {{mvar|h}} is the perpendicular height from the opposite vertex.
If the line passes through the point {{math|1=''P'' = (''P''<sub>x</sub>, ''P''<sub>y</sub>)}} with angle {{math|''θ''}}, then the distance of some point {{math|(''x''<sub>0</sub>, ''y''<sub>0</sub>)}} to the line is
:<math>\operatorname{distance}(P, \theta, (x_0, y_0)) = |\cos(\theta)(P_y-y_0) -\sin(\theta)(P_x-x_0)| </math>
==Proofs==
===An algebraic proof===
This proof is valid only if the line is neither vertical nor horizontal, that is, we assume that neither
The line with equation
:<math>\frac{y_0 - n}{x_0 - m}=\frac{b}{a}.</math>
Thus,
Line 39 ⟶ 40:
Now consider,
:<math> (a(x_0 - m) + b(y_0 - n))^2
▲(a(x_0 - m) + b(y_0 - n))^2 & = a^2(x_0 - m)^2 + 2ab(y_0 -n)(x_0 - m) + b^2(y_0 - n)^2 \\
using the above squared equation. But we also have,
:<math> (a(x_0 - m) + b(y_0 - n))^2 = (ax_0 + by_0 - am -
since
Thus,
:<math>
and we obtain the length of the line segment determined by these two points,
:<math>d=\sqrt{(x_0 - m)^2+(y_0 - n)^2}
===A geometric proof===
Line 58 ⟶ 54:
This proof is valid only if the line is not horizontal or vertical.<ref>{{harvnb|Ballantine|Jerbert|1952}} do not mention this restriction in their article</ref>
Drop a perpendicular from the point ''P'' with coordinates (''x''<sub>0</sub>, ''y''<sub>0</sub>) to the line with equation ''Ax'' + ''By'' + ''C'' = 0. Label the foot of the perpendicular ''R''. Draw the vertical line through ''P'' and label its intersection with the given line ''S''. At any point ''T'' on the line, draw a right triangle ''TVU'' whose sides are horizontal and vertical line segments with hypotenuse ''TU'' on the given line and horizontal side of length |''B''| (see diagram). The vertical side of ∆''TVU'' will have length |''A''| since the line has slope
∆''PRS'' and ∆''TVU'' are [[similar triangles]], since they are both right triangles and ∠''PSR'' ≅ ∠''TUV'' since they are corresponding angles of a transversal to the parallel lines ''PS'' and ''UV'' (both are vertical lines).<ref>If the two triangles are on opposite sides of the line, these angles are congruent because they are alternate interior angles.</ref> Corresponding sides of these triangles are in the same ratio, so:
:<math>\frac{|\overline{PR}|}{|\overline{PS}|} = \frac{|\overline{TV}|}{|\overline{TU}|}.</math>
If point ''S'' has coordinates (''x''<sub>0</sub>,''m'') then |''PS''| = |''y''<sub>0</sub>
:<math> |\overline{PR} | = \frac{|y_0 - m||B|}{\sqrt{A^2 + B^2}}.</math>
Since ''S'' is on the line, we can find the value of m,
Line 70 ⟶ 66:
A variation of this proof is to place V at P and compute the area of the triangle ∆''UVT'' two ways to obtain that <math>D|\overline{TU}| = |\overline{VU}||\overline{VT}|</math>
where D is the altitude of ∆''UVT'' drawn to the
===A vector projection proof===
Line 101 ⟶ 97:
:<math>d=\sqrt{ \left( {\frac{x_0 + m y_0-mk}{m^2+1}-x_0 } \right) ^2 + \left( {m\frac{x_0+m y_0-mk}{m^2+1}+k-y_0 }\right) ^2 } = \frac{|k + m x_0 - y_0|}\sqrt{1 + m^2} .</math>
Recalling that ''m'' =
==Vector formulation==
Line 110 ⟶ 106:
: <math> \mathbf{x} = \mathbf{a} + t\mathbf{n}</math>
Here {{math|'''a'''}} is the position of a point on the line, and {{math|'''n'''}} is a [[unit vector]] in the direction of the line. Then as scalar ''t'' varies, {{math|'''x'''}} gives the [[locus (mathematics)|locus]] of the line.
The distance of an arbitrary point {{math|'''p'''}} to this line is given by
: <math>\operatorname{distance}(\mathbf{x} = \mathbf{a} + t\mathbf{n}, \mathbf{p}) = \| (\mathbf{
This formula can be derived as follows: <math>\mathbf{
:<math>
is a vector that is the [[projection (linear algebra)|projection]] of <math>\mathbf{
:<math>(\mathbf{
is the component of <math>\mathbf{
== Another vector formulation ==
If the
: <math>d(\mathrm{P}, (l))= \frac{\left\|\overrightarrow{\mathrm{AP}} \times\vec u\right\|}{\|\vec u\|}</math>
where <math>\overrightarrow{\mathrm{AP}} \times\vec u</math> is the [[cross product]] of the vectors <math>\overrightarrow{\mathrm{AP}}</math> and <math>\vec u</math> and where <math>\|\vec u\|</math> is the vector norm of <math>\vec u</math>.
<math>\overrightarrow{\mathrm{AP}}=P-A</math>
Note that cross products only exist in dimensions 3 and 7 and trivially in dimensions 0 and 1 (where the cross product is constant 0).
== See also ==
* [[Hesse normal form]]
* [[
* [[Distance between two parallel lines]]
* [[Distance from a point to a plane]]
*
==Notes==
Line 142 ⟶ 140:
==References==
* {{citation|first=Howard|last=Anton|title=Elementary Linear Algebra|edition=7th|year=1994|publisher=John Wiley & Sons|isbn=0-471-58742-7}}
* {{citation|first1=J.P.|last1=Ballantine|first2=A.R.|last2=Jerbert|year=1952|volume=59|title=Distance from a line or plane to a point|journal=American Mathematical Monthly|issue=4 |pages=242–243|doi=10.2307/2306514|jstor=2306514 }}
* {{citation|first1=Ron|last1=Larson|first2=Robert|last2=Hostetler|title=Precalculus: A Concise Course|year=2007|publisher=Houghton Mifflin Co.|isbn=978-0-618-62719-6|url-access=registration|url=https://archive.org/details/precalculusconci00lars}}
* {{citation|first=Barry|last=Spain|title=Analytical Conics|year=2007|orig-
==Further reading==
|