Probability after a specific sequence of events?

I am working on some probability problems (not homework, I'm actually a 24 year old software developer who is doing some number crunching for a personal project) and wondering if someone who understands probability better than me can explain.

I understand that if I was to flip a even sided coin, the chances of getting a heads is 50% or 1/2. I understand that if I was to flip a coin twice, each independent flip is 1/2 but to get heads twice in a row, I need to multiply the probabilities. So 1/2 * 1/2 = 0.25 or 25% chance of that happening.

However, my point of confusion comes when you have even more numbers and even more complex sequences.

For example, lets say I flipped a coin 5 times and I got:

Tails

What is the probability I get Heads the 6th time? How would you work that out given you already know what happened the last 5 attempts?

For the sake of the maths being easier to distinguish between heads and tails, lets say it's a uneven coin and the probability of a single flip is:

Tails: 40%

EDIT: On further reflection, I guess my real question is what is the chance of a specific set of coin flips occurring, assuming the coins have uneven probability of 60% and 40% as described above. Please can you try to explain with examples as opposed to using formulas, as my mathematical background is not strong.

• The probability of coin flips are independent - ie. if I flip a coin 30 times and get heads every time, on my 31st flip, the odds of me getting tails would still be 40%, because previous coin flips do not change the odds of a future coin flip. Are you actually referring to coins (independent probability), or something else with dependent probabilities, and were just using coins as an example? Apr 20 '19 at 22:21
• I guess I am a little confused, but thinking on it in reflection, I guess the real question is what is the probability of a specific set of events occurring. I.e. Heads, Heads, Heads, Tails, Heads, Heads. Apr 20 '19 at 22:22

A short (informal, high-school level) answer

Since each flip is independent, the probability that the 6th flip is Head is independent from the previous five flips, so the required probability is just $$\dfrac35$$.

My probability professor tells us to make the sample space $$\Omega$$ clear first before solving any problems. The set $$\Omega$$ represents all a priori possible outcomes (of the six flips). $$\Omega = \{H,T\}^6$$ Your target event is $$E = \{(F_1,\dots,F_6) \in \Omega \mid F_6 = H\}.$$ Your probability $$P:{\cal P}(\Omega) \to [0,1]$$ defined from elementary events (i.e. events that are elements of $$\Omega$$) $$P(\{F_1,\dots,F_6\}) = p^{\#\{i \in \{1,\dots,6\} \mid F_i = H\}} \, q^{\#\{i \in \{1,\dots,6\} \mid F_i = T\}}, \tag{*}\label{*}$$ where $$p = \dfrac35$$ and $$q = \dfrac25$$ are numbers that you've set.

• $$F_i$$ means the $$i$$-th flip, with $$i$$ ranging from $$1$$ to $$6$$ inclusive.
• For each single outcome $$(F_1,\dots,F_6) \in \Omega$$, $$\#\{i \in \{1,\dots,6\} \mid F_i = H\}$$ counts the number of Heads occurred. Idem for $$\#\{i \in \{1,\dots,6\} \mid F_i = T\}$$.

Therefore, sum up these elementary events to get \begin{align} P(E) &= P\left(\bigcup_{(F_1,\dots,F_5) \in \{H,T\}^5} \{F_1,\dots,F_5,H\} \right) \tag{definition of E} \\ &= \sum_{(F_1,\dots,F_5) \in \{H,T\}^5} P(\{F_1,\dots,F_5,H\}) \tag1\label1 \\ &= \sum_{(F_1,\dots,F_5) \in \{H,T\}^5} p^{\#\{i \in \{1,\dots,5\} \mid F_i = H\} + 1} \, q^{\#\{i \in \{1,\dots,5\} \mid F_i = T\}} \tag2\label2 \\ &= p \, \sum_{(F_1,\dots,F_5) \in \{H,T\}^5} p^{\#\{i \in \{1,\dots,5\} \mid F_i = H\}} \, q^{\#\{i \in \{1,\dots,5\} \mid F_i = T\}} \tag3\label3 \\ &= p \, (p + q)^5 \tag4\label4 \\ &= p \, (1)^5 = p, \end{align} which is as expected. Note that the both sides of the above equality don't depend on the outcomes of the first five flips $$(F_1,\dots,F_5)$$.

Explanations for the above steps:

1. decompose $$E$$ into elementary events for calculations with $$P$$. (i.e. split $$E$$ into a union of $$6^5$$ possible cases according to the first five flips.)
2. definition \eqref{*} applied with $$F_6 = H$$, which accounts for $$+1$$ in the exponent of $$p$$.
3. $$p$$ factored out of the summation sign.
4. basic combinatorics
• LHS $$\sum\limits_{(F_1,\dots,F_5) \in \{H,T\}^5} p^{\#\{i \in \{1,\dots,5\} \mid F_i = H\}} \, q^{\#\{i \in \{1,\dots,5\} \mid F_i = T\}}$$: for each $$5$$-tuple $$(F_1,\dots,F_5)$$, the product $$p^{\#\{i \in \{1,\dots,5\} \mid F_i = H\}} \, q^{\#\{i \in \{1,\dots,5\} \mid F_i = T\}}$$ can be regrouped by the counting the occurrences of $$p$$ and $$q$$. (e.g. $$pqpqp = p^3\,q^2$$)
• RHS $$= \underbrace{(p+q)\cdots(p+q)}_{5 \text{ times}}$$: choose among $$p$$ and $$q$$ five times to form a product, and sum all possible choices up.

Further reading: definitons of axiomatic probability in Foundations of the Theory of Probability by A. N. Kolmogorov (Chap I, section 1)

Remarks: The specific settings of this question (say $$6$$, $$0.4$$, $$0.6$$, $$HHHTH$$) are irrelevant to the general problem ( of flip).

If I understand the question correctly, it is looking for the probability of a head in $$6^{\text{th}}$$ flip, conditional on the first 5 outcomes. This can be done from the definition of conditional probability:

$$\mathbb{P}(A|B)=\dfrac{\mathbb{P}(A\cap B)}{\mathbb{P}(B)}.$$

In this case, $$A=\{\text{Head on the }6^{\text{th}}\text{ flip}\}$$ and $$B=\{(H,H,H,T,H)\}.$$

If the flips are independent, $$\mathbb{P}(A\cap B)=p^5(1-p)$$ and $$\mathbb{P}(B)=p^4(1-p),$$ and so $$\mathbb{P}(A|B)=p=\mathbb{P}(A).$$

This may not be the case if the flips are not independent.

• Forgive me but I really suck at interpreting formulas, is there any chance you could explain with examples and without using formulas? Apr 20 '19 at 22:25
• Here is an example of conditional probability. Apr 20 '19 at 22:46
• In elementary set theory, $\{a,a\} = \{a\}$, so it's better to write $B = \{(\dots)\}$ instead of $B = \{\dots\}$, since probability theory makes use of symbols from set theory. Apr 20 '19 at 23:56

The odds of you getting any sequence is, like you mentioned, the multiplication of every term in the sequence : the set $$\{H, H, H, T, H, H\}$$ can be evaluated as $$P_H \cdot P_H \cdot P_H \cdot P_T \cdot P_H \cdot P_H = P_{Total}$$ So when $$P_H = 60\%$$ and $$P_T = 40\%$$, the probability would be $$0.6 \cdot 0.6 \cdot 0.6 \cdot 0.4 \cdot 0.6 \cdot 0.6\ = 0.031104$$

• Wow I feel like an idiot now, I had the answer all along then? So it doesn't matter if the probabilities are uneven or what the sequence is, as long as I multiply all the probabilities then it will give me an accurate result of the likelihood of it occurring? Apr 20 '19 at 22:35
• Will mark as answer, I think you are right. Apr 20 '19 at 22:43
• @KillerKode You've written "What is the probability I get Heads the 6th time?" in a complete sentence, so the target event should be "getting Head the 6th time", regardless of the outcome of the previous five flips. Therefore, the final answer is not the probability that you're looking for. Apr 20 '19 at 22:51
• @GNUSupporter8964民主女神地下教會 In the comments, he specified that what he wrote wasn't what he meant. This comment specifies he means the total probability of a set. Apr 20 '19 at 23:32
• Comments are euphemeral on SE. While we all know what OP intend to say, the wording "a specific set of coin flips occurring" in the question body is ambiguous and not specific at all. I read this in two senses: "flips" means he wants a probability of an event involving at least two flips, so $P(HHHTHH)$. On the other hand, if we substitute "coin flips occurring" with "outcomes", then it would "a specific set of outcomes", and that can be any event (i.e. any subset of the sample space $\Omega$). Apr 21 '19 at 0:11