I know numbers of four items and want to find out possible number of pairs I have 4 kinds of items a,b,c,d, and I know numbers of these four items: n1,n2,n3,n4. These items form pairs with each other and items of the same kind can also form a pair:ab, aa, ac, cd...Order doesn't matter, so ab and ba are the same. Now I don't know how many pairs are there between these items. Is there any possible way to calculate possible number of each pairs?
 A: You have $n_1$ items of type $a$, $n_2$ of type $b$, $n_3$ of type $c$, and $n_4$ of type $d$. Individual items of a given type are indistinct. You can choose $2$ items of one type or $1$ each of two types. The number of ways to choose two items of specified type is:
$$aa:\binom{n_1}{2}\quad bb:\binom{n_2}{2}\quad cc:\binom{n_3}{2}\quad dd:\binom{n_4}{2}\\[4ex]ab:n_1\times n_2\quad ac:n_1\times n_3\quad ad:n_1\times n_4\\[2ex]bc:n_2\times n_3\quad bd:n_2\times n_4\quad cd:n_3\times n_4$$
A: Let me introduce what is just a first step.
We shall first of all assume that
$$
n_{\;1}  + n_{\;2}  + n_{\;3}  + n_{\;4}  = 2m
$$
Then, since order doesn't matter,  we are going to arrange the couples alphabetically
$$
\left[ {\underbrace {aa, \ldots ,aa}_{c_{\,1,\,1} },\underbrace {ab, \ldots ,ab}_{c_{\,1,\,2} }, 
\cdots ,\underbrace {bb, \ldots }_{c_{\,2,\,2} }, \cdots \; \cdots ,cd,\underbrace {dd, \ldots ,dd}_{c_{\,4,\,4} }} \right]
$$
and indicate the number of each different couple by $c_{k,j}$ as shown.
Therefore the symmetric matrix   made up  by them as shown, shall satisfy
$$
\left( {\matrix{
   {2c_{\,1,\,1} } & {c_{\,1,\,2} } & {c_{\,1,\,3} } & {c_{\,1,\,4} }  \cr 
   {c_{\,2,\,1} } & {2c_{\,2,\,2} } & {c_{\,2,\,3} } & {c_{\,2,\,4} }  \cr 
   {c_{\,3,\,1} } & {c_{\,3,\,2} } & {2c_{\,3,\,3} } & {c_{\,3,\,4} }  \cr 
   {c_{\,4,\,1} } & {c_{\,4,\,2} } & {c_{\,4,\,3} } & {2c_{\,4,\,4} }  \cr 
 } } \right)\left( {\matrix{   1  \cr    1  \cr    1  \cr    1  \cr 
 } } \right) = \left( {\matrix{   {n_{\;1} }  \cr    {n_{\;2} }  \cr    {n_{\;3} }  \cr    {n_{\;4} }  \cr 
 } } \right)\quad \left| {\;c_{\,j,\,k}  = c_{\,k,\,j} } \right.
$$
which is a diophantine linear system of four equations in ten unknowns,
which are required to be non-negative integers.
We are interested in the number of solutions of such a system.
It is not an easy task, as you can see from the refered link.
