in DS edited by
47 votes

An $n \times n$ array $v$ is defined as follows:

$v\left[i,j\right] = i - j$ for all $i, j, i \leq n, 1 \leq j \leq n$

The sum of the elements of the array $v$ is

  1. $0$
  2. $n-1$
  3. $n^2 - 3n +2$
  4. $n^2 \frac{\left(n+1\right)}{2}$
in DS edited by


square matrix whose transpose is its negation; that is, it satisfies the condition −A = AT. If the entry in the i th row and j th column is aij, i.e. A = (aij) then the skew symmetric condition is aij = −aji

hence answer is A

why i ≤ n is given?? Shouldn't it be 1 ≤  i ≤  n ??
why we are not taking i=0 as i<=n ??
0 as array size is [n,n] by taking i=0 and i<=n it will go beyond array size...

how will be v[0,0] will be defined , only i will be 0 what value j will take as j domain does not have 0.
misprint in GO pdf
In question, it is given as 1 <= j <= n, means range of j is from 1 to n.

And i <= n, means what is the range of i here?  I mean i value can be ‘0’ also, i.e. range of i can be 0 to n-1 also.

Any suggestion please

And i <= n, means what is the range of i here?  I mean i value can be ‘0’ also, i.e. range of i can be 0 to n-1 also.

1<= j <= n( which represents column number) as given in question.

Now look at the first element of a 2-D array, it should be either at (0,0) or (1,1) according to the convention chosen, but here j should be greater than 1, so the possibility of using (0,0) is ruled out.

We have to use the convention in which first element of the 2-D array is at (1,1). Using (0,1) makes no sense here.


Subscribe to GO Classes for GATE CSE 2022

7 Answers

47 votes
Best answer
The sum of the $i^{th}$ row and $i^{th}$ column is $0$ as shown below. Since, the numbers of rows equals the number of columns, the total sum will be $0$.$$\begin{array}{|l|l|l|l|l|} \hline \text{0} & \text{-1} & \text{-2} & \text{-3} & \text{-4}\\\hline \text{1} & \text{0} & \text{-1} & \text{-2} & \text{-3}  \\\hline \text{2} & \text{1} & \text{0} & \text{-1} & \text{-2} \\\hline \text{3} & \text{2} & \text{1} & \text{0} & \text{-1}\\\hline \text{4} & \text{3} & \text{2} & \text{1} & \text{0}\\\hline \end{array}$$Correct Answer: $A$
edited by


this matrix is also a skew symmetric matrix, so definitely it's sum will be 0.
hello here i value is greater than 1  then how can u take -1 or 0 plz let me know
But this is not defined for j = 0. Or what is its signifacance?
22 votes
If you look at code carefully it is very clear matrix getting defined is skew symmetric matrix.

Sum of all elements in skew symmetric matrix is 0.

Answer :-A 0
18 votes
Let there are total N rows . You will find ∑ of elements of row i + ∑ of elements row (N-i+1) = 0.

So if N is even then

row 1 + row N =0

row 2 + row (N-1) =0

row 3 + row (N-2)=0

similarly row (N/2) + row (N/2+1) =0.   (So total sum is 0)

But if N is odd then row ((N+1)/2) will have no corresponding rows BUT Ithe summation of elements of this row is 0 .

So for N = even or Odd , the sum of element is 0 .
6 votes

i think we can easily get it without drawing matrix
   as expression given v[i, j] = i - j
suppose i1-j1=k1   {for a particular index } so its opposit index shows j1-i1=-k1, for example if v[1,2]=x then v[2,1]=-x}
  so we have  cases here
1. for all  i>j v[i, j] = i - j and jut for opposit indexof v[i, j] = i - j , v[j, i] = j - i =-(i-j) :: note this is for non diagonal elements 
2. for all i=j v[i, j] = i - j=0  :: note this is for diagonal elaments
so total sum will be zero ucan easily get it by seeing above cases


6 votes
sum of all elements =n*( $\sum_{i=1}^{n}i-\sum_{j=1}^{n}j )= 0$
4 votes
ans is option (a) i.e 0

solution: suppose if n=3

then i<=3 and 1<=j<=3

i.e i=1,2,3, and j=1,2,3

=> v={i-j}=(0,-1,-2,1,0,-1,2,1,0}

sum of elements in v=0
edited by

1 comment

@prakash What if i take, i=0,1,2.   and j=1,2,3...? then it will be skew symmetric matrix..?
0 votes
Answer is Option----A

Assume n=2;

then the condition is i<=2 and 1<=j<=2

now the values are i={1,2} and j={1,2}

Given, v[i] [j]= i-j;

now the values will be v ={1-1,1-2,2-1,2-2};


sum of all values present in v is 0..

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true