Hi, thogga:
When your chances of "success" vs. "failure" are the same in each
repeated attempt, the formula which is probably easiest to apply and
remember is the "binomial theorem".
Bear with me and I think I can help stir up some of those dusty
memories of high school math for you!
With each attempt there is either success or failure, so in absolute
terms the probability of success in a single attempt must be 1 (or
100%) minus the probability of failure in a single attempt. These
"complementary" events must have probabilities that add up to 1 (or to
100%, if that's more familiar).
Okay, now let's put this into a bit of algebra. Let X be the
probability of success and Y the probability of failure. What we've
just observed is:
( X + Y ) = 1
The left hand side of this simple equation is a "binomial", fancy talk
for "two terms". The "binomial theorem" tells us what happens when we
raise such a thing to a power. In the present context, the power
represents the number of trials. For example, to plug in the numbers
you threw out in your Question, let's suppose five rolls of a
(tensided?) die, where the chance of success is 20% or 1/5. Then:
( 0.2 + 0.8 ) = 1
and with five repetitions, all the possible outcomes are compactly given by:
( 0.2 + 0.8 )^5 = 1
The trick here is to expand the expression ( X + Y )^N using the
binomial theorem, which tells us the coefficients for particular "like
terms" based on powers of X and Y. These coefficients are
"combinations of N things taken k at a time" and we'll review them in
just a moment.
But first let's see how this would help to pin down the chance of one
success in five tries, versus two successes in five tries.
The entire expansion for N = 5 is this:
( X + Y )^5
= X^5 + 5(X^4)Y + 10(X^3)(Y^2) + 10(X^2)(Y^3) + 5X(Y^4) + Y^5
Recall that the term X by itself is 0.2 or 20%, meaning the chance of
success in a single attempt. The X^5, the first term in the
expansion, corresponds to getting a success in each of the five
attempts! That is:
X^5 = (0.2)^5 = 0.00032
At the other end of the expansion, the term Y^5 represents failure in
each of the five attempts, or:
Y^5 = (0.8)^5 = 0.32768
The in between terms all represent a mixture of successes and
failures, with the particular case of one success (and four failures)
given by:
5X(Y^4) = 5(0.2)(0.8)^4 = 0.4096
and the particular case of two successes (and three failures) by:
10(X^2)(Y^3) = 10(0.2)^2(0.8)^3 = 0.2048
As an exercise, work out for yourself the other two terms in the expansion:
10(X^3)(Y^2) = ?
5(X^4)Y = ?
and then confirm that all six terms in the expansion add up to 1!
Thus, in five repeated trials, we must have exactly one of these six
outcomes, and the sum of their probabilities is 100%:
no successes
one success
two successes
three successes
four successes
five successes
To vary the number of "rolls" or repetitions, one varies the exponent
N while the chance of success (on a single trial) is X (and Y the
corresponding chance of failure). The only ingredient missing for
this "constant odds" setup is the explanation of the binomial
coefficients or "combinations of N things taken k at a time".
When we have k successes in N trials, those k "good rolls" can be any
subset of the collective N trials of the right size. So the number of
ways to pick k rolls of a "pool" of N things is the number of
different subsets of size k.
Here it will help to memorize a formula, together with one or two
properties that come in handy. The formula for combinations of N
things taken k at a time is:
C(N,k) = N!/(k!(Nk)!)
Okay, what's up with the exclamation marks, you may be asking. Did we
get to the exciting part of the math? No, sorry, the exclamation
marks are simply a shorthand notation for factorials. N "factorial"
for a positive integer N is just the product of N time (N1) times
(N2) and so on down to "times 1":
N! = N * (N1) * (N2) * ... * 1
In particular here are the first few factorials:
1! = 1
2! = 2
3! = 6
4! = 24
5! = 120
Indeed we have skipped here the first and most surprising factorial, which is:
0! = 1
This may be a little hard to accept, but it makes the formulas come
out correctly. For example, how many combinations of 5 things taken 5
at a time are there? We expect the answer to be 1, because given 5
things to choose from the only way to take 5 is to take all of them.
In a math formula perspective, we should have:
C(5,5) = 5!/(5!(55)!) = 1/(0!)
From this we see that in order to get 1, we need 0! to be 1. And so
by convention that is how 0! is defined. It's the definition that
makes the formulas work.
One other property to remind you of is that:
C(N,k) = C(N,Nk)
whenever k is between 0 and N. You may recall "Pascal's triangle" and
how one can obtain these binomial coefficients by adding two entries
in the row above to get the one between and below them in the next row
(I hope these are not terribly unpleasant memories for you; I'm quite
fond of Pascal's triangle, although it does turn out to have been
discovered earlier by a Chinese mathematician).
At any rate with the binomial theorem and the formula for binomial
coefficients (aka the combinations of N things taken k at a time), you
have the tools to find the answers to all sorts of probability
questions involving repeated trials with constants "odds". Such
experiments are sometimes called Bernoulli trials:
(X + Y)^N
= C(N,0)Y^N + C(N,1)X Y^(N1) + C(N,2)X^2 Y^(N2) + ...
... + C(N,N1)X^(N1) Y + C(N,N)X^N
Note that the binomial coefficient in each term is C(N,k) where k is
the exponent on X, and that the powers k of X and Nk of Y always add
up to N (the overall degree of the polynomial) in each "monomial"
(single term) of the expansion.
Now you've also asked how to deal with cases in which the chances vary
from one trial to the next. Because these chances can be arbitrary
numbers (subject to their being between 0 and 1 as all good
probabilities must), the computations are necessarily "messier" as we
must allow for different numbers with each succeeding trial. However
I will show you a simple (if tedious) way to organize these
computations, requiring nothing more than the high school algebra
we've already touched upon.
What we need to do is provide a different binomial expression for each
different trial, rather than repeating the same factor (X+Y) to the
power N.
As a formality I'll suggest writing the probability of success and the
complementary probability of failure for each trial, e.g. in two
columns. Then form a binomial for each trial using these
complementary chances as coefficients, say (to make similar but
distinct notation) the coefficient of little x for success and the
coefficient of little y for failure.
To illustrate using the "varying odds" of your Question for five rolls, we'd have:
(0.25x + 0.75y)(0.15x + 0.85y)(0.08x + 0.92y)(0.3x + 0.7y)(0.22x + 0.78y)
Multiplying these five factors out, while not very rewarding in
itself, will give us a fifth degree polynomial in x and y. The
coefficient of x^5 will be the chance of five successes, and the
coefficient of y^5 the chance of five failures. Intermediate terms
will represent the collective mixtures of success and failure,
according the represented powers of x and y, very much like they did
before with the binomial expansion of (X+Y).
Subject to rounding in the arithmetic, our expansion of those factors
shown above produces this sort of result:
5 4 2 3 3 2
0.320229 y + 0.418662 x y + 0.207542 x y + 0.048212 x y
4 5
+ 0.005157 x y + 0.000198 x
As described above, the coefficient 0.320229 corresponds to the chance
of five failures (no successes), the coefficient 0.418662 to one
success (four failures), and so forth.
Please feel free to ask for further clarification of any points
presented here. I'd love to help you master the concepts of this
material.
regards, mathtalkga 
Clarification of Answer by
mathtalkga
on
19 Apr 2004 20:40 PDT
Hi, thogga:
Okay, let's take a look at how to advance from one try to two, given
that the second try will have a 0.27 chance of success (and thus a
0.73 chance of failure).
Here's the probability distribution of outcomes after one try:
#successes Probability
0 0.9
1 0.1
2 0.0
...
Now the second try is considered "independent" of the first try, which
means its chance of success or failure is the same regardless of how
the first try turned out.
The only way to have _no_ successes after the second try is to have no
successes after the first try and then to fail as well on the second
try. Thus:
Pr( 0 successes after 2 tries ) = 0.9 * 0.73 = 0.657
Now there are two ways you could have (exactly) one success after two
tries. You might have no success on the first try and then succeed on
the second try, or you might succeed on the first try and fail on the
second. These two possibilities are "disjoint" (there's no overlap),
so the probability of either of them is just the sum of their
probabilities:
Pr( 1 success after 2 tries ) = (0.9 * 0.27) + (0.1 * 0.73)
= 0.316
Finally there is positive probability for 2 successes after 2 tries,
i.e. succeeding both times:
Pr( 2 successes after 2 tries ) = 0.1 * 0.27 = 0.027
Let's incorporate these results into an expanded table, with one more
row and one more column.
Here's the probability distribution of outcomes after one try and after two tries:
One Try Two Tries
#successes Probability Probability
0 0.9 0.657
1 0.1 0.316
2 0.0 0.027
3 0.0 0.0
...
There's a fairly simple pattern to the calculations which can be
repeated over and over, to obtain chances of a smallish number of
successes for any number of tries (if the calculations are only
repeated enough to cover the number of tries).
To illustrate this, I'm going to back up and do the first two tries
using _equal_ chances of 0.1 (success).
No Tries One Try Two Tries
#success Probability Probability Probability
0 1.0  0.9  0.81
\ \
1 0.0  0.1  0.18
\ \
2 0.0  0.0  0.01
\ \
3 0.0  0.0  0.0
...
The pattern here is to find a new entry, you look to the column just to the left:
Multiply the entry above and to the left by
the chance of SUCCESS in the current trial,
and add to that the entry on the same row to
the left times the chance of FAILURE in the
current trial.
In other words, a success in the current trial will increase the
number of successes overall by 1, while a failure keeps the number of
successes the same as before.
Compare those results with the ones for the unequal probabilities that
we started with:
No Tries One Try Two Tries
#success Probability Probability Probability
0 1.0  0.9  0.657
\ \
1 0.0  0.1  0.316
\ \
2 0.0  0.0  0.027
\ \
3 0.0  0.0  0.0
...
We can set up a table in which the same odds of success are repeated
over and over, or we can change the odds of success from one column to
the next. If we repeat the 0.1 chance of success four times, we'd
have this table:
No Tries One Try Two Tries Three Tries Four Tries
#success Probability Probability Probability Probability Probability
0 1.0  0.9  0.81  0.729  0.6561
\ \ \ \
1 0.0  0.1  0.18  0.243  0.2916
\ \ \ \
2 0.0  0.0  0.01  0.027  0.0486
\ \ \ \
3 0.0  0.0  0.0  0.001  0.0036
\ \ \ \
4 0.0  0.0  0.0  0.0  0.0001
...
If instead we have the unequal probabilities that you suggested (of
success: 0.1, 0.27, 0.18, 0.56), then:
No Tries One Try Two Tries Three Tries Four Tries
#success Probability Probability Probability Probability Probability
0 1.0  0.9  0.657  0.53874  0.2370456
\ \ \ \
1 0.0  0.1  0.316  0.37738  0.4677416
\ \ \ \
2 0.0  0.0  0.027  0.07902  0.2461016
\ \ \ \
3 0.0  0.0  0.0  0.00486  0.0463896
\ \ \ \
4 0.0  0.0  0.0  0.0  0.0027216
...
The tables we've worked out here have enough rows in them for all the
possibilities to be accounted for. The sum of each column of
probabilities will add up to 1 in this case. However if _only_ the
chances of one success were desired, it would be unnecessary to
compute anything beyond the top two rows (which give the chances of
cumlative no successes and one success, respectively). In other
words, this approach allows us to economize on computation if only a
most two or three successes need to be accounted for, because then we
only retain rows that correspond to that many or fewer successes.
I hope these tables will assist your understanding, though of course
it will be tedious to go through a representative sampling of the
arithmetic behind them.
regards, mathtalkga
