k=(y2-y1)/(x2-x1)
y2-y1=k(x2-x1)
(y2-y1)²=k²(x2-x1)²
|P1P2|=√((x2-x1)²+(y2-y1)²)
=√((x2-x1)²+k²(x2-x1)²)
=√((1+k²)(x2-x1)²)
=√(1+k²)|x2-x1|
k=(y2-y1)/(x2-x1)
y2-y1=k(x2-x1)
(y2-y1)²=k²(x2-x1)²
|P1P2|=√((x2-x1)²+(y2-y1)²)
=√((x2-x1)²+k²(x2-x1)²)
=√((1+k²)(x2-x1)²)
=√(1+k²)|x2-x1|