[Math] In how many ways can three different integers be selected

combinatorics

Question:

In how many ways can three different integers be selected from the numbers $1$ to $12$,so that their sum can be exactly divided by $3$?

Solution:

if order is not important (as i am not sure about this) total ways= $4\cdot3\cdot2 + (4\cdot4\cdot4)\cdot 3!= 24 + 192 = 216$

if order is important, total ways = $\binom{4}{3} + \binom{4}{1}\cdot\binom{4}{1}\cdot\binom{4}{1} = 4 + 64 = 68$

Is my solution correct?

Best Answer

Note that in order that the sum of $3$ number will be divided by $3$, you have that their sum modulo $3$ will be $0$, therefore you could have the next possibilities:

  • $3$ numbers that are $0$ modulo $3$
  • $3$ numbers that are $1$ modulo $3$
  • $3$ numbers that are $2$ modulo $3$
  • $3$ numbers such that one is $0$ modulo $3$, one is $1$ modulo $3$ and one is $2$ modulo $3$

it's not hard to calculate each one of those cases, and since they are disjoint the sum of them to get the wanted result.