Find the number of elements in $s$ as per following criteria

37 Views Asked by At

Let $$s=\left\{\left(x_{1}, x_{2}, x_{3}\right) \mid 0 \leq x_{i} \leq 9 \text { and } x_{1}+x_{2}+x_{3} \text { is divisible by } 3\right\}$$ Then the number of elements in s is


My approach

With each $\left(x_{1}, x_{2}, x_{3}\right)$ identify a three digit code, where reading zeros are allowed. There is a bijection between s and the set of all non-negative integers less than or equal to 999 divisible by $3 .$ The no. of numbers between 1 and 999 , inclusive, divisible by 3 is $\left(\frac{999}{3}\right)=333$ Also, $0$ is divisible by 3 . Hence, the number of elements in $s$ is $=333+1=334$

Am I correct? please tell me if u have any better approach(if possible tell me any general approach,which will fit for all type of this problem)

2

There are 2 best solutions below

1
On

I'd be more inclined to be more direct.

$x_i \equiv 0,1 ,2$. There are $4$ cases where $x_i \equiv 0\equiv 0\equiv 3\equiv 6 \equiv 9\pmod 3$. And there are $3$ case where $x_i \equiv k\not\equiv 0 \pmod 3$. They are, if $k\equiv 1,2\pmod 3$, $x_i\equiv k\equiv k+3\equiv k+6\pmod 3$

If $x_1 + x_2 + x_3 \equiv 0 \pmod 3$ then $x_3 \equiv -(x_1 + x_2)\pmod 3$.

If $-(x_1 + x_2) \equiv 0\pmod 3$ there are $4$ ways $x_3\equiv -(x_1 + x_2)$. But if $-(x_1+x_2) \not \equiv 0 \pmod 3$ there are $3$ ways $x_3 \equiv -(x_1 + x_2)$.

So the total number of ways are

$4\cdot\text{number of ways }[-(x_1+x_2)\equiv 0]+3\cdot\text{number of ways }[-(x_1+x_2)\not \equiv 0]$

$-(x_1 + x_2) \equiv 0 \iff x_2\equiv -x_1$. If $x_1 \equiv 0$ (there are four ways that could occur) then $x_2\equiv 0$ (ditto) and there are $4\cdot 4-16$ ways that could occur. If $x_1 \not \equiv 0$ there are $6$ ways that could occur. Then if $x_2 \equiv -x_1\not \equiv 0$ there are $3$ ways that could occur. So there are $6\cdot 3=18$ that $-(x_1+x_2) \equiv 0; x_1\not \equiv 0$ can occur.

So $\text{number of ways }[-(x_1+x_2)\equiv 0]=16 + 18=34$.

If $-(x_1 + x_2)\not \equiv 0\iff x_2 \not \equiv -x_1$. If $x_1\equiv 0$ (there are four ways) then $x_2 \not \equiv 0$ (there are six ways). If $x_1\not \equiv 0$ (there are six ways). Then there are $3$ ways $x_2 \equiv -x_1$ and $10-3 =7$ ways $x_2 \not \equiv -x_1$.

So $\text{number of ways }[-(x_1+x_2)\not \equiv 0]=4\cdot 6 + 6\cdot 7=24 + 42=66$

so the number of ways that $x_1 + x_2 + x_3 \equiv 0$ are

$4\cdot 34 + 3\cdot 66 = 136 + 198 = 334$.

......

But all said and done, I think your way is easier and more clever.

Note $x_1 + x_2 + x_3\equiv 0 \pmod 3 \iff 100x_1 + 10x_2 + x_3 \equiv 0\pmod 3$.

And as you point out $f: \{(x_1, x_2, x_3)\} \to \{0,...,999\}$ via $f((x_1, x_2, x_3)) = 100x_1 + 10x_2 + x_3$ is a bijection.

Then number of elements where $x_1 + x_2+x_3$ are divisible by $3$ is the number numbers between $0$ and $999$ divisible by $3$ so .... $334$.

Much easier.

But relies on the sum of three in base ten rule....

Can we generalize it to how many or divisible by $k$ where $k$ isn't $3$ or $9$?

Let me get back to you on that.

1
On

Your method is the best. However an alternative (and a bit tedious ) approach is as follows

We have numbers each of the forms $3k:\{0,3,6,9\}$, $3k+1:\{1,4,7\}$ and $3k+2:\{2,5,8\}$. For $x_1+x_2+x_3$ to be divisible by $3$ :-

1.each of them must be of the same form$ \left[2\left(3! {3\choose3}+{3\choose1}{2\choose1}\frac{3!}{2!}+{3\choose1}\right)+\left(3! {4\choose3}+{4\choose1}{3\choose1}\frac{3!}{2!}+{4\choose1}\right)\right]=118$, or

2.each of them must be of different forms.
$\left[{4\choose1}{3\choose1}{3\choose1}3!\right]=216$

Thus counting the total no. of permutations we get $118+216=334$.