Matrices and determinants over the integers Let $A$ be a $3\times 3 $ diagonal matrix and its entries integers and its determinant is $120$. How many such matrices are there?
 A: We have $$120=2^3\times 5\times 3$$
So the numbers we can put in diagonal entries are multiplications of three $2$s, one $3$ and one $5$. In addition we can also put $1$ and negative numbers in the multiplications.  


*

*Considering negative numbers, either exactly two of the entries are negative or
none of them are negative. So there are ${3\choose 2}+{3\choose 0}=4$ ways we can
distribute negative sign. Therefore we can solve the problem for
positive integers and then multiply by $4$.

*Considering $1$, as long as it is not alone in an entry, it doesn't
count (i.e. it don't produce new numbers when it is multiplied with
other numbers). So we can solve the problem for positive entries greater than 1, but allow entries to be empty. The empty entries are filled with $1$.


We can look at the problem in this way: We have 5 objects (3 of them equal) and we want to distribute them into 3 distinct positions (some positions may be empty).
Let's suppose that all the numbers were distinct. Then in how many ways we could do it?
The number of ways we can distribute m distinct balls into n distinct bins (with no restriction) is $n^m$. So we get $3^5=243$.
Since three of the numbers were equal (three $2$s), we must do something to make up for considering them as different. What should we do?
