# What is the reasoning behind changing the order of summation in this example?

I stumbled upon this while reading a matrix multiplication associativity proof $$A(BC)=(AB)C$$.
I don't understand how you can change the order of summation thus can't understand the proof.
I attached an image and the part I don't understand is the seccond row. I would be thankful if someone could explain why and how changing the order of summation like this can be done.

• It's the distributive property, in sigma form. Commented Sep 24, 2019 at 15:12

These are finite sums, so the order of summation is always fine to change so long as we are summing over the exact same indices ($$a+b = b+a$$ extends inductively to any rearrangement of a finite sum). In this case the indices are “all values of $$k$$ between $$1$$ and $$p$$, paired with all values of $$j$$ between $$1$$ and $$n$$”. It makes no difference what order you take those two conditions in, especially as neither one has a dependent clause that depends on the specific value of the other (like if $$j$$ ranged up to $$k$$ instead of $$n$$).