Evaluating a triple summation ${\sum \sum \sum}_{1 \le i < j \le k \le 20} a_ia_ja_k$

Essentially you want to count how many triplets $(i,j,k)$ will lead to $(a_i,a_j,a_k)$ to be one of the follow four possibilities: $(1,1,1),(1,1,2),(1,2,2),(2,2,2)$ (think about why these are the only possible outputs for $(a_i,a_j,a_k)$.

Now, count how many triplets of $(i,j,k)$ under the constraint $1\le i <j \le k\le 20$ will give you each of those four outputs. In particular,

$(a_i,a_j,a_k)=(1,1,1)$ if we have $1\le i <j \le k\le 10$. Say there are $A$ many such $(i,j,k)$.

$(a_i,a_j,a_k)=(1,1,2)$ if we have $1\le i <j \le 10$, $11\le k \le 20$. Say there are $B$ many such $(i,j,k)$.

$(a_i,a_j,a_k)=(1,2,2)$ if we have $1\le i \le 10$, $11\le j\le k \le 20$. Say there are $C$ many such $(i,j,k)$.

$(a_i,a_j,a_k)=(2,2,2)$ if we have $11\le i < j\le k \le 20$. Say there are $D$ many such $(i,j,k)$.

Then your final result will be $(1\cdot 1\cdot 1)A + (1\cdot 1\cdot 2)B + (1\cdot 2\cdot 2)C + (2\cdot 2\cdot 2) D$.

This turns it into a counting problem to find $A,B,C,D$.

(To check your work, you should get $A = 165, B = 450 , C = 550, D = 165$. And this gives the correct final sum.)


This approach is kind of bruteforce, but I could do it successfully using only pen and paper.

First, we'll consider the case $1 \le i \le 10$. We get a 2-dimensional matrix for the values that the addend can assume:

enter image description here

When you're doing this on paper, there's no need to write out all terms once you get the pattern, and an ellipsis works. Notice that For a given $i$, we will sum the lower triangle of this matrix from the index $i+1$. Therefore, as an example, for i=5, the sum will look like this:

enter image description here

The sum for $i$ is given as $$S_i = \sum_{t=1}^{10-i}t + 20(10-i) + 220$$ Summing this from 1 to 10, we get $$S_1 = \sum_{n=1}^9 \frac{n(n+1)}{2} + 20 \sum_{n=1}^9 n + 220 \times 10$$

We'll now consider $11 \le i \le 20$. In this case, the lower triangle assumes a value of 8, and the same pattern follows. The sum in this case is $$S_2 = 8\sum_{n=1}^9 \frac{n(n+1)}{2}$$

Adding $S_1$ and $S_2$, we get $$S = 9\sum_{n=1}^9 \frac{n(n+1)}{2} + 20 \sum_{n=1}^9 n + 2200$$

Evaluating this gives us $\boxed{S = 4585}$.

As an addendum, here's a simple python program I wrote to check the sum, and the additions that I made.

sum = 0
for i in range(1, 21):
    for j in range(i+1, 21):
        for k in range(j, 21):
            addend = 1
            if i > 10:
                addend *= 2
            if j > 10:
                addend *= 2
            if k > 10:
                addend *= 2
            sum += addend
            print(addend, end=" ")
        print("")

print(sum)

Let

  • $ A = \sum_{i < j < k } a_ia_ja_k$
  • $ B = \sum_{i = j < k } a_ia_ja_k$
  • $ C = \sum_{i < j = k } a_ia_ja_k$
  • $ D = \sum_{i = j = k } a_ia_ja_k$

We're after $ A + C$.

Clearly,

  • $ 30^3 = ( \sum a_i)^3 = D + 3C + 3B + 6A$.
  • $ D = 10 ( 1^3 + 2^3 ) = 90$
  • $C = 2^2 ( 10 \times 10\times 1 + \frac{10 \times 9 }{ 2} \times 2 ) + 1^2 (\frac{10 \times 9 } { 2} \times 1) = 805$
  • $ B = 1^2 (10\times 10 \times 2 + \frac{10 \times 9} { 2} \times 1) + 2^2 (\frac{10 \times 9 }{ 2} \times 2) = 605$
  • So, $A = \frac{30^3 - 90 - 3 \times 805 - 3 \times 605 }{ 6} = 3780$.

Hence, $ A + C = 4585$.