2
$\begingroup$

Objective: find the amount of $4$-digit positive integers with distinct digits, in which the sum of the first two digits is equal to the sum of the last two digits.

For the sake of clarity:

  • these are examples of numbers to be found: $1524,\ 9045,\ 3461$;
  • these are examples of numbers to avoid: $6161$ (digits are not distinct), $7235$ ($7$+$2\ne 3$+$5$), $0312$ (it is a $3$-digit number).

I would like to solve the exercise by a probabilistic/rigorous manner. But until now I was only able to use reasoning.

One way to see the problem is: "how many ways are there to get a number as a sum of two distinct digits?". Notice that the sum of two distinct digits is at least $1\ (0+1)$ and at maximum $17\ (8+9)$; moreover notice that we need at least two ways to obtain a number because we have two distinct pairs of distinct digits, so we can discard the numbers $1,2,16$ and $17$ because they can be obtained in only one way $(0+1,\ 0+2,\ 7+9$ and $8+9$ respectively).

It's easy to see how many ways there are to get a number a sum of two distinct digits, for example $3=0+3=1+2\ (2 \text{ ways}),\ 4=0+4=1+3\ (2),\ 5=0+5=1+4=2+3\ (3)$ and so on. Notice that if we fix the first pair of digits and their sum is $s$, the remaining ways to get $s$ are $\text{"number of ways to get s"}-1$ because $1$ way was already taken by the first two digits.

It follows that, excluding the way taken by the first pair of digits, the number of ways to get the numbers $3,4,...,15$ as a sum of two distinct digits are: $3\ (1),\ 4\ (1),\ 5\ (2),\ 6\ (2),\ 7\ (3),\ 8\ (3),\ 9\ (4),\ 10\ (3),\ 11\ (3),\ 12\ (2),\ 13\ (2),\ 14\ (1),\ 15\ (1)$.

Let's say we want to find all the numbers of four digits with first digit equal to $2$ and such that the sum of the first two digits equals the sum of the last two digits. The second digit can be $1,3,...,9$ (cannot be $2$ because digits have to be distinct, cannot be $0$ for what we said before about discarded numbers), so the sum of the first two digits can be $3,5,...,11$. Now, in order to get the amount of numbers of four distinct digits knowing that the first digit is $2$ and that the sum of the first two digits equals the sum of the last two digits, we simply need to sum all the possible ways to get the numbers $3,5,...,11$ and multiply the result by $2$ (because if we switch the third digit with the last one we get a different number, for example if we fix the first pair of digits to be $2$ and $1$, there is only one remaining way to get $3$ ($0+3$) but we can costruct two different numbers using $0$ and $3$: $2103$ and $2130$): $1+2+2+3+3+4+3+3=21$, and $21\cdot2=42$.

If the first digit is $1$, the sum of the first two digits can be $3,4,...,10$, so there are $(1+1+2+2+3+3+4+3)\cdot2=19\cdot2=38$ four-digit positive integers with distinct digits, first digit $1$, and such that the sum of the first two digits equals the sum of the last two digits.

If the first digit is $3$, we get $(1+1+2+3+3+4+3+3+2)\cdot2=22\cdot2=44$ four-digit numbers.

If the first digit is $4$, we get $(1+2+2+3+4+3+3+2+2)\cdot2=22\cdot2=44$ four-digit numbers.

If the first digit is $5$, we get $(2+2+3+3+4+3+2+2+1)\cdot2=22\cdot2=44$ four-digit numbers.

If the first digit is $6$, we get $(2+3+3+4+3+3+2+1+1)\cdot2=22\cdot2=44$ four-digit numbers.

If the first digit is $7$, we get $(3+3+4+3+3+2+2+1)\cdot2=21\cdot2=42$ four-digit numbers.

If the first digit is $8$, we get $(3+4+3+3+2+2+1+1)\cdot2=19\cdot2=38$ four-digit numbers.

If the first digit is $9$, we get $(4+3+3+2+2+1+1)\cdot2=16\cdot2=32$ four-digit numbers.

So the total amount seems to be $368$.


The are some problems with this reasoning: it cannot be applied to different exercises, it cannot be written in a probability test because it doesn't use probabilistic manner, it needs a lot of time to be made, and more importantly, we don't know if the result is correct since the reasoning is not rigorous.

So what is the proper way of solving it?

$\endgroup$
1
$\begingroup$

First ignore the leading zero problem.

If the digits are $a<b<c<d$, the first two digits must be $a,d$ in some order or $b,c$ in some order, similar for the others. So this $(a,b,c,d)$ gives us $8$ numbers. How many such tuples $(a,b,c,d)$ are there? For fixed $\delta:=b-a$, we have $10-2\delta\choose 2$ ways to pick two distinct elements $x<y$ of $\{0,1\ldots,9-2\delta\}$ and let $a=x$, $b=x+\delta$, $c=y+\delta$, $d=x+2\delta$. As $\delta$ may run from $1$ to $4$, we get $$\tag18\cdot\left({8\choose 2}+{6\choose2}+{4\choose 2}+{2\choose 2}\right)=400.$$ Now, we have to get rid of the leading zeroes, which are those where we pick $x=0$ above and also choose to put $a$ in front. That's $$\tag22\cdot\left({7\choose 1}+{5\choose1}+{3\choose 1}+{1\choose 1}\right)=32.$$ The final answer is $(1)-(2)=$ $$368.$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy