用点差法
设直线方程为y-1=k(x-2),P1,P2为(x1,y1),(x2,y2),中点坐标为((x1+x2)/2,(y1+y2)/2)
将两点坐标分别代入方程,两式再相减得:
(x1-x2)*(x1+x2)=0.5*(y1-y2)*(y1+y2)
(y1-y2)/(x1-x2)=2*(x1+x2)/(y1+y2)
(y-1)/(x-2)=2*(2x)/(2y)
整理得2x^2-y^2-4x+y=0
用点差法
设直线方程为y-1=k(x-2),P1,P2为(x1,y1),(x2,y2),中点坐标为((x1+x2)/2,(y1+y2)/2)
将两点坐标分别代入方程,两式再相减得:
(x1-x2)*(x1+x2)=0.5*(y1-y2)*(y1+y2)
(y1-y2)/(x1-x2)=2*(x1+x2)/(y1+y2)
(y-1)/(x-2)=2*(2x)/(2y)
整理得2x^2-y^2-4x+y=0