Permutations and Combinations: When we flip a coin twice, we observe a particular sequence or permutation; for example, a head followed by a tail. In contrast, a head and a tail, in any order, is called a combination. A head and a tail can exist as one of two possible permutations x_{ht} = (x_{h}, x_{t}), or x_{th} = (x_{t}, x_{h}). The probability of observing each of these permutations is the same because the order in which heads and tails occurs does not affect their probabilities. Thus,
p(x_{ht}  θ) 
= 
$p\left({x}_{h}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )\times p\left({x}_{t}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )$ 


= 
θ × (1 − θ) 

p(x_{th}  θ) 
= 
$p\left({x}_{t}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )\times p\left({x}_{h}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )$ 


= 
$(1\theta )\times \theta ,$ 
and if we assume θ = 0.6 then the probability of the permutations p(x_{ht}θ) = p(x_{th}θ) = 0.24. As each of these two permutations occurs with probability 0.24, it follows that the probability of observing a head and a tail in any order, or equivalently, the probability of a combination that contains a head and a tail, is
$\begin{array}{ccc}p\left({\mathbf{x}}_{\mathit{ht}}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )+p\left({\mathbf{x}}_{\mathit{th}}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )& =& \mathrm{0.48.}\end{array}$ 
We can clean up the notation by defining x as a specific combination, such as x = {x_{t}, x_{h}}, where this is read as one head out of two coin flips in any order, and where we use curly brackets to represent a combination. Thus, we can write
p(x  θ) 
= 
p({x_{t}, x_{h}  θ}) 


= 
2 × θ × (1 − θ) 


= 
0.48, 
where θ(1 – θ) is the probability that any permutation contains exactly one head and one tail, and 2 is the number of permutations that contain exactly one head and one tail.
We can reassure ourselves that Equation E.8 is true by working out the probability of observing the three possible combinations that can result from two coin flips, namely, {x_{t}, x_{t}}, {x_{t}, x_{h}}, and {x_{h}, x_{h}}, given a specific value for θ. The combination {x_{t}, x_{t}} includes only one permutation (x_{t}, x_{t}), so
$\begin{array}{ccc}p\left(\{{x}_{t},{x}_{t}\}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )& =& p\left({x}_{t}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )\times p\left({x}_{t}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )=\mathrm{0.16.}\end{array}$ 
Similarly, for the combination {x_{h}, x_{h}}, we have
$\begin{array}{ccc}p\left(\{{x}_{h},{x}_{h}\}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )& =& p\left({x}_{h}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )\times p\left({x}_{h}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )=\mathrm{0.36.}\end{array}$ 
So, given that the only possible three combinations from two coin flips contain zero heads {x_{t}, x_{t}}, one head {x_{h}, x_{t}}, or two heads {x_{h}, x_{h}}, with probabilities
$\begin{array}{ccc}p\left(\{{x}_{t},{x}_{t}\}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )& =& 0.16\end{array}$ 

$\begin{array}{ccc}p\left(\{{x}_{h},{x}_{h}\}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )& =& 0.36\end{array}$ 

$\begin{array}{ccc}p\left(\{{x}_{h},{x}_{t}\}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )& =& 0.48,\end{array}$ 
the sum of these probabilities is one
$0.16+0.36+0.48=1.$ 
The general lesson to be drawn from this simple example is as follows. To find the probability of observing a combination that contains n heads and N – n tails, first find the probability of one such permutation, and multiply this by the number of permutations that contain n heads and N – n tails, where this number is a binomial coefficient (described next).
The Binomial Coefficient: The number of permutations that contain exactly x heads amongst N coin flips is
$\begin{array}{ccc}{C}_{N,x}& =& N!/\left(x(Nx)!\right)\mathrm{,}\end{array}$ 
where C_{N,x} is a binomial coefficient and is pronounced N choose x. If a coin is flipped N = 10 times and the number of heads is x = 7 then the number of permutations that contain x = 7 heads and N – x = 3 tails is C_{N,x} = 120. If a coin has a bias θ = 0.7 then the probability of obtaining any one of these permutations, such as, x_{7} = (x_{h}, x_{h}, x_{h}, x_{h}, x_{h}, x_{h}, x_{h}, x_{t}, x_{t}, x_{t}), is
$\begin{array}{c}p\left({\mathbf{x}}_{7}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )\end{array}={\theta}^{7}{(1\theta )}^{3}=2.223\times {10}^{3}\mathrm{.}$ 
Given that the probability of obtaining any other permutation with x = 7 heads and N – x tails is also 2.223 × 10^{−3}, and that there are C_{N,x} such permutations, it follows that the probability of obtaining x heads and N – x tails in any order (ie a combination) is
p(x  θ) 
= 
${C}_{N,x}\phantom{\rule[0.0ex]{0.2em}{0.0ex}}p\left({\mathrm{x}}_{7}\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta )$ 


= 
$120\times (2.223\times {10}^{3})$ 


= 
0.267. 
The Binomial Distribution: If we flip this coin N times then the probability of observing x heads given a coin bias θ is
$\begin{array}{ccc}p\left(x\right\phantom{\rule[0.0ex]{0.2em}{0.0ex}}\theta ,N)& =& {C}_{N,x}\phantom{\rule[0.0ex]{0.2em}{0.0ex}}{\theta}^{x}{(1\theta )}^{Nx}\mathrm{.}\end{array}$ 
The binomial distribution for N = 10 and θ = 0.7 is shown in Figure E.1. (see Section 4.1, p74).
The binomial distribution is a cornerstone in the analysis of binary events. As the number N (eg coin flips) increases, given some mild assumptions, the binomial distribution becomes increasingly like the Gaussian distribution (see Chapter 5 and Appendix F). Because the Gaussian distribution is mathematically convenient, this approximation allows the binomial distribution to be replaced with the Gaussian distribution in a wide variety of contexts.