Question 703261
When you are asked to find the distance between 2 points,
The difference in the x-coordinates is one leg of a right
triangle, and the difference in the y-coordinates is the other
leg. The line connecting the points is the hypotenuse.
-------------
Suppose you are given the points ( -6, 11 ) and ( 9, -3 )
The length of one leg of the right triangle is {{{ 9 -(-6) }}}
The length of the other leg is {{{ -3 - 11 }}}
( you don't care if the lengths end up positive or negative )
--------------
{{{ 9 -(-6) = 15 }}}
{{{ -3 - 11 = -14 }}}
Let {{{ d }}} = the distance between the 2 points
{{{ d^2 = 15^2 + (-14)^2 }}}
{{{ d = sqrt( 15^2 + (-14)^2 ) }}}
{{{ d = sqrt( 225 + 196 ) }}}
{{{ d = sqrt( 421 ) }}}
{{{ d = 20.5183 }}}
----------------
Note that the minus sign went away when you squared {{{ -14 }}}
The complete formula you just used is:
{{{ d = sqrt( ( x[2] - x[1] )^2 + ( y[2] - y[1] )^2 ) }}}
You just did the subtraction in a previous step.
Hope this helps