4. The Binomial Distribution

The Binomial Distribution appears throughout nature but in order to have a specific model, we will consider the random walk of a drunk (which is just one example).  The drunk starts to walk at the origin (say a lamp post) and the following information is specified.

The Random Walk

1. The drunk is assumed able to walk in only one dimension (say along a side walk and not on the lawn).  In practice, the drunk might walk in two dimensions (on the lawn) but we make this assumption to keep things as simple as possible.

2. Steps taken to the right of the lamp post are considered positive and steps taken to the left are considered negative.

3. Suppose each step taken by the drunk has the same length, L.  In practice the length of a step would vary but again we wish to keep the model as simple as possible.

4. Suppose the person is so drunk that the walk is directionless.  By this we mean, that when a drunk takes a given step (right or left), the direction of that step is independent of the direction of the previous step.  All that is known is that there is a probability p that a given step is taken to the right and a probability q that a given step is taken to the left.

5.Suppose the drunk takes N steps total.  How many (Subscript[n, R]) of these steps are to the right?  How many (Subscript[n, L]) of the steps are to the left? 

	 It is probably obvious that

(Subscript[n, R]) + (Subscript[n, L]) =  N

N is regarded as fixed so if you know (Subscript[n, R]) then you also know (Subscript[n, L]) by doing a simple calculation namely, (Subscript[n, L])= N-(Subscript[n, R]).  There is only one independent variable in this problem (Subscript[n, R]).

It might be clear that there is no definite answer to this question as probabilities are involved.  So the question should be rephrased:  "What is the probability W[(Subscript[n, R])] of the drunk taking (Subscript[n, R]) steps to the right (out of a total of N steps)?"

Before answering this question, we will see it is better (and easier) to ask and answer a simpler question.

6. Suppose the drunk takes N steps total (the same as in item 5 above).  And also suppose that THE FIRST (Subscript[n, R])STEPS ARE TO THE RIGHT and the remaining (Subscript[n, L]) steps are to the left.  What is the probability of this happening?

ANSWER:  Since what happens on a given step is independent of what happened on (any) previous step, the total probability for the N steps is just the joint probability of independent events.  In particular, the (joint) probability

p × p × p × 
              p ×  ...  × p ×q × 
          q × q × q ×  ...  × 
      q

In the above equation, there are (Subscript[n, R]) probabilities p multiplied together followed by (Subscript[n, L]) probabilities q multiplied together.  The total number of p's and q's is N the number of steps.  The probabilities p and q are multiplied together because the events are INDEPENDENT (what happens on one steps does NOT depend on what happens on a previous step).

Equation (2) can be simplied to appear

(Subscript[(p^n), R]) × (Subscript[(q^n), L])

if the (Subscript[n, R]) of the p probabilities are grouped together (and all the (Subscript[n, L]) of the q probabilities are grouped together).

A SIMPLER EXAMPLE:  The above might appear more mysterious than it should.  What is going on here is just a little more complicated and what happens when calculating probabilities when throwing two coins.  Suppose the probability of a "heads" is 1/2 for each coin.  What is the probability that both coins will turn up "heads"?  This probability is just (1/2)×(1/2)=(1/4) since what happens to each coin is independent of the other.

Equation (3) does NOT quite answer the original question as to get equation (3) we assumed a specific order in which the steps were taken: namely the first (Subscript[n, R])steps are taken to the right and then the remaining (Subscript[n, L]) steps are taken to the left.  In actuality, the ORDER the steps are taken is unimportant since all that is important (for calculating the probability) is the (Subscript[n, R]) steps are taken to the right.

COUNTING PROBLEM #1:  Suppose you have N distinguishable objects (for example, suppose each object has a number).  Then how many ways are there of arranging the N objects?

ANSWER:  One can imagine having N boxes in a row and filling the N boxes with the N distinguishable objects.  There are N choices of objects for the first box, (N-1) choices of objects for the second box, (N-2) objects for the third box, ..., 2 choices for the second to last box and only 1 choice for the last box.  This is indicated by the figure below:
		({{ Choices  ,  N  , \(\(\ \)\((N - 1)\)\(\ \ \)\),  (N - 2)  ,  (N - 
                3)  ,  (N - 
                4)  ,   ... , \(\(3\)\(\ \ \ \)\),  2  ,  1  }, {  Box # ,  1  ,  2  ,  3  ,  4  , \(\(\ \)\(5\)\(\ \ \)\),  ...  ,  (N - 
                2)  ,  (N - 
                1)  ,   N }})

The total number of arrangements of N distinguishable object is obtained by multiplication

N × (N - 1) × (N - 
                2) × (N - 3)× (N - 
                4) ×  ...  × 3 × 
        2 ×1  =  N!

where the factorial notation was used.

COUNTING PROBLEM #2:  In our case the N objects are identified with what happens on a given step.  All we know is that (Subscript[n, R]) steps are taken to the right (and (Subscript[n, L]) steps are taken to the left) out of a total of N steps.  So what happens on a given step (say the kth step) is NOT completely distinguishable except ito say if it is to the right or to the left.  If the (Subscript[n, R]) steps WERE DISTINGUISHABLE then there would be (Subscript[n, R])! ways of arranging these steps to the right; however, they are NOT distinguishable so equation (4) represents some overcounting ((Subscript[n, R])! ways of overcounting to be precise).  Similarly, if the (Subscript[n, L]) steps WERE DISTINGUISHABLE then there would be (Subscript[n, L])! ways of arranging these steps to the left; however, they are NOT distinguishable so equation also represents some ADDITIONAL overcounting ((Subscript[n, L])! ways of overcounting to be precise).  Reducing equation (4) by this overcounting we obtain

((N!)/((Subscript[n, R])! (Subscript[n, L])!))

Equation (5) is also the coefficient one obtains when one expands a binomial like (((p + q))^n).  This is called a binomial becuase two numbers p and q appear.  The binomial expansion appears

(((p + q))^n)=(∑_(n = 0)^N)(( 
                  N!)/(n! (N - n)!)) (p^n) 
            (q^(N - n))

FINAL ANSWER:  The final answer to the question (What is the probability W[(Subscript[n, R])] of the drunk taking (Subscript[n, R]) steps to the right (out of a total of N steps)?) is the product of equation (3) which is the probability of a certain arrangement of (Subscript[n, R]) steps to the right, multiplied by the number of ways equation (5) this arrangements can occur.

\(\(\(\ \)\(W[
        n\_R] = \ \(N!\)\/\(\(n\_R!\)\ \(n\_L!\)\)\ \ p\^n\_R\ \ q\^n\_L\)\)\)

Equation (6) is called the Binomial (Probability) Distribution.  Each term of the sum in equation (6) is like equation (7) if you make the change of notation n->(Subscript[n, R]) and (Subscript[n, L])=(N-(Subscript[n, R]))->(N-n).

Some Numerical Examples of the Binomial Distribution

Suppose N=5 (there are a total of five steps taken by the drunk) and suppose p=0.5 (so q=0.5) with the probablity of a step to the right the same as the probability of a step to the left.

Num = 5;
p = 0.5;
q = 0.5; 
W[nR_] :=  ((Num!)/(nR! (Num - nR)!))  (p^nR)   (q^(Num - nR))

data = Table[{nR, W[nR]}, {nR, 0, Num}]

ListPlot[data, PlotRange -> {0, 1}, 
      PlotStyle -> PointSize[0.02]]

Also, note the normalization is one (as should be the case for a probability)

(∑_(nR = 0)^Num) W[nR]

Another Example:  More Steps Num=10

Num = 10;
p = 0.5;
q = 0.5; 
W[nR_] :=  ((Num!)/(nR! (Num - nR)!))  (p^nR)   (q^(Num - nR))

data = Table[{nR, W[nR]}, {nR, 0, Num}]

ListPlot[data, PlotRange -> {0, 1}, 
      PlotStyle -> PointSize[0.02]]

(∑_(nR = 0)^Num) W[nR]

Another Example:  More Steps Num=100

Num = 100;
p = 0.5;
q = 0.5; 
W[nR_] :=  ((Num!)/(nR! (Num - nR)!))  (p^nR)   (q^(Num - nR))

data = Table[{nR, W[nR]}, {nR, 0, Num}];
ListPlot[data, PlotRange -> {0, 0.1}, 
      PlotStyle -> PointSize[0.01]]

Note that the maximum value in PlotRange is 0.1

(∑_(nR = 0)^Num) W[nR]

Another Example:  More Steps Num=100
and p=0.1

This example has the probabililty of a step to the right p=0.1 and the probability of a step to the left q=0.9  This might happen if the drunk favored one leg over the other due to an injury for example.

Num = 100;
p = 0.1;
q = 1 - p; 
W[nR_] :=  ((Num!)/(nR! (Num - nR)!))  (p^nR)   (q^(Num - nR))

data = Table[{nR, W[nR]}, {nR, 0, Num}];
ListPlot[data, PlotRange -> {0, 0.2}, 
      PlotStyle -> PointSize[0.01]]

The normalization is still one as expected

(∑_(nR = 0)^Num) W[nR]

© Rodney L. Varley (2002).