# How many sequences of four numbers exist with these conditions?

First of all, this may seem very basic for you, but I've never been good at math, and I can't figure this out!

I need to solve the number of sequences that exist under this conditions:

• All sequences are made of four numbers like 0123
• All the numbers must be different
• The first and the last number are on the same horizontal line
• The second and third numbers are on the horizontal line immediately above the first and last number line

This is table that is provided with the problem

[1][2][3]
[4][5][6]
[7][8][9]
[-][0][+]


How many sequences exist under these conditions?

a) 72

b) 90

c) 162

d) 171

• For example, $4236$ would be allowed since all the numbers are different, $4$ and $6$ come from the second row and $2$ and $3$ come from the row above. Correct? – Michael Burr Feb 11 at 10:51
• Yes! That is one allowed sequence! – Andrej Hatzi Feb 11 at 10:55
• I might not have understood the problem statement correctly, but this is how I see the problem. The first and fourth digits can only be chosen from lines 2 and 3 since there is only one digit in the last line and there is obviously no line above the first line. We can choose a digit from the second line in 3 ways, then choose an item from the first line in 3 ways, then another one from this line in 2 ways and finally we have 2 options for the last digit. Multiplication yields 36 options. Then we have 72 more options if the 1st and 4th digits are chosen from the third line. – Don Draper Feb 11 at 10:57
• @DonDraper: do you mean $36+72$ ? – Yves Daoust Feb 11 at 10:59
• @YvesDaoust, yes, but it seems that this is wrong. – Don Draper Feb 11 at 11:00

As two pairs of different digits must be on the same row, $$0$$ is excluded.

You can choose the first and last digits freely in the second or third row, which makes $$2\cdot3\cdot2$$ options, then the second/third digits in the first or second row respectively.

In total,

$$2\cdot3\cdot2\cdot3\cdot2.$$

• Thank you, but can you explain it further? I am really bad at math! How did you arrived into this expression 2⋅3⋅2 ? – Andrej Hatzi Feb 11 at 11:05
• @AndrejHatzi: try to enumerate the solutions in a systematic way. – Yves Daoust Feb 11 at 11:08
• After 2 minutes of thinking about your explanation I could understand it! Thank you very much for your guidance! – Andrej Hatzi Feb 11 at 11:12
• @AndrejHatzi: I preferred to let you think rather than giving a straight answer. – Yves Daoust Feb 11 at 11:22

You shall only choose the first and last digit from the two middle rows. That's because the bottom row contains only one number and for the top row, there's no row above to choose the second and third digit.

Let's start by choosing two digits from the $$3$$rd row. We can choose and rearrange two items out of three in $$P(3,2)=\frac{3!}{1!}=6$$ ways. Following the exact same reasoning, for the second and third digit, we have: $$P(3,2)=\frac{3!}{1!}=6$$ ways for the middle digits.

Thus, $$6$$ ways to choose first and last digits and $$6$$ ways to choose second and third. That's a total of $$36$$ ways to choose all $$4$$ digits.

Also, we could repeat all these actions, choosing the first and last from the $$2$$nd row and the middle ones from the $$1$$st one. Again, that's a total of $$36$$ ways to choose all four digits.

At last, since we can carry out this procedure either the first $$36$$ ways or the other $$36$$ ways, the total ways are $$36+36=72.$$