I have a vector of numbers that looks like this:
[1, 2, 3, 4, 5]
For every number the vector, I would like to multiply each number by every other number and find the sum:
1*1 + 1*2 + 1*3 + 1*4 + 1*5 + 2*1 + 2*2 + 2*3 + 2*4 + 2*5 + ... + 5*5
How can I write this in math notation?
Best Answer
$\sum_{i=1}^5 \sum_{j=1}^5 ij$.
However, you can also give the array $v$ values $v_i$ other than the index $i$. Then you would write:
$\sum_{i=1}^5 \sum_{j=1}^5 v_iv_j$.