1

Is it possible to add all elements of square matrix using single summation notation, instead of using double summation?

Dilya
  • 13

2 Answers2

1

Only if you take the simplification $\sum_i\sum_ja_{ij}=\sum_{ij}a_{ij}$, but that's still a double sum, or if you redefine the indexes $ij$ as natural numbers, for exemple, $a_{11}=a_1, a_{12}=a_2,...,a_{1n}=a_n,a_{21}=a_{n+1},...a_{2n}=a_{2n},...$ and, in general $a_{mk}=a_{mn+k}$. Then $\sum_{ij}a_{ij}=\sum_{i=1}^{n^2}a_i$

Andre Gomes
  • 2,115
1

If you mean notationally, then @Clarinetist's comment shows that the answer is yes.

If you mean computationally, as in, say, how you'd write a computer program to add the elements of such a matrix using a single loop, rather than two loops, then the answer is still yes but not as obvious.

To explain that, I'll give you a specific example so that you won't get confused by the notation. Say you have the 2x2 matrix $$ \begin{pmatrix} a_{11} & a_{12} \\ a_{21} & a_{22} \end{pmatrix} $$

The sum of its elements is, of course, $$ S = \sum_{i\,=\,1}^{2}\sum_{j\,=\,1}^{2}a_{ij} $$

But suppose that you have the elements stored in an array, as follows: $$ A = [a_{11}, a_{12}, a_{21}, a_{22}] $$

The elements are still part of a matrix but they're now indexed by a single index so that $A[1] = a_{11}$, $A[2] = a_{12}$, $A[3] = a_{21}$, $A[4] = a_{22}$. Then the sum is simply $$ S = \sum_{k\,=\,1}^{4}A[k] $$

This idea can be extended to a matrix of any dimension $m$x$n$, not just 2x2.

wltrup
  • 3,983