GATE / CS ARCHIVE

GATE CSE 2000 / QUESTION 1.2

Sum of a difference array

Discrete Mathematics · Combinatorics & Counting · Full GATE CSE 2000 paper

GATE 2000, Q1.2 1 mark · MCQ
Report issue

Combinatorics & Counting

Question 1.2, GATE 2000: For 1≤i,j≤n, define v[i,j]=i−j. Find the sum of all n² entries. Options include 0,n−1,n²−3n+2,n²(n+1)/2.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

Step 1: Pair entry(i,j) with entry(j,i). Their values i−j and j−i add to zero; diagonal entries are themselves zero.

Step 2: Equivalently, the double sum is n·sum_i i−n·sum_j j, whose terms cancel exactly.

Thus the total is zero for every positive n, option A. Counting only the positive triangular half would omit the equal negative half.

Original paper, page 1