Combinatorics – Find the Total Possible Combinations of Three Variables

combinatorics

I have three variables in a programming function, and a 4th variable depends on these. I have to test the dependent variable against all combinations of the three variables:

  • Var A: 2 possible values
  • Var B: 3 possible values
  • Var C: 5 possible values

The order of the three variables is not important. How can I find the number of possible combinations of these three variables, so that I know how many tests would need to be written?

Note:
I have asked a further question regarding this:

Now I know that there are 30 combinations of these three variables
(2x3x5), but how do I draw this in table form?

If each variable was binary, I could draw a truth table: 000, 001, 010
etc. But is there an equivalent system for the combination I have
detailed here?

Thanks

Brian

Best Answer

For each of the $2$ possible values of $A$ there are $3$ possible values of $B$; that makes $2\cdot 3=6$ possible combinations, as you can see by setting up a $2\times 3$ grid showing all $6$ combinations.

$$\begin{array}{|c|c|c|c|}\\ \hline &b_1&b_2&b_3\\ \hline a_1&(a_1,b_1)&(a_1,b_2)&(a_1,b_3)\\ \hline a_2&(a_2,b_1)&(a_2,b_2)&(a_2,b_3)\\ \hline \end{array}$$

Each of these $6$ combinations can in turn be combined with any of the $5$ possible values of $C$, so the same reasoning gives you a total of $6\cdot5=30$ combinations.

The general principle, sometimes called the multiplication or Chinese menu principle, is that if you have a sequence of $n$ choices to be made, and the $k$-th choice can be make in $m_k$ ways independently of the other choices, then the total number of ways to make the combined choice is $$m_1m_2m_3\dots m_n\;,$$ the product of the numbers of ways to make the individual choices.

Related Question