2

If we select random a element of the set $A=\{0000,0001,0002,...,9999\}$ which is the probability the sum of the first two digit is equal to the sum of the two last digit?

My work:

Let $S$="The set of posibility solutions of A", note $|S|=10000$ (sample space)

Let the event $E=$"The set of number such that the sum of the first two digit is equal to the sum of the two last digit"

We need calculate $|E|$.

We know the sum of the numbers is at most 18.

For 1: $(1+0), (0+1)$ total of number: 2

For 2: $(2+0), (0+2), (1+1)$ total of number: 3

For 3: $(3+0), (0+3), (2+1), (1+2)$ total of number: 4

For 4: $(4+0), (0+4), (3+1), (1+3), (2+2)$ total of number: 5

For 5: $(5+0), (0+5), (4+1), (1+4), (3+2), (2+3)$ total of number: 6

For 6: $(6+0), (0+6), (5+1), (1+5), (4+2), (2+4), (3+3)$ total of number: 7

For 7: $(7+0),(0+7),(6+1), (1+6), (4+3), (3+4), (5+2),(2+5)$ total of number: 8

For 8: $(8+0),(0+8),(7+1), (1+7), (6+2), (2+6), (5+3),(3+5),(4,4)$ total of number: 9

For 9: $(9+0),(0+9),(8+1), (1+8), (7+2), (2+7), (6+3),(3+6),(5,4),(4,5)$ total of number: 10

For 10: $(9+1), (1+9), (8+2), (2+8), (7+3),(3+7),(6,4),(4,6),(5,5)$ total of number: 9

For 11: $(9+2), (2+9), (8+3), (3+8), (7+4),(4+7),(6,5),(5,6),$ total of number: 8

For 12: $(9+3), (3+9), (8+4), (4+8), (7+5),(5+7),(6,6),$ total of number: 7

For 13: $(9+4), (4+9), (8+5), (5+8), (7+6),(6+7)$ total of number: 6

For 14: $(9+5), (5+9), (8+6), (6+8), (7+7)$ total of number: 5

For 15: $(9+6), (6+9), (8+7), (7+8)$ total of number: 4

For 16: $(9+7), (7+9), (8+8)$ total of number: 3

For 17: $(9+8), (8+9)$ total of number: 2

For 18: $(9+9)$ total of number: 1

Then $|E|=99$

In consequence the probability is 0.0099

How can make this by other way?

gt6989b
  • 54,422
rcoder
  • 4,545

5 Answers5

3

Your logic is missing a step. Consider all sequences in $E$ with sum $1$. You are right, there are 2 such generating subsequences, $01$ and $10$, but then there are $4$ satisfying strings in $E$, namely $1010, 1001, 0110, 0101$. This will alter the event count.

In addition you seemed to forget the sum of $0$.

gt6989b
  • 54,422
2

Here is a "non-formal" combinatoric way. All sums of two digits $0,1,\ldots ,9$ can be represented in a square pattern (primary-school addition table):

$\begin{matrix} 0&1&2&3&4&5&6&7&8&9 \\ 1&2&3&4&5&6&7&8&9&10 \\ 2 &\vdots &&&&&& \vdots &10 & 11 \\ \vdots &&&&&&&&& \vdots \\ 8&9&10&11&12&13&14&15&16&17 \\ 9&10&11&12&13&14&15&16&17&18 \end{matrix}$

We see, each possible sum of two digits from $0, 1 , \ldots ,8, 9 , 10, \ldots ,18$ corresponds to $1, 2, \ldots ,9, 10, 9, \ldots , 1$ possible combinations of two digits with the given sum.

So, we get for the number of possible 4-digit numbers satisfying the condition: $$1^2 + 2^2 + \cdots + 9^2 + 10^2 + 9^2 + \cdots + 1^2 = 2(1^2 + 2^2 + \cdots + 9^2) + 10^2 = 670$$

  • i don't see why $1^2 + 2^2 + \cdots + 9^2 + 10^2 + 9^2 + \cdots + 1^2$ you have this relation.... can explain me that detail? – rcoder Mar 29 '18 at 15:51
  • 1
    For example, for the digit sum 17 you have 2 possible combinations for the first 2 digits: $89..$, $98..$ . Exactly the same combinations you have for the last two digits. So, you get $2^2$ possible 4-digit codes with sum $17$: $8989,8998,9889,9898$. Use the same argument for all the possible 2-digit sums from $0$ through $18$. – trancelocation Mar 29 '18 at 18:30
1

Edit: This answer is wrong - see @gt6989b 's correct argument. I'll leave it up as instructive. Using his correct logic I think there's a recognizable pattern to sum.

You could recognize after the first few lines that you wanted twice the sum $1 + 2 + \cdots + 9$, which is easy to find.

You forgot to count $0000$ - an extra $1$ - so the probability is $1/10$.

Ethan Bolker
  • 95,224
  • 7
  • 108
  • 199
1

The sum of two uniform distribution is triangular.

The probability that the two digits is equal to the last two is equal to

\begin{align} &\sum_{i=0}^{18} P(\text{sum of first } 2 \text{ numbers} = i)^2 \\&= P(\text{sum of first } 2 \text{ numbers} = 9)^2 +2\sum_{i=0}^{8} P(\text{sum of first } 2 \text{ numbers} = i)^2\\ &=\left(\sum_{i=0}^9 \frac1{10^2}\right)^2 + 2\sum_{i=0}^8 \left( \sum_{j=0}^i \frac1{10^2}\right)^2\\ &=\frac{10^2}{10^4}+2\sum_{i=0}^8 \frac{(i+1)^2}{10^4}\\ &=\frac{10^2}{10^4}+2\sum_{i=1}^9 \frac{i^2}{10^4}\\ &=\frac{10^2}{10^4}+2\frac{9(9+1)(19)}{6\times10^4}\\ &=\frac{10+3(19)}{1000}\\ &=\frac{67}{1000} \end{align}

Siong Thye Goh
  • 149,520
  • 20
  • 88
  • 149
1

The number of ways to get a sum $s$ with two digits ranging from $0$ to $9$ is $$ \eqalign{ & N_b (s,9,2) = \sum\limits_{\left( {0\, \le } \right)\,\,k\,\,\left( { \le \,2} \right)} {\left( { - 1} \right)^k \left( \matrix{ 2 \hfill \cr k \hfill \cr} \right)\left( \matrix{ s + 1 - 10\,k \cr s - 10\,k \cr} \right)} = N_b (18 - s,9,2) = \cr & = \left\{ {\matrix{ {s + 1} & {0 \le s \le 9} \cr {18 - s + 1} & {10 \le s \le 18} \cr } } \right. \cr} $$ where $Nb$ is as explained in this other post
and in this case it is just the number of integer points on the diagonal $x+y=s$ of a square $(0\cdots 9)\times (0\cdots 9)$.

So the total number of ways is $$ N = 2\sum\limits_{0 \le s \le 8} {\left( {s + 1} \right)^{\,2} } + 10^{\,2} = 670 $$

G Cab
  • 35,272