# Flipping coin probability

I am flipping a coin $$12$$ times in a row. The probability of getting $$HEADS \ (PILE)$$ on each flip is $$p = 0.2$$. Let $$X$$ be the number of $$HEADS \ (PILE)$$ that appear, and $$Y$$ be the position of the last $$HEADS \ (PILE)$$ that appears. If no $$HEADS$$ appear, we define $$Y = 0$$.

Note: These variables are not independent!

1. I know how to calculate $$Pr(X = 3)$$.
2. I am having trouble calculating $$Pr(Y = 7)$$.

Specifically, for $$Y = 7$$, the $$7$$th flip must be $$HEADS$$ and the flips from $$8$$ to $$12$$ must be $$TAILS \ (FACE)$$. How do I correctly account for the possible combinations of the first $$6$$ flips in my calculation?

Here’s what I have so far:

• The probability that the $$7$$th flip is HEADS is $$0.2$$.
• The probability that the flips from $$8$$ to $$12$$ are all $$TAILS$$ is $$0.8^{5}$$.

But I'm unsure how to properly incorporate the probability of the first $$6$$ flips.

Could someone explain the correct method to find $$Pr(Y = 7)$$?

• For some basic information about writing mathematics at this site see, e.g., basic help on mathjax notation, mathjax tutorial and quick reference, main meta site math tutorial and equation editing how-to. Commented Jun 5 at 8:08
• You need only focus on flips 7 through 12. $P(******HTTTTT)$ with $n=12$ is the same as $P(HTTTTT)$ with $n=6$. Commented Jun 5 at 8:24
• @DavidP why the 6 first flips are not important Commented Jun 5 at 8:36
• Because the variable $Y$ does not "care" about them. Consider if it was $P(Y=2)$ then you have two choices: $E_1=HHTTTTTTTTTT$ and $E_2=THTTTTTTTTTT$. Then $P(Y=2)=P(E_1 \cup E_2) = P(E_1)+P(E_2)$. Notice that these are constant multiples of $P(HTTTTTTTTTT)$ with $n=11$, call this $x$. Then $P(Y=2)=0.2*x+0.8*x=x$ Commented Jun 5 at 8:45

$$\underline{\text{Algebraic Response}}$$

You have solved the problem, without realizing it.

Whatever happened on the first 6 flips is totally irrelevant, so the first $$~6~$$ flips can be ignored.

In order to have $$~y = 7,~$$ it is both necessary and sufficient, that the following two events occur:

• The $$~7$$-th flip is a heads.

• Every subsequent flip is not heads.

So, your computation of $$~(0.2) \times (0.8)^5~$$ is complete (as is), and accurate.

$$\underline{\text{Intuitive Response}}$$

Intuitively, you might say, wait, this can't be right. If the first (algebraic) part of the answer is correct, then the answer would be the same if I was instead computing $$~y = 1,~$$ where there were only $$~6~$$ flips total.

That's exactly right.

An alternative intuitive grasp of the problem is that in general, the $$~p(y = k),~$$ when there are $$~n~$$ total coin flips, can be determined by examining the sequence of coin flips in reverse.

That is, to compute $$~p(y = k),~$$ since (supposedly) all that counts is the last $$~(n+1-k)~$$ coin flips, you can instead, ask:

what would be the probability of getting the first $$~(n-k)~$$ coin flips tails, and then getting the next coin flip heads.

In other words, when there are $$~n~$$ total coin flips,

the probability that the last heads is coin flip $$~k~$$ is the same as the

the probability that the first coin flip that is heads is $$~(n-k) + 1.$$

Under this re-visualization of the problem,

it becomes easier to understand that what happens after the first $$~(n - k) + 1~$$ coin flips is irrelevant.

• Why is it wrong to consider the first 6 results as having (2^6) ways to choose between heads and tails and then divide by (2^12) Commented Jun 5 at 19:39
• @MouhKramo Such an approach as your comment suggests is valid, and therefore can be made to accurately compute the answer. I don't know if your specific numerical/analytical attempt is accurate, but, as I say, the approach is valid. However, such an approach represents adding very significant and totally unnecessary complications to the problem. It is far better to approach probability theory, such as this problem represents, as burdening the problem solver with expanding their intuition, so that unnecessary complications are avoided. Commented Jun 5 at 19:45
• I thought if it is explained with combinations or permutations, it will be more evident to me. Commented Jun 5 at 19:56
• @MouhKramo Then, if you are unable to derive an alternative approach that leads to the answer that you now know to be accurate, you can post a separate question on MathSE. In such an event, I encourage you to update this posted question to provide a link to the next posted question (i.e. see also ...), and to include a link to this posted question, in your (separate) followup question. Do not however, introduce any other change to this question, which has now been responded to, by MathSE reviewers. ...see next comment Commented Jun 5 at 20:08
• @MouhKramo One more thing for you to consider: For what it's worth, virtually every MathSE posted question that I have seen, that followed this article on MathSE protocol has been upvoted rather than downvoted. I am not necessarily advocating this protocol. Instead, I am merely stating a fact: if you scrupulously follow the linked article, skipping/omitting nothing, you virtually guarantee a positive response. Commented Jun 5 at 20:09