Series

There are 100 points in 2D space :(x1,y1), (x2,y2), .... , (x100,y100).

Write a formula for the sum of squares of distances between all pair of points.

The number of terms in the formula should be as small as possible.

11 comments:

  1. 99[sum of X(i)^2+Y(i)^2]-2[sum of {X(m)X(n) + Y(m)Y(n)}

    where i---> 1to 100,
    m---> "
    n----> " & m =/= n

    ReplyDelete
  2. let us assume that in 1 step/computation we can do either 1 sum or 1 product. i'm talking about a formula that is computationally efficient in this sense.

    evaluation of X(i)^2 + Y(i)^2 for all 'i' requires 100+100 steps. evaluation of X(m)*X(n) requires about 100*99 steps. your formula would expand to about 20,000 computations.

    ReplyDelete
  3. 101(sum of x2)+101(sum of y2)-2(sum of x)2-2(sum of y)2

    ReplyDelete
  4. we don't have a correct answer yet.

    ReplyDelete
  5. 99*[summation(Xi^2+Yi^2)]

    ReplyDelete
  6. double sum j=1 to 100 i=1 to 100 [ (xi -xj)^2 + (yi-yj)^2 ]

    ReplyDelete
  7. bhaiya

    ur soln isn't giving correct ans

    maybe it shud be -200[summation Xi] & Yi

    pls see

    ReplyDelete
  8. sorry..
    answer is:
    100*(summation Xi^2)-(summation Xi)^2
    +100*(summation Yi^2)-(summation Yi)^2.

    ReplyDelete
  9. yup a nice one i just did a very silly mistake

    ReplyDelete