Articulo de referencia

Distancia desde un punto a una línea

La distancia (o distancia perpendicular ) de un punto a una recta es la distancia más corta desde un punto fijo a cualquier punto de una recta infinita fija en geometría euclidi...

La distancia (o distancia perpendicular ) de un punto a una recta es la distancia más corta desde un punto fijo a cualquier punto de una recta infinita fija en geometría euclidiana . Es la longitud del segmento de recta que une el punto con la recta y es perpendicular a ella. La fórmula para calcularla puede derivarse y expresarse de diversas maneras.

Conocer la distancia más corta de un punto a una línea puede ser útil en diversas situaciones ; por ejemplo, para encontrar la distancia más corta para llegar a una carretera, cuantificar la dispersión en un gráfico, etc. En la regresión de Deming , un tipo de ajuste de curvas lineales , si las variables dependientes e independientes tienen la misma varianza, esto da como resultado una regresión ortogonal en la que el grado de imperfección del ajuste se mide para cada punto de datos como la distancia perpendicular del punto a la línea de regresión.

Coordenadas cartesianas

Línea definida por una ecuación

En el caso de una línea en el plano dada por la ecuaciónaincógnita+by+do=0{\displaystyle ax+by+c=0}dóndea{\displaystyle a},b{\displaystyle b}ydo{\displaystyle c}son constantes reales cona{\displaystyle a}yb{\displaystyle b}no ambos cero, la distancia desde la línea a un punto(incógnita0,y0){\displaystyle (x_{0},y_{0})}es [ 1 ] [ 2 ] : pág. 14

distancia(aincógnita+by+do=0,(incógnita0,y0))=|aincógnita0+by0+do|a2+b2.{\displaystyle \operatorname {distancia} (ax+by+c=0,(x_{0},y_{0}))={\frac {|ax_{0}+by_{0}+c|}{\sqrt {a^{2}+b^{2}}}}.}

El punto en esta línea que está más cerca de(incógnita0,y0){\displaystyle (x_{0},y_{0})}tiene coordenadas: [ 3 ]

incógnita=b(bincógnita0ay0)adoa2+b2 y y=a(bincógnita0+ay0)bdoa2+b2{\displaystyle x={\frac {b(bx_{0}-ay_{0})-ac}{a^{2}+b^{2}}}{\text{ y }}y={\frac {a(-bx_{0}+ay_{0})-bc}{a^{2}+b^{2}}}}

o equivalentemente

incógnita=incógnita0aaincógnita0+by0+doa2+b2{\displaystyle x=x_{0}-a{\frac {ax_{0}+by_{0}+c}{a^{2}+b^{2}}}}yy=y0baincógnita0+by0+doa2+b2{\displaystyle y=y_{0}-b{\frac {ax_{0}+by_{0}+c}{a^{2}+b^{2}}}}

Líneas horizontales y verticales

En la ecuación general de una línea,aincógnita+by+do=0{\displaystyle ax+by+c=0},a{\displaystyle a}yb{\displaystyle b}no pueden ser ambos cero a menos quedo{\displaystyle c}también es cero; en ese caso, la ecuación no define una línea. Sia=0{\displaystyle a=0}yb0{\displaystyle b\neq 0}, la línea es horizontal y tiene ecuacióny=do/b{\displaystyle y=-c/b}La distancia desde(incógnita0,y0){\displaystyle (x_{0},y_{0})}Esta línea se mide a lo largo de un segmento de línea vertical de longitud|y0(do/b)|=|by0+do|/|b|{\displaystyle |y_{0}-(-c/b)|=|by_{0}+c|/|b|}de acuerdo con la fórmula. De manera similar, para líneas verticales(b=0){\displaystyle (b=0)}La distancia entre el mismo punto y la línea es|aincógnita0+do|/|a|{\displaystyle |ax_{0}+c|/|a|}, medido a lo largo de un segmento de línea horizontal.

Línea definida por dos puntos

Si la línea pasa por dos puntosPAG1=(incógnita1,y1){\displaystyle P_{1}=(x_{1},y_{1})}yPAG2=(incógnita2,y2){\displaystyle P_{2}=(x_{2},y_{2})}entonces la distancia de(incógnita0,y0){\displaystyle (x_{0},y_{0})}de la línea es:

distancia(PAG1,PAG2,(incógnita0,y0))=|(y2y1)incógnita0(incógnita2incógnita1)y0+incógnita2y1y2incógnita1|(y2y1)2+(incógnita2incógnita1)2.{\displaystyle \operatorname {distance} (P_{1},P_{2},(x_{0},y_{0}))={\frac {|(y_{2}-y_{1})x_{0}-(x_{2}-x_{1})y_{0}+x_{2}y_{1}-y_{2}x_{1}|}{\sqrt {(y_{2}-y_{1})^{2}+(x_{2}-x_{1})^{2}}}}.}

El denominador de esta expresión es la distancia entrePAG1{\displaystyle P_{1}}yPAG2{\displaystyle P_{2}}. El numerador es el doble del área del triángulo con sus vértices en los tres puntos,(incógnita0,y0){\displaystyle (x_{0},y_{0})},PAG1{\displaystyle P_{1}}yPAG2{\displaystyle P_{2}}. Véase: Área de un triángulo §  Uso de coordenadas . La expresión es equivalente ah=2Ab{\textstyle h={\frac {2A}{b}}}, que se puede obtener reorganizando la fórmula estándar para el área de un triángulo:A=12bh{\textstyle A={\frac {1}{2}}bh}, dóndeb{\displaystyle b}es la longitud de un lado, yh{\displaystyle h}es la altura perpendicular desde el vértice opuesto.

Línea definida por un punto y un ángulo.

Si la línea pasa por el puntoPAG=(PAGincógnita,PAGy){\displaystyle P=(P_{x},P_{y})}con ánguloθ{\displaystyle \theta }, entonces la distancia de algún punto(incógnita0,y0){\displaystyle (x_{0},y_{0})}a la línea es

distancia(PAG,θ,(incógnita0,y0))=|porque(θ)(PAGyy0)pecado(θ)(PAGincógnitaincógnita0)|{\displaystyle \operatorname {distance} (P,\theta ,(x_{0},y_{0}))=|\cos(\theta )(P_{y}-y_{0})-\sin(\theta )(P_{x}-x_{0})|}

Pruebas

Una demostración algebraica

Esta demostración es válida solo si la línea no es ni vertical ni horizontal, es decir, asumimos que nia{\displaystyle a}nib{\displaystyle b} in the equation of the line is zero.

The line with equation ax+by+c=0{\displaystyle ax+by+c=0} has slope a/b{\displaystyle -a/b}, so any line perpendicular to it will have slope b/a{\displaystyle b/a} (the negative reciprocal). Let (m,n){\displaystyle (m,n)} be the point of intersection of the line ax+by+c=0{\displaystyle ax+by+c=0} and the line perpendicular to it which passes through the point (x0,y0){\displaystyle (x_{0},y_{0})}. The line through these two points is perpendicular to the original line, so

y0nx0m=ba.{\displaystyle {\frac {y_{0}-n}{x_{0}-m}}={\frac {b}{a}}.}

Thus, a(y0n)b(x0m)=0,{\displaystyle a(y_{0}-n)-b(x_{0}-m)=0,} and by squaring this equation we obtain:

a2(y0n)2+b2(x0m)2=2ab(y0n)(x0m).{\displaystyle a^{2}(y_{0}-n)^{2}+b^{2}(x_{0}-m)^{2}=2ab(y_{0}-n)(x_{0}-m).}

Now consider,

(a(x0m)+b(y0n))2=a2(x0m)2+2ab(y0n)(x0m)+b2(y0n)2=(a2+b2)((x0m)2+(y0n)2){\displaystyle (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}=(a^{2}+b^{2})((x_{0}-m)^{2}+(y_{0}-n)^{2})}

using the above squared equation. But we also have,

(a(x0m)+b(y0n))2=(ax0+by0ambn)2=(ax0+by0+c)2{\displaystyle (a(x_{0}-m)+b(y_{0}-n))^{2}=(ax_{0}+by_{0}-am-bn)^{2}=(ax_{0}+by_{0}+c)^{2}}

since (m, n) is on ax + by + c = 0. Thus,

(a2+b2)((x0m)2+(y0n)2)=(ax0+by0+c)2{\displaystyle (a^{2}+b^{2})((x_{0}-m)^{2}+(y_{0}-n)^{2})=(ax_{0}+by_{0}+c)^{2}}

and we obtain the length of the line segment determined by these two points,

d=(x0m)2+(y0n)2=|ax0+by0+c|a2+b2.{\displaystyle d={\sqrt {(x_{0}-m)^{2}+(y_{0}-n)^{2}}}={\frac {|ax_{0}+by_{0}+c|}{\sqrt {a^{2}+b^{2}}}}.}[4]

A geometric proof

Diagram for geometric proof

This proof is valid only if the line is not horizontal or vertical.[5]

Drop a perpendicular from the point P{\displaystyle P} with coordinates (x0,y0){\displaystyle (x_{0},y_{0})} to the line with equation Ax+By+C=0{\displaystyle Ax+By+C=0}. Label the foot of the perpendicular R{\displaystyle R}. Draw the vertical line through P{\displaystyle P} and label its intersection with the given line S{\displaystyle S}. At any point T{\displaystyle T} on the line, draw a right triangleTVU{\displaystyle TVU} whose sides are horizontal and vertical line segments with hypotenuseTU{\displaystyle TU} on the given line and horizontal side of length |B|{\displaystyle |B|} (see diagram). The vertical side of TVU{\displaystyle \triangle TVU} will have length |A|{\displaystyle |A|} since the line has slope A/B{\displaystyle -A/B}.

PRS{\displaystyle \triangle PRS} and TVU{\displaystyle \triangle TVU} are similar triangles, since they are both right triangles and PSRTUV{\displaystyle \angle PSR\cong \angle TUV} since they are corresponding angles of a transversal to the parallel lines PS{\displaystyle PS} and UV{\displaystyle UV} (both are vertical lines).[6] Corresponding sides of these triangles are in the same ratio, so:

|PR¯||PS¯|=|TV¯||TU¯|.{\displaystyle {\frac {|{\overline {PR}}|}{|{\overline {PS}}|}}={\frac {|{\overline {TV}}|}{|{\overline {TU}}|}}.}

If point S{\displaystyle S} has coordinates (x0,m){\displaystyle (x_{0},m)} then |PS|=|y0m|{\displaystyle |PS|=|y_{0}-m|} and the distance from P{\displaystyle P} to the line is:

|PR¯|=|y0m||B|A2+B2.{\displaystyle |{\overline {PR}}|={\frac {|y_{0}-m||B|}{\sqrt {A^{2}+B^{2}}}}.}

Since S{\displaystyle S} is on the line, we can find the value of m{\displaystyle m},

m=Ax0CB,{\displaystyle m={\frac {-Ax_{0}-C}{B}},}

and finally obtain:[7]

|PR¯|=|Ax0+By0+C|A2+B2.{\displaystyle |{\overline {PR}}|={\frac {|Ax_{0}+By_{0}+C|}{\sqrt {A^{2}+B^{2}}}}.}

A variation of this proof is to place V{\displaystyle V} at P{\displaystyle P} and compute the area of the triangle UVT{\displaystyle \triangle UVT} two ways to obtain that D|TU¯|=|VU¯||VT¯|{\displaystyle D|{\overline {TU}}|=|{\overline {VU}}||{\overline {VT}}|} where D{\displaystyle D} is the altitude of UVT{\displaystyle \triangle UVT} drawn to the hypoteneuse of UVT{\displaystyle \triangle UVT} from P{\displaystyle P}. The distance formula can then used to express |TU¯|{\displaystyle |{\overline {TU}}|}, |VU¯|{\displaystyle |{\overline {VU}}|}, and |VT¯|{\displaystyle |{\overline {VT}}|}in terms of the coordinates of P{\displaystyle P} and the coefficients of the equation of the line to get the indicated formula.

A vector projection proof

Diagrama para la demostración de la proyección vectorial
Diagram for vector projection proof

Let P{\displaystyle P} be the point with coordinates (x0,y0){\displaystyle (x_{0},y_{0})} and let the given line have equation ax+by+c=0{\displaystyle ax+by+c=0}. Also, let Q=(x1,y1){\displaystyle Q=(x_{1},y_{1})} be any point on this line and n{\displaystyle n} the vector (a,b){\displaystyle (a,b)} starting at point Q{\displaystyle Q}. The vector n is perpendicular to the line, and the distance d{\displaystyle d} from point P{\displaystyle P} to the line is equal to the length of the orthogonal projection of QP{\displaystyle {\overrightarrow {QP}}} on n. The length of this projection is given by:

d=|QPn|n.{\displaystyle d={\frac {|{\overrightarrow {QP}}\cdot \mathbf {n} |}{\|\mathbf {n} \|}}.}

Now,

QP=(x0x1,y0y1),{\displaystyle {\overrightarrow {QP}}=(x_{0}-x_{1},y_{0}-y_{1}),} so QPn=a(x0x1)+b(y0y1){\displaystyle {\overrightarrow {QP}}\cdot \mathbf {n} =a(x_{0}-x_{1})+b(y_{0}-y_{1})} and n=a2+b2,{\displaystyle \|\mathbf {n} \|={\sqrt {a^{2}+b^{2}}},}

thus

d=|a(x0x1)+b(y0y1)|a2+b2.{\displaystyle d={\frac {|a(x_{0}-x_{1})+b(y_{0}-y_{1})|}{\sqrt {a^{2}+b^{2}}}}.}

Since Q{\displaystyle Q} is a point on the line, c=ax1by1{\displaystyle c=-ax_{1}-by_{1}}, and so,[8]

d=|ax0+by0+c|a2+b2.{\displaystyle d={\frac {|ax_{0}+by_{0}+c|}{\sqrt {a^{2}+b^{2}}}}.}

Another formula

Es posible obtener otra expresión para hallar la distancia mínima entre un punto y una línea. Esta deducción también requiere que la línea no sea vertical ni horizontal.

El puntoPAG{\displaystyle P}se da con coordenadas(incógnita0,y0){\displaystyle (x_{0},y_{0})}La ecuación de una recta viene dada pory=metroincógnita+k{\displaystyle y=mx+k}. La ecuación de la normal de esa línea que pasa por el puntoPAG{\displaystyle P}se day=incógnita0incógnitametro+y0{\displaystyle y={\frac {x_{0}-x}{m}}+y_{0}}.

El punto en el que se cruzan estas dos líneas es el punto más cercano en la línea original al puntoPAG{\displaystyle P}. Por eso:

metroincógnita+k=incógnita0incógnitametro+y0.{\displaystyle mx+k={\frac {x_{0}-x}{m}}+y_{0}.}

Podemos resolver esta ecuación paraincógnita{\displaystyle x},

incógnita=incógnita0+metroy0metrokmetro2+1.{\displaystyle x={\frac {x_{0}+my_{0}-mk}{m^{2}+1}}.}

Ely{\displaystyle y}La coordenada del punto de intersección se puede encontrar sustituyendo este valor deincógnita{\displaystyle x}en la ecuación de la línea original,

y=metro(incógnita0+metroy0metrok)metro2+1+k.{\displaystyle y=m{\frac {(x_{0}+my_{0}-mk)}{m^{2}+1}}+k.}

Utilizando la ecuación para hallar la distancia entre2{\displaystyle 2}agujas,d=(incógnita2incógnita1)2+(Y2Y1)2{\displaystyle d={\sqrt {(X_{2}-X_{1})^{2}+(Y_{2}-Y_{1})^{2}}}}Podemos deducir que la fórmula para hallar la distancia más corta entre una línea y un punto es la siguiente:

d=(incógnita0+metroy0metrokmetro2+1incógnita0)2+(metroincógnita0+metroy0metrokmetro2+1+ky0)2=|k+metroincógnita0y0|1+metro2.{\displaystyle d={\sqrt {\left({{\frac {x_{0}+my_{0}-mk}{m^{2}+1}}-x_{0}}\right)^{2}+\left({m{\frac {x_{0}+my_{0}-mk}{m^{2}+1}}+k-y_{0}}\right)^{2}}}={\frac {|k+mx_{0}-y_{0}|}{\sqrt {1+m^{2}}}}.}

Recordando quemetro=a/b{\displaystyle m=-a/b}yk=do/b{\displaystyle k=-c/b}para la línea con ecuaciónaincógnita+by+do=0{\displaystyle ax+by+c=0}, una pequeña simplificación algebraica reduce esto a la expresión estándar. [ 9 ]

Formulación vectorial

Ilustración de la formulación vectorial.

La ecuación de una recta se puede expresar en forma vectorial :

incógnita=a+tnorte{\displaystyle \mathbf {x} =\mathbf {a} +t\mathbf {n} }

Aquí a es la posición de un punto en la línea, y n es un vector unitario en la dirección de la línea. Entonces, como escalart{\displaystyle t}varía, x da el lugar geométrico de la línea.

La distancia de un punto arbitrario p a esta línea viene dada por

distancia(incógnita=a+tnorte,pag)=(apag)((apag)norte)norte.{\displaystyle \operatorname {distance} (\mathbf {x} =\mathbf {a} +t\mathbf {n} ,\mathbf {p} )=\|(\mathbf {a} -\mathbf {p} )-((\mathbf {a} -\mathbf {p} )\cdot \mathbf {n} )\mathbf {n} \|.}

Esta fórmula se puede derivar de la siguiente manera:apag{\displaystyle \mathbf {a} -\mathbf {p} }es un vector desde p hasta el punto a en la línea. Entonces(apag)norte{\displaystyle (\mathbf {a} -\mathbf {p} )\cdot \mathbf {n} }es la longitud proyectada sobre la línea y por lo tanto

((apag)norte)norte{\displaystyle ((\mathbf {a} -\mathbf {p} )\cdot \mathbf {n} )\mathbf {n} }

es un vector que es la proyección deapag{\displaystyle \mathbf {a} -\mathbf {p} }en la línea. Así

(apag)((apag)norte)norte{\displaystyle (\mathbf {a} -\mathbf {p} )-((\mathbf {a} -\mathbf {p} )\cdot \mathbf {n} )\mathbf {n} }

es el componente deapag{\displaystyle \mathbf {a} -\mathbf {p} }perpendicular a la línea. La distancia del punto a la línea es entonces simplemente la norma de ese vector. [ 10 ] Esta fórmula más general no se limita a dos dimensiones.

Otra formulación vectorial

Si la línea (l{\displaystyle l}) pasa por el puntoA{\displaystyle A}y tiene un vector de dirección{\displaystyle {\vec {u}}}, la distancia entre puntosPAG{\displaystyle P}y línea (l{\displaystyle l}) es

d(PAG,(l))=APAG×{\displaystyle d(\mathrm {P} ,(l))={\frac {\left\|{\overrightarrow {\mathrm {AP} }}\times {\vec {u}}\right\|}{\|{\vec {u}}\|}}}

dóndeAPAG×{\displaystyle {\overrightarrow {\mathrm {AP} }}\times {\vec {u}}}es el producto vectorial de los vectoresAPAG{\displaystyle {\overrightarrow {\mathrm {AP} }}}y{\displaystyle {\vec {u}}}y dónde{\displaystyle \|{\vec {u}}\|}es la norma vectorial de{\displaystyle {\vec {u}}}.

APAG=PAGA{\displaystyle {\overrightarrow {\mathrm {AP} }}=P-A}

Tenga en cuenta que los productos cruzados solo existen en dimensiones3{\displaystyle 3}y7{\displaystyle 7}y trivialmente en dimensiones0{\displaystyle 0}y1{\displaystyle 1}(donde el producto cruzado es constante)0{\displaystyle 0}).

Véase también

Notas

  1. Larson y Hostetler 2007 , pág. 452
  2. España 2007
  3. Larson y Hostetler 2007 , pág. 522
  4. Entre la certeza y la incertidumbre: Estadística y probabilidad en cinco unidades con notas sobre sus orígenes históricos y ejemplos numéricos ilustrativos.
  5. Ballantine y Jerbert (1952) no mencionan esta restricción en su artículo.
  6. Si los dos triángulos están en lados opuestos de la línea, estos ángulos son congruentes porque son ángulos alternos internos.
  7. Ballantine y Jerbert 1952
  8. Anton 1994 , págs. 138-9
  9. Larson y Hostetler 2007 , pág. 522
  10. Sunday, Dan. "Líneas y distancia de un punto a una línea" . softSurfer . Consultado el 6 de diciembre de 2013 .{{cite web}}: CS1 maint: servicio de archivado obsoleto ( enlace )

Referencias

  • Anton, Howard (1994), Álgebra lineal elemental (7.ª  ed.), John Wiley & Sons, ISBN 0-471-58742-7
  • Ballantine, JP; Jerbert, AR (1952), "Distancia de una línea o plano a un punto", American Mathematical Monthly , 59 (4): 242– 243, doi : 10.2307/2306514 , JSTOR 2306514 
  • Larson, Ron; Hostetler, Robert (2007), Precálculo: Un curso conciso , Houghton Mifflin Co., ISBN 978-0-618-62719-6
  • Spain, Barry (2007) [1957], Analytical Conics , Dover Publications, ISBN 978-0-486-45773-4

Lecturas adicionales

  • Deza, Michel Marie ; Deza, Elena (2013), Enciclopedia de distancias (2.ª  ed.), Springer, pág.  86, ISBN 9783642309588