已故一条直线经过P1(X1,Y1)和P2(X2,Y2),且X1#X2,求该直线的方程.
问题描述:
已故一条直线经过P1(X1,Y1)和P2(X2,Y2),且X1#X2,求该直线的方程.
答
(y-y2):(x-x2)=(y-y1):(x-x1)
(x-x2)y-y1(x-x2)=y(x-x1)-y2*(x-x1)
y(x1-x2)=y1(x-x2)-y2*(x-x1)
y=(y1-y2)x/(x1-x2)+(y2x1-y1x2)/(x1-x2)
答
设方程为:y=kx+b,由题意可得:k=(y2-y1)/(x2-x1),所以y=(y2-y1)/(x2-x1)*x+b,再把x=x1,y=y1代入得:b=(x2*y1-y2x1)/(x2-x1),所以展开得:y=(y2-y1)/(x2-x1)*x+(x2y1-x1y2)/(x2-x1)