# How do I calculate probability of drawing cards in a certain order?

Given a deck of 40 cards, which consists of cards numbered from 1-7 [inclusive], I am trying to calculate the probability that:

• the 1st card drawn is numbered 1
• the 2nd card is numbered 2,

... (continues for 3, 4, 5, 6,

• the 7th card is numbered 7

For the case where there are 6 cards in the deck for 1, 2, 3, 4, 5 and 5 cards in the deck for 6, 7 - I believe I figure out the probability like so:

$${{6\over40} * {6\over39} * {6\over38} * {6\over37} * {6\over36} * {5\over35} * {5\over34} = {194400\over93,963,542,400} = {9\over4,350,164}}$$

is this correct?

Then, lets say I want to try and get the greatest probability of drawing the cards in order by choosing how many of each number gets added to the deck.

Do I just try different numbers and see if the probability goes up/down, or is there an easier method?

• But $40$ is not a multiple of $7$. Exactly how is that pack of cards? – ajotatxe Aug 25 '15 at 21:09
• @ajotatxe "For the case where there are 6 cards in the deck for 1, 2, 3, 4, 5 and 5 cards in the deck for 6, 7" - but note my second question is about choosing how many of each card is in the deck. – DoubleDouble Aug 25 '15 at 21:10
• Silly question, sorry. Then, esentially you want to maximize the product $x_1\cdot\ldots\cdot x_7$ given that all the variables are integers and that $\sum_{k=1}^7x_k=40$. Correct? – ajotatxe Aug 25 '15 at 21:13
• "from 1-7 [inclusive]" or exclusive??? – barak manos Aug 25 '15 at 21:32
• @barakmanos inclusive includes 1 and 7, from my understanding? I mean to include 1 and 7. – DoubleDouble Aug 25 '15 at 21:34

Suppose we change the number of occurrences of the various card types, leaving the total number of cards at $40$. In the computation of the probability of your event, The denominator remains at $(40)(39)\cdots(34)$, so we want to maximize the numerator.
Suppose one of the card types occurs $a$ times, and another occurs $b$ times, where $b\ge a+2$. We will show that $(a+1)(b-1)\gt ab$. Equivalently, we show that $(a+1)(b-1)-ab\gt 0$, that is, that $b-a-1\gt 0$. This is clear, since $b-a-2\ge 0$.
So if $b\ge a+2$ we can always increase the product without changing the sum by making sure that any two card types differ in occurrence by at most $1$. We therefore want to find $7$ numbers with sum $40$ such that all numbers are $k$ or $k+1$ for some $k$.
If $s$ of them are $k+1$ and $7-s$ are $k$, we want $s(k+1)+(7-s)k=40$. That gives $s+7k=40$. Solutions are $k=5$, $s=5$; $k=4$, $s=12$, and so on. Taking $k$ as big as possible maximizes the numerator.
We conclude that $2$ of the numbers from $1$ to $7$ must each occur on $5$ cards, and the remaining $5$ numbers must each occur $6$ on $6$ cards. If that condition is met, any choice of $2$ numbers to appear $5$ times yields the same maximal probability.