5
$\begingroup$

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?

$\endgroup$
  • 7
    $\begingroup$ $$(1+2+3+4+5)^2$$ $\endgroup$ – Karl Hardr Jun 18 '13 at 13:17
  • 1
    $\begingroup$ If you want to keep a vector notation, $$\left(\begin{pmatrix} 1 \\ 2 \\ 3 \\ 4 \\ 5\end{pmatrix}^{\mathrm{T}}\begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \\ 1\end{pmatrix}\right)^2$$ or even, for general $x\in\mathbb{R}_+^n$, $\lVert x \rVert_1^2$. $\endgroup$ – Clement C. Jun 18 '13 at 13:22
  • $\begingroup$ Thanks. This was a trivialized example, I'm actually looking for a way to denote this with more complex expressions. $\endgroup$ – user1728853 Jun 18 '13 at 13:23
  • $\begingroup$ Just out of curiosity, why do you want more complex expressions? Generally in math you want an expression to be as simple as possible. $\endgroup$ – Ataraxia Jun 18 '13 at 13:25
  • $\begingroup$ What I mean is that the actual math I am doing for each pairwise combinations is more complex than simply squaring each number. $\endgroup$ – user1728853 Jun 18 '13 at 13:27
10
$\begingroup$

$\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$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.