When we have two points of different dimensions, how do we make sense of their distance?



In this exercise, we compute the distance between two points where the first is 2D and the second is 3D. How do we compute their difference when the dimensions are different?


If we have points p1 and p2 represented as arrays and the dimension, that is, the size of the array, of p1 is less than the dimension of p2. Then we make sense of the distance between these points by adding enough zeros to the end of the array for p1 until the sizes of the arrays are equal. Explicitly, if p1 = [1,0] and p2 = [1,1,,1,1], then Distance(p1,p2) is the same as Distance([1,0,0,0], p2).