# Probability of getting heads in a coin toss

A fair coin is tossed five times. What is the probability of getting a sequence of three heads?

What i tried

Since the probability of getting a head and not getting a head is $0.5$. The probability of getting three heads is $0.5^3$ while there is a $0.5^2$ chance of not getting a head. But since the three heads are in sequence out of five toss, the total probability is a multiplication of $\left( \begin{array}{c} 5 \\ 3 \\ \end{array} \right).0.5^3.0.5^2=5/16$

Is my working correct. Could anyone explain. Thanks

Hint: ${5\choose 3} =10$ is the number of sequences where you have 3 heads and 2 tails. The heads have not to occur consecutive. The number of sequences with exact 3 heads consecutive are

$hhhtt, \ thhht, tthhh$

Therefore you have only 3 arrangements. Each arrangement has a probability of $0.5^5$

Remark: If you can have more then 3 consecutive heads, then you have 6 arrangements.

If the probability of getting a head is $p$, and the probability of not getting a head is $q=1-p$, then the probability of getting 3 or more consecutive heads is \begin{align} \underbrace{3 p^3 q^2}_{P(HHH)}+\underbrace{2p^4q^1}_{P(HHHH)}+\underbrace{p^5q^0}_{P(HHHHH)}&=p^3(3q^2+2pq+p^2)\\ &=6p^5\qquad\text{(as }q=p\text{)}\\ &=\frac 3{16}\qquad\text{(}p=\frac 12\text{)} \end{align}

This method can also be used if $p\neq\frac12$.

• Oh but why the constant value of 3 and 2 in front? Aug 24 '15 at 16:56
• For HHH, the "elements" are 3H, T, T to fill 3 "positions": 3H can fill any one of the 3. For HHHH, the "elements" are 4H, T to fill 4 "positions": 4H can fill either of the 2. Aug 24 '15 at 17:03

Not quite right. You need a sequence of three heads, not just any three heads. You've counted HHTHT as a valid coin-toss-sequence, whereas according to the question it shouldn't be.

The only allowable sequences are HHHTT, THHHT, TTHHH, HHHHT, THHHH, HTHHH, HHHTH, HHHHH.

• So the algorithm should be $(0.5)^3=1/8$? Aug 24 '15 at 16:41
• No. How did you get that expression? To solve it: what is the probability of HHHTT? Of THHHT? Of HHHHH? Aug 24 '15 at 16:43
• Okay Thanks. I got it Aug 24 '15 at 17:04

You know that there are exactly $2^5 = 32$ unique outcomes in the game. Now in your "win" case, you must have exactly a sequence of three heads, so let's represent this $HHH$ sequence with a variable $W$. Now, you can simplify your question to: how many unique arrangements of $WTT$ are there? We must have $3! \over 1!2!$, or 3 unique arrangements.

Each unique arrangement has probability $P(H)^{N(H)}P(T)^{N(T)}$, where $N$ is the number of objects in a group and $P$ is the probability function. Since every one of our three arrangements must have three heads and two tails, and since the probability of getting heads/tails is 0.5, then each arrangement has probability $0.5^30.5^2 = {1 \over 32}$. So the solution is $3({1 \over 32}) = {3 \over 32}$ .

Note: the number of unique arrangements of a group with common elements is

$$N(total)! \over N(a_1)!N(a_2)!N(a_3)!\cdots$$

Where each $a_i$ is a unique element. In our case, we have only 2 unique elements's: $W$, and $T$, so $N(W) = 1$, $N(T) = 2$, and $N(total) = 3$. Of course, this strategy fails when two elements $a_i$ and $a_j$ have common elements, so watch out for that when using this strategy.

• Also, as I can't comment on others' answers yet, I believe there are a total of 8 unique arrangements if you remove the limit of having 3 heads, as follows: $HHHTT, THHHT, TTHHH, HHHHT, THHHH, HHHTH, HTHHH, HHHHH$ Aug 24 '15 at 17:29
• Quite right. Dear me, I must be asleep. Aug 24 '15 at 17:38

This is just me, but I'd take a direct approach and (since you only have 5 events to consider) draw out a table or chart of all the possible outcomes for first only 2 or 3 events, see if you can scale up, then check your calculation against that.

I find when people aren't inwardly certain in a solid way about the algorithm, a bit of visual intuition can really help.

• The way Patrick did just now in fact. Makes problems like this much easier to check. Aug 24 '15 at 16:39