The probability that a random variable $X$ with binomial distribution $B(n,p)$ is equal to the value $k$, where $k = 0, 1,\dots,n$. If we have the $(n\times m)$matrix and $N_j$,
$$f(x)= 1/2 \binom{3}{1} (1-x)^{2}x^1 \binom{2}{2} (1-x)^{0}x^2 \binom{3}{0} (1-x)^{3}x^0+ 1/4 \binom{3}{2} (1-x)^{1}x^2 \binom{2}{0} (1-x)^{2}x^0 \binom{3}{3} (1-x)^{0}x^3+ {1/9} \binom{3}{0} (1-x)^{3}x^0 \binom{2}{1} (1-x)^{1}x^1 \binom{3}{1} (1-x)^{2}x^1$$
My attempts using the Mathematica:
mat = {{1, 2, 0, 1/2}, {2, 0, 3, 1/4}, {0, 1, 1, 1/9}};
n1 = 3;
n2 = 2;
n3 = 3;
The solution was found, but manually using some functions:
mat[[1, 4]] Binomial[n1, mat[[1, 1]]] (1 - x)^{n1 - mat[[1, 1]]} (x)^mat[[1, 1]] Binomial[n2,mat[[1, 2]]] (1 - x)^{n2 - mat[[1, 2]]} (x)^mat[[1, 2]] Binomial[n3,mat[[1, 3]]] (1 - x)^{n3 - mat[[1, 3]]} (x)^mat[[1, 3]]
If the size of the matrix is larger, the solution will be difficult. Is there an automatic code that works in general?
I searched in previous answers and did not find a similar case.