Concrete Mathematics: Sum of on or above main diagonal of an array (deriving equation 2.33)

I would like to check my understanding of an Iversonian equation presented shortly before 2.33 (page 37 in paper book) of Concrete Mathematics (Graham, Knuth, Patashnik). They discuss deriving a simple formula for finding the sum of all elements on or above the main diagonal of an array. The book says:

Our goal is to find a simple formula for

$$S_◹ = \sum_{1 \le j \le k \le n} a_ja_k$$

I get that part however I am unsure of the Iversonian equation:

$$[1 \le j \le k \le n] + [1 \le k \le j \le n] = [1 \le j,k \le n] + [1 \le j=k \le n]$$

Why is it not simply:

$$[1 \le j \le k \le n] + [1 \le k \le j \le n] = [1 \le j,k \le n]$$

I think this is because, in the process of doing the LHS $$[1 \le j \le k \le n] + [1 \le k \le j \le n]$$ we count the diagonal twice. Hence adding it on again on the RHS of that Iversonian equation.

• This question has arisen a few times on MSE; you might try looking at a site-specific google. Commented Nov 12, 2023 at 1:05
• Thank you, I will review that and use the site-specific Google search in the future. Commented Nov 13, 2023 at 3:20

Your assumption is correct. We have \begin{align*} &\color{blue}{[1 \le j \le k \le n] + [1 \le k \le j \le n] }\\ &\qquad=\left([1 \le j < k \le n] +[1 \le j = k \le n]\right)\\ &\qquad\qquad + \left([1 \le k < j \le n] + [1 \le k = j \le n]\right)\\ &\qquad=\left([1 \le j < k \le n] +[1 \le j = k \le n] + [1 \le k < j \le n] \right)\\ &\qquad\qquad + [1 \le k = j \le n]\\ &\qquad\color{blue}{=[1 \le j, k \le n]+[1 \le j = k \le n]} \end{align*} according to the claim.