# swap summation and multiple

In which case can we swap summation and multiple? ie. $$\sum_{i=1}^n\prod_{j=1}^na_{ij}=\prod_{j=1}^n\sum_{i=1}^na_{ij}$$ if we can't swap like this, please tell me how can we swap them?

-

Take for example the case $n=2$. Then you are asking under what conditions we have $$ab+cd=(a+c)(b+d)\ .$$ Likewise, if $n=3$ you are asking whether $$abc+def+ghi=(a+d+g)(b+e+h)(c+f+i)\ .$$ These will only be true for very special values of $a,b,\ldots,i$ and in general there will be no way to swap the sum and product.
Let me take the case for $n=3$ using your notations $$\sum_{i=1}^n\prod_{j=1}^na(i,j)=\prod_{j=1}^n\sum_{i=1}^na(i,j)$$ After expansion of sum and product, the lhs write $$a(1,1) a(1,2) a(1,3)+a(2,1) a(2,2) a(2,3)+a(3,1) a(3,2) a(3,3)$$ while the rhs write $$(a(1,1)+a(2,1)+a(3,1)) (a(1,2)+a(2,2)+a(3,2)) (a(1,3)+a(2,3)+a(3,3))$$ As you see, they do not have much to to with eachother and, as said by David, you cannot swap sum and product.