Chapter 25: distance from a point to a line

點到直線距離

Theorem 25.1 {P=P(x0,y0)L=L(x,y)=Ax+By+C=0,A2+B20d(P,L)=|Ax0+By0+C|A2+B2

https://en.wikipedia.org/wiki/Distance_from_a_point_to_a_line

https://highscope.ch.ntu.edu.tw/wordpress/?p=47407

https://web.math.sinica.edu.tw/mathmedia/HTMLarticle18.jsp?mID=40312

Proofs:

25.1 by shortest ¯PP

P=P(x,y)L=Ax+By+C=0y=1B(Ax+C)

¯PP2(x,y)=(x0x)2+(y0y)2=(x0x)2+(y01B(Ax+C))2=(xx0)2+(ABx+CB+y0)2=¯PP2(x)

0=x¯PP2(x)=2(xx0)+2(ABx+CB+y0)AB=2B2(B2(xx0)+A2x+AC+ABy0)=2B2[(A2+B2)x(B2x0ABy0AC)]x=B2x0ABy0ACA2+B2 or by completing the square to find x.

¯PP2(x=B2x0ABy0ACA2+B2)=(B2x0ABy0ACA2+B2x0)2+(ABB2x0ABy0ACA2+B2+CB+y0)2=(A2x0ABy0ACA2+B2)2+(A(B2x0ABy0AC)+C(A2+B2)+B(A2+B2)y0B(A2+B2))2=(A(Ax0+By0+C)A2+B2)2+(AB2x0+B3y0+B2CB(A2+B2))2=A2(Ax0+By0+C)2(A2+B2)2+B2(Ax0+By0+C)2(A2+B2)2=(Ax0+By0+C)2A2+B2¯PP=¯PP(x=B2x0ABy0ACA2+B2)=|Ax0+By0+C|A2+B2

25.2 by perpendicular foot

y=ABxCB=1B(Ax+C), if B0

L:(y=BAx+K)(y=ABxCB):L

L=L(x,y)=BxAy+K=0 P=P(x0,y0)L=B(xx0)A(yy0)=0

L=BxAy(Bx0Ay0)=0 perpendicular foot = foot of the perpendicular P

P(LL)={L=Ax+By+C=0L=BxAy(Bx0Ay0)=0={Ax+By=CBxAy=Bx0Ay0P=P(x,y)=(|CBBx0Ay0A||ABBA|,|ACBBx0Ay0||ABBA|)=(|CBBx0+Ay0A||ABBA|,|ACBBx0+Ay0||ABBA|)=(B2x0ABy0ACA2+B2,ABx0+A2y0BCA2+B2)

d(P,L)=¯PP=

25.3 by normal vector

\begin{cases} \overset{\rightharpoonup}{n}=\left(A,B\right)\perp L=Ax+By+C=0\\ \overset{\rightharpoonup}{PP^{\prime}}=P^{\prime}-P=\left(x-x_{0},y-y_{0}\right) \end{cases}

PL的距離d\left(P,L\right)即為L線上一點P^{\prime}對應之\overset{\rightharpoonup}{PP^{\prime}}L法向量\overset{\rightharpoonup}{n}方向上的投影長

\begin{aligned} \overset{\rightharpoonup}{PP^{\prime}}\cdot\overset{\rightharpoonup}{n}= & \left\Vert \overset{\rightharpoonup}{PP^{\prime}}\right\Vert \left\Vert \overset{\rightharpoonup}{n}\right\Vert \cos\theta\\ \left|\overset{\rightharpoonup}{PP^{\prime}}\cdot\overset{\rightharpoonup}{n}\right|= & \left\Vert \overset{\rightharpoonup}{PP^{\prime}}\right\Vert \left\Vert \overset{\rightharpoonup}{n}\right\Vert \left|\cos\theta\right|\\ \left\Vert \overset{\rightharpoonup}{PP^{\prime}}\right\Vert \left|\cos\theta\right|= & \left|\overset{\rightharpoonup}{PP^{\prime}}\cdot\widehat{\boldsymbol{n}}\right|=\dfrac{\left|\overset{\rightharpoonup}{PP^{\prime}}\cdot\overset{\rightharpoonup}{n}\right|}{\left\Vert \overset{\rightharpoonup}{n}\right\Vert }=\dfrac{\left|\left(x-x_{0},y-y_{0}\right)\cdot\left(A,B\right)\right|}{\left\Vert \left(A,B\right)\right\Vert }\\ = & \dfrac{\left|A\left(x-x_{0}\right)+B\left(y-y_{0}\right)\right|}{\sqrt{A^{2}+B^{2}}}=\dfrac{\left|-Ax_{0}-By_{0}+Ax+By\right|}{\sqrt{A^{2}+B^{2}}}\\ \begin{subarray}{c} Ax+By+C=0\\ =\\ Ax+By=-C \end{subarray} & \dfrac{\left|-Ax_{0}-By_{0}-C\right|}{\sqrt{A^{2}+B^{2}}}=\dfrac{\left|Ax_{0}+By_{0}+C\right|}{\sqrt{A^{2}+B^{2}}} \end{aligned}

PDF LaTeX \usepackage{fdsymbol} to have \overrightharpoon vector; however, there are too many side effects, including ugly mathptmx \sum, …

\usepackage{fdsymbol} % vector over accent, but will use mathptmx
% replace the rather ugly mathptmx \sum operator with the equivalent Computer Modern one
\let\sum\relax
\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}
\DeclareMathSymbol{\sum}{\mathop}{CMlargesymbols}{"50}

25.4 by Cauchy inequality

\begin{aligned} Ax+By+C= & 0\\ Ax+By= & -C\\ \left(Ax+By\right)-\left(Ax_{0}+By_{0}\right)= & -C-\left(Ax_{0}+By_{0}\right)\\ A\left(x-x_{0}\right)+B\left(y-y_{0}\right)= & -\left(Ax_{0}+By_{0}+C\right) \end{aligned}

\begin{aligned} \overline{PP^{\prime}}^{2}= & \left(x_{0}-x\right)^{2}+\left(y_{0}-y\right)^{2}\\ \left[A^{2}+B^{2}\right]\overline{PP^{\prime}}^{2}= & \left[A^{2}+B^{2}\right]\left[\left(x_{0}-x\right)^{2}+\left(y_{0}-y\right)^{2}\right]\\ \ge & \left[A\left(x-x_{0}\right)+B\left(y-y_{0}\right)\right]^{2}\\ = & \left[-\left(Ax_{0}+By_{0}+C\right)\right]^{2}=\left(Ax_{0}+By_{0}+C\right)^{2}\\ \overline{PP^{\prime}}^{2}\ge & \dfrac{\left(Ax_{0}+By_{0}+C\right)^{2}}{A^{2}+B^{2}}\\ \overline{PP^{\prime}}\ge & \dfrac{\left|Ax_{0}+By_{0}+C\right|}{\sqrt{A^{2}+B^{2}}} \end{aligned}