[Math] Count all possible combinations

combinatorics

I want to check how many combinations of $2$ numbers I can generate from $20$ different numbers when the same number can be picked twice. I calculated it like this and answer is $20 \cdot 20 =400$. Is it correct? I used to do this when I was studying statistics, but I don't remember what this technique is called and what formula is used to calculate it. Surely, it's not Permutations or Combinations.
$$
1,2,3, \ldots, 20\\
(1,1), (1,2), (1,3), \ldots, (1,20)\\
\vdots\\
(20,1), (20,2), (20,3), \ldots (20, 20)
$$

Best Answer

Yes, the correct answer is 400. Here is one way to view the problem which may help demonstrate why this is the true.

Imagine a $20 \times 20$ grid where the each column is labeled from 1 to 20 and each row is (separately) labeled from 1 to 20. Picking the first number from 1-20 amounts to picking a column from the grid. Likewise, picking a second number from 1-20 (possibly the same number as the first) amounts to picking a row from the grid. Thus, each pair of numbers selected points to one and only one cell in the grid. Conversely, each cell in the grid points to one and only one pair of selected numbers (the column number and row number map to the first and second numbers selected).

Thus, since there is a one-to-one correspondence between the number of pairs of selected numbers and the number of cells in the grid, and that correspondence covers the entire grid, they must have the same size. Since there are 400 cells in the grid ($20 \times 20 = 400$), there must also be 400 ways to pick the two numbers.

Related Question