notes

Personal notes
git clone git://git.laack.co/notes.git
Log | Files | Refs

DistanceCalculation.md (728B)


      1 # Distance Calculation
      2 
      3 Khan
      4 
      5 **Definition:** Distance calculation in any dimension is defined as sqrt((x_1 - y_1)^2 + (x_2 - y_2)^2 ...)
      6 
      7 In the above definition x_1 is the first component of the first point (or vector), and y_1 is the first component of the second point (or vector). We then repeat this by subtracting them, squaring them and then summing all of them. Finally, we take the square root. 
      8 
      9 In 1d this manifests as simply subtracting the first component of both as we square that and then take the square root of that.
     10 
     11 In 2d we have for the example (1,2) and (10, 12):
     12 
     13 	= sqrt((1 - 10)^2 + (2 - 12)^2)
     14 	= sqrt(81 + 100)
     15 	= sqrt(181)
     16 	= 13.453...
     17 
     18 We can expand this to higher dimensions, but you get the idea.