# Produce formula

Let $$a_{i,j}$$ any positive integers wher $$1\leq i,j \leq 3$$.

I want to write closed form for following summation:

$$a_{1,3}(a_{2,1}+a_{2, 2}+a_{2,3})(a_{3,1}+a_{3, 2}+a_{3,3})+a_{2,3}(a_{1,1}+a_{1, 2})(a_{3,1}+a_{3, 2}+a_{3,3})+a_{3,3}(a_{1,1}+a_{1, 2})(a_{2,1}+a_{2, 2})$$

$$\textbf{My attempt:}$$ $$\begin{equation*} \sum_{j=1}^3 a_{j,3}\left[\prod_{\substack{i=1 \\ i\neq j}}^3\left(\sum_{\substack{k=1 \\ k We will take $$3-1$$ when $$k.

Actually, I want to generalize this. My attempt so complicated to me.

If we consider all of $$a_{i,j}$$ as a matrix: $$\begin{pmatrix} 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} \\ \end{pmatrix}$$ then are there any computer program to make formula?

$$a_{1,3}(a_{2,1}+a_{2, 2}+ a_{2,3})(a_{3,1}+a_{3, 2}+a_{3,3})\cdots (a_{r,1}+a_{r,2}+a_{r,3})+a_{2,3}(a_{1,1}+a_{1, 2})(a_{3,1}+a_{3, 2}+a_{3,3})+\cdots (a_{r,1}+a_{r,2}+a_{r,3})+a_{3,3}(a_{1,1}+a_{1, 2})(a_{2,1}+a_{2, 2})(a_{4,1}+a_{4,2}+a_{4,3}+\cdots (a_{r,1}+a_{r,2}+a_{r,3}) \\ \vdots \\ +a_{r,3}(a_{1,1}+a_{1,2})(a_{2,1}+a_{2,2})\cdots (a_{r-1,1}+a_{r-1,2})$$

$$a_{1,3}(a_{2,1}+a_{2, 2}+a_{2,3})(a_{3,1}+a_{3, 2}+a_{3,3})+a_{2,3}(a_{1,1}+a_{1, 2})(a_{3,1}+a_{3, 2}+a_{3,3})+a_{3,3}(a_{1,1}+a_{1, 2})(a_{2,1}+a_{2, 2})$$ $$=(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})-(a_{1,1}+a_{1,2})(a_{2,1}+a_{2,2})(a_{3,1}+a_{3,2})$$ $$=\prod_{i=1}^3\sum_{j=1}^3a_{i,j}-\prod_{i=1}^3\sum_{j=1}^2a_{i,j}.$$ More generally, $$\sum_{i=1}^ra_{i,m}\left(\prod_{h=1}^{i-1}\sum_{j=1}^{m-1}a_{h,j}\right)\left(\prod_{h=i+1}^r\sum_{j=1}^ma_{h,j}\right)=\prod_{i=1}^r\sum_{j=1}^ma_{i,j}-\prod_{i=1}^r\sum_{j=1}^{m-1}a_{i,j}$$ $$=\sum_{m\in\{j_1,j_2,\dots,j_r\}}a_{1,j_1}a_{2,j_2}\cdots a_{r,j_r}.$$
• For example, $n!=\prod_{i=1}^ni$ and in particular $0!=\prod_{i=1}^0i=1$. Likewise, $x^n=\prod_{i=1}^nx$, in particular, $x^0=\prod_{i=1}^0x=1$. – bof Nov 29 '18 at 8:59
• $\sum_{m\in\{j_1,j_2,\dots,j_r\}}a_{1,j_1}a_{2,j_2}\cdots a_{r,j_r}$ is the sum of all products of the form $a_{1,j_1}a_{2,j_2}\cdots a_{r,j_r}$ where at least one of the indices $j_1,j_2,\dots,j_r$ is equal to $m$, or in other words, $m$ is an element of the set $\{j_1,j_2,\dots,j_r\}$. – bof Nov 29 '18 at 9:04
• $$\prod_{i=1}^2\sum_{j=1}^2a_{i,j}=(a_{1,1}+a_{1,2})(a_{2,1}+a_{2,2})=a_{1,1}a_{2,1}+a_{1,1}a_{2,2}+a_{1,2}a_{2,1}+a_{1,2}a_{2,2}$$ while $$\sum_{2\in\{j_1,j_2\}}a_{1,j_1}a_{2,j_2}=a_{1,1}a_{2,2}+a_{1,2}a_{2,1}+a_{1,2}a_{2,2}.$$ The term $a_{1,1}a_{2,1}$ is gone because $2\notin\{j_1,j_2\}=\{1,1\}$. – bof Nov 30 '18 at 6:57