1
$\begingroup$

I want to express $$\sum_{i=1}^N \sum_{j=1}^N a_{ij} x_i x_j$$ as matrix/vector multiplication. I've managed to get that the expression above is equal to $$x'Ax$$ where x is a vector, by expanding the sum but it took a while. Is there a faster way, which I can use to calculate it (and also be able to express matrix multiplication as a sum)?

$\endgroup$
5
  • 1
    $\begingroup$ What could be faster than $$x^\top A x$$ ? $\endgroup$ Commented Apr 8, 2020 at 12:10
  • 1
    $\begingroup$ By the way, you may want to look at the Einstein summation convention, it gives useful notation for these types of calculations $\endgroup$ Commented Apr 8, 2020 at 12:13
  • $\begingroup$ I might have phrased my question poorly. What I meant is 'how can I look at the summation and instantly tell what the equivalent matrix multiplication is?'. $\endgroup$ Commented Apr 8, 2020 at 12:47
  • 1
    $\begingroup$ Okay, the Einstein summation convention is what I was looking for. Thank you very much! $\endgroup$ Commented Apr 8, 2020 at 12:48
  • $\begingroup$ I’m voting to close this question because OP was just looking for Einstein summation convention. $\endgroup$
    – Kurt G.
    Commented Feb 19 at 3:30

1 Answer 1

1
$\begingroup$

Yes, it depends upon what value of $a_{ij}$ and $x$ you are choosing. Relate your question with this example. Suppose $x_i = 1$ and $x_j = 1$ for every value of $i$ and $j$ and $$a_{ij} = \frac{a_i a_j }{i+j+1}$$ where $1\le i,j\le N$ and $a_i, a_j \in \Bbb N$ then $$\sum_{i=1}^N \sum_{j=1}^N a_{ij} x_i x_j = \sum_{i=1}^N \sum_{j=1}^N \frac{a_i a_j }{i+j+1} = \int _{0}^ 1 f(x) f(x) $$ where $f(x) = a_1x + a_2 x^2 +\cdots a_n x^N $. You can relate $x' A x$ to standard inner product of $ Ax $ and $ x $ in real space.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .