# Expand product of symbolic sums (with identically named indices)

I have an expression that is a product of two symbolic sums.

Sum[a[k], {k, 1, n}]*Sum[b[k], {k, 1, n}]


How can I expand this expression? I want to see something like this:

Sum[Sum[a[k1]*b[k2], {k2, 1, n}], {k1, 1, n}]


If the running indices weren't the same, I would try to fashion a transformation rule to match the situation above. But here, I'd have to create a new symbol, so I am unsure where to even start.

• "I'd have to create a new symbol" - this is where the built-in dummy variable K comes in handy; you can just systematically replace indices with K[1], K[2], etc. Jan 4, 2021 at 14:21

Note, a double sum can be written with a single Sum. With this we make a replacement:
   Sum[a[k], {k, 1, n}]*Sum[b[k], {k, 1, n}] /.