0

Summation of $ij,$ can be evaluated by $\frac{(i+j)^2-i^2-j^2}{2}$ right?

3 Answers3

2

Yes. Expand $(i+j)^2 = (i+j)(i+j)= i(i+j)+j(i+j) = i^2 +2ij +j^2$ and follow the math.

$\frac{(i+j)^2-i^2-j^2}{2} = \frac{i^2 +2ij +j^2-i^2-j^2}{2} = \frac{2ij + i^2 -i^2 + j^2 - j^2}{2} = \frac{2ij + 0 + 0}{2} = \frac{2ij}{2} = ij$

RyRy the Fly Guy
  • 5,950
  • 1
  • 11
  • 27
1

Just to get it off the list of unanswered questions. Yes it can be evaluated like that.

0

Just to provide some details that you might need, to evaluate the sum of $(i + j)^2$, first we write out a grid of $i + j$, where rows are indexed by $i$ and columns indexed by $j$:

$$ \begin{array}{ccccc} \color{red}{2} & \color{blue}{3} & \color{green}{4} & \color{purple}{5} \\ \color{blue}{3} & \color{green}{4} & \color{purple}{5} & \color{green}{6} \\ \color{green}{4} & \color{purple}{5} & \color{green}{6} & \color{blue}{7} \\ \color{purple}{5} & \color{green}{6} & \color{blue}{7} & \color{red}{8} \end{array} $$

Now note that the square can be split into two halves by the purple diagonal, so we just split it into three sums and sum according to the pattern

$$ \sum_{i = 1}^N \sum_{j = 1}^N (i + j)^2 = \underbrace{\sum_{k = 2}^{N + 1} \underbrace{k}_{\text{Number}} \cdot \underbrace{(k - 1)}_{\text{# Times}}}_{\text{Top left}} + \underbrace{\color{purple}{(N - 1) \cdot N}}_{\text{Diagonal}} + \underbrace{\sum_{k = 2}^{N + 1} \underbrace{(2N - k)}_{\text{Number}} \cdot \underbrace{(k - 1)}_{\text{# Times}}}_{\text{Bottom right}} $$


Though the easiest to evaluate your original sum is just

$$ \sum_{i = 1}^N \sum_{j = 1}^N ij = \sum_{i = 1}^N i \sum_{j = 1}^N j = \left(\sum_{i = 1}^N i\right)^2 = \frac{N^2(N + 1)^2}{4} $$

Gareth Ma
  • 3,725