# Double Summation: Need help to handle $i \neq j$ : $\sum_{i=0 \to 7,\ j=1 \to 8,\ i\neq j} (8i + j)$

[Q1]. Can I ? ( write the same summation as ) : $$\sum_{i=0, i \neq j}^7 \sum_{j=1}^8 (8i + j) \tag{1}$$

I tried to solve the following Summation as follows:

Let i = m-1 then, $\sum_{i=0,\ i \neq j}^7$ becomes $\sum_{m=1,\ j\neq m-1}^8$

Now applying change of base equation (1) i.e. $\sum_{i=0, i \neq j}^7 \sum_{j=1}^8 (8i + j)$ becomes $$\sum_{m=1,\ j\neq m-1}^8 \sum_{j=1}^8 \Big(8(m-1) + j \Big)$$

[Q2]. Can we do the next step? By what rule?

$$\text{Above}= \sum_{m=1,\ j=1, \ j\neq m-1}^8 (8m - 8 +j) \\ = (\sum_{m=1,\ j=1, \ j\neq m-1}^8 8m )- (\sum_{m=1,\ j=1, \ j\neq m-1}^8 8) + (\sum_{m=1,\ j=1, \ j\neq m-1}^8 j) \\ = 8\ \Big(\sum_{m=1}^8 m \Big)- 8 \ \Big(\sum_1^8 1 \Big) + \Big(\sum_{j=1}^8 j\Big) \\ = 8 \Big( 8. \frac{8+1}{2} \Big) - 8(8)+ \Big( 8. \frac{8+1}{2} \Big) \\ =260$$

[Q3]. Don't we need to handle $i \neq j$ ? If so, then in which situation does $i \neq j$ matter and how ? Please explain what iff. $i ==j$ then ?

Please clear my concept by answering all my 3 questions above(Q1,Q2 and Q3).

-
@Shuhao Cao has changed the formatting of the title so as to make it take up less vertical space -- this is a policy to ensure that the scarce space on the main page is distributed evenly over the questions. See here for more information. Please take this into consideration for future questions. Thanks in advance. – Lord_Farin Jun 21 '13 at 12:45

For your first question, the answer is yes, you can change indeed rewrite your outer sum by substituting $m-1$ for $j$ and changing the limits of that sum.

You can't, however, make the step indicated in your second question. Consider, for example, your middle summation. That sum is over all pairs $(m, j)$ satisfying by the predicate $$P(m, j) = (1\le m\le 8) \land (1\le j\le 8) \land (j\ne m-1)$$ There will $64-8 = 56$ terms in this sum. The first step in your argument was correct: $$\sum_{P(m, j)} 8 = 8\left(\sum_{P(m, j)} 1\right)$$ but your next step wasn't, since $$\sum_{P(m,j)} 1 \ne \sum_1^8 1$$ To see this, just observe that the sum on the left has 56 terms and the sum on the right has only 8.

Finally, a useful technique for problems like this is to ignore for the moment the excluded diagonal terms, sum all the terms, and then subtract the excluded ones. Using your chessboard idea, you noticed that the squares in the chessboard contain the numbers $1, \dots , 64$ so the sum of all the entries is $$\frac{64\cdot65}{2} = 2080$$ Now all we have to do is subtract the sum of the 7 diagonal elements in positions $$(k-1, k) = (2, 1), (3, 2), (4, 3), (5, 4), (6, 5), (7, 6), (8, 7)$$ where the values are $9, 18, 27, 36, 45, 54, 63$. The sum of these is 252, so the answer to the problem is $2080-252=1828$.

-
Hi @Rick. First of all - Thanks for adressing my concern! I hunch you got my chessboard idea wrong! It says - Once you have selected any cell, you can't select any other cell from that row and column. So you can select 8 cells max (one such combination e.g. numbered 1 ,10,29,38,47,55,64 whose sum is 260 ) – Arnab Dutta Jun 21 '13 at 19:57
Hi @Rick. I know m-1 change of variable is correct. But not sure if: $$\\$$ [Q1]. $$\sum_{i=0 \to 7,\ j=1 \to 8,\ i\neq j} (8i + j)$$ is same & can also be written as $$\sum_{i=0, i \neq j}^7 \sum_{j=1}^8 (8i + j)$$ $$\\$$ [Q2]. $$\sum_{m=1,\ j\neq m-1}^8 \sum_{j=1}^8 \Big(8(m-1) + j \Big)$$ can be combined and written as $$= \sum_{m=1,\ j=1, \ j\neq m-1}^8 (8m - 8 +j)$$ $$\\$$ [Q3]. In situations, when iff. $i \neq j$ or $i == j$ matters, then how to handle by 'Algebra of Summation' ? – Arnab Dutta Jun 21 '13 at 20:21
@Arnab I'll respond to both of your comments. First, I understood your chessboard result, but only used the part that made obvious the fact that the numbers 1 to 64 constituted the cell values. For your next comment, the answers to both Q1 and Q2 are "yes", as I explained in my answer. The answer to Q3 is that there's no simple way to handle the constraint $i\ne j$ in the framework of what you call "the algebra of summation", which is why I took an alternate approach. – Rick Decker Jun 21 '13 at 20:45
@Arnab. Glad it helped. By the way, did you notice that your chessboard result is true for any function $f$ used for filling of the cells as long as $f(i, j)$ can be expressed as the sum $g(i)+h(j)$? – Rick Decker Jun 21 '13 at 21:04

Let's go step by step.

\begin{align} \sum_{\substack{0 \le i \le 7 \\ 1 \le j \le 8 \\ i \ne j}} (8 i + j) &= \sum_{\substack{0 \le i \le 7 \\ 1 \le j \le 8}} (8 i + j) - \sum_{\substack{0 \le i \le 7 \\ 1 \le j \le 8 \\ i = j}} (8 i + j) \\ &= 8 \sum_{\substack{0 \le i \le 7 \\ 1 \le j \le 8}} i + \sum_{\substack{0 \le i \le 7 \\ 1 \le j \le 8}} j - \sum_{1 \le i \le 7} 9 i \\ &= 8 \cdot 8 \sum_{0 \le i \le 7} i + 8 \sum_{1 \le j \le 8} j - 9 \sum_{1 \le i \le 7} i \\ &= 8 \cdot 8 \cdot \frac{7 (7 + 1)}{2} + 8 \cdot \frac{8 (8 + 1)}{2} - 9 \cdot \frac{7 (7 + 1)}{2} \\ &= 1828 \end{align}

Here we used the fact that you can split off the sum over the excluded cases, that the sum is linear (and thus can split into sum over the terms), that summing over an index that doesn't change the term is just multiplying by the number of terms, and finally that

$$\sum_{0 \le k \le n} k = \frac{n (n + 1)}{2}$$

-

Q1 yes you can .

Q2 yes you can .

Q3 you need to subtract all the options of j to be i . You need to cover all the i in the sigma were j===I like this :

Sigma of m from 1 to 8 that divide (8m-8+j) because m-1= j >>> (8m-8+m-1) (9m-9)

-
really not enough explanation!...and more pathetic formatting – Arnab Dutta Jun 21 '13 at 13:32
What you did try to explain is not clear by a single statement + no explanation of Q2 – Arnab Dutta Jun 21 '13 at 13:46