直线方程 Ax + By + C = 0 的系数A,B,C有什么几何含义?

想把这个问题说清楚,不太容易。通过这篇文章,希望我能帮大家解决一些疑惑吧。

我们先来看A和B有什么含义。

在直线上取任意两点 P1:(x1, y1)和 P2:(x2, y2),得:

Ax1 + By1 + C = 0
Ax2 + By2 + C = 0

两式相减得:

A(x1 - x2) + B(y1 - y2) = 0

设O为圆点(0,0), 则:

OP1=x1y1 \begin{aligned} \overrightharpoon{OP1}= \begin{array} {|c|} x_{1} \\ y_{1}\\ \end{array} \end{aligned}
OP2=x2y2 \begin{aligned} \overrightharpoon{OP2}= \begin{array} {|c|} x_{2} \\ y_{2}\\ \end{array} \end{aligned}
P2P1=OP1OP2=x1x2y1y2 \begin{aligned} \overrightharpoon{P2P1}=\overrightharpoon{OP1}-\overrightharpoon{OP2}= \begin{array} {|c|} x_{1} - x_{2} \\ y_{1} - y_{2}\\ \end{array} \end{aligned}

P2P1\overrightharpoon{P2P1}与直线共线,上式A(x1 - x2) + B(y1 - y2) = 0,可写成向量的内积:

ABx1x2y1y2=ONP2P1\begin{array} {|c|} A \\ B \\ \end{array} \cdot \begin{array} {|c|} x_{1} - x_{2} \\ y_{1} - y_{2}\\ \end{array}=\overrightharpoon{ON}\cdot \overrightharpoon{P2P1} = 0

其中:

ON=AB\overrightharpoon{ON}=\begin{array} {|c|} A \\ B \\ \end{array}

两个向量的内积是0,根据内积的几何意义,这两个向量必然垂直。因此,系数A,B组成的向量是一个垂直于直线的向量。

在此,需要简要说明一下向量内积的几何意义,更深一层的意义,后续会出一篇文章单独来介绍。

V1V2\overrightharpoon{V1}\cdot\overrightharpoon{V2}的内积值等于V2\overrightharpoon{V2}V1\overrightharpoon{V1}上的投影长度乘以V1\overrightharpoon{V1}向量的长度,如下图:

直线方程 Ax + By + C = 0 的系数A,B,C有什么几何含义?
所以当V2与V1垂直时,V2在V1上的投影长度为0,V2与V1的内积为0。投影长度具有方向性,即投影与V1同向,投影长度为正,投影与V1反向,投影长度为负。所以我们可以根据内积的值来判断,两个向量的夹角范围:

值为正:> 0度 && < 90度
值为0:= 90度
值为负:> 90度 && < 180度

好了,回到线性方程 Ax + By = -C,将其写成向量式:

ABxy\begin{array} {|c|} A \\ B \\ \end{array}\cdot\begin{array} {|c|} x \\ y \\ \end{array} = ONOP=\overrightharpoon{ON}\cdot\overrightharpoon{OP}= -C

根据内积的几何意义,-C的值是OP\overrightharpoon{OP}ON\overrightharpoon{ON}上的投影长度乘以向量ON\overrightharpoon{ON}的向量长度。尤其是当ON\overrightharpoon{ON}是单位向量(向量长度为1)时,-C的值是原点距直线的距离。

即使ON\overrightharpoon{ON}不是单位向量,我们也可以将其转成单位向量,Ax + By = -C两边同时除以A2+B2\sqrt{A^2 + B^2},即:
AA2+B2x+BA2+B2y=CA2+B2\frac{A}{\sqrt{A^2 + B^2}}x + \frac{B}{\sqrt{A^2 + B^2}}y= \frac{-C}{\sqrt{A^2 + B^2}}

此时:

ON\overrightharpoon{ON} = AA2+B2BA2+B2\begin{array} {|c|} \frac{A}{\sqrt{A^2 + B^2}}\\ \frac{B}{\sqrt{A^2 + B^2}} \\ \end{array}为单位向量,原点距直线的距离则为:CA2+B2\frac{-C}{\sqrt{A^2 + B^2}}

好了,我们总结一下:A、B系数组成的向量垂直于直线,将A,B组成的向量转成单位向量,CA2+B2\frac{-C}{\sqrt{A^2 + B^2}}即是原点距直线的距离。

知道了该几何性质,我们可以计算空间任意一点距离直线的距离。步骤如下:假设空间任意一点P,做一条平行于已知直线并且经过点P的直线Ax+By=CA'x + B'y = C',计算出原点距该直线的距离:CA2+B2\frac{-C'}{\sqrt{A'^2 + B'^2}}

两距离相减得任意一点距离直线的距离:

distance = CA2+B2\frac{-C'}{\sqrt{A'^2 + B'^2}} - CA2+B2\frac{-C}{\sqrt{A^2 + B^2}}