View Question
Q: Calcularing odds of a single event occuring from multiple attempts ( Answered ,   0 Comments )
 Question
 Subject: Calcularing odds of a single event occuring from multiple attempts Category: Science > Math Asked by: thog-ga List Price: \$15.00 Posted: 06 Apr 2004 19:45 PDT Expires: 06 May 2004 19:45 PDT Question ID: 326367
 ```Odds calculation. \$15.00 I'm trying to calculate the eventual (or overall) odds of an single occuring based on multiple events occuring. For example; the is a 20% chance that an event will turn up positive each time the dice are rolled (so think of having to roll 1 or 2 on a d10). This 20% chance comes up 5 times (you get 5 rolls). What are the odds that one of those 20% chances will turn up positive (it's not 100%)? What are the odds that two of them will turn up positive? I need the specific, workable formula for both the single event occuring (5x 20% = ?). Again, preferably a formula that will also predict the odds of mulitple 'hits' (so 80% odds of one hit based on a base 20% x 5 rolls, and 30% odds of a second hit, 10% odds of 3 hits, etc). Bonus points if it will work when the odds may vary between each roll (so 5 rolls, at 25%, 15%, 8%, 30%, and 22%). I'm relatively math illiterate (three cheers for public education), so please write out the formula in full and as simply as possible.```
 ```Hi, thog-ga: 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 (ten-sided?) 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!(N-k)!) 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 (N-1) times (N-2) and so on down to "times 1": N! = N * (N-1) * (N-2) * ... * 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!(5-5)!) = 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,N-k) 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^(N-1) + C(N,2)X^2 Y^(N-2) + ... ... + C(N,N-1)X^(N-1) 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 N-k 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, mathtalk-ga``` Request for Answer Clarification by thog-ga on 19 Apr 2004 11:46 PDT ```Unfortunately, I can't follow this. I have no idea what the carrot ^ symbol is supposed to stand for, don't know the use of the word 'factorial', and can not follow the algebriac forms once you start to compress them (so pretty much everything from 1/3rd of the way through the entry is unintelligible to me). Background; I moved every 6 months or so of my childhood. This wrecked my education (opportunities for which were not rich in the areas I lived in any case) to the point where I wasn't taught any algerbra (or even dividing fractions for that matter). As I said, I've taught myself quite a bit, but it's very patchy. This is absolutely madding to me, as the skills would be useful for both my work and my personal interests, but even the local community collages don't have programs that would be helpful in this case (assuming I know too much or too little). So we can either start over, or we can go through this paragraph by paragraph as I try to map it. It's up to you which you think will work best.``` Clarification of Answer by mathtalk-ga on 19 Apr 2004 12:52 PDT ```Hi, thog-ga: It's good to hear back from you. If the polynomial algebra is confusing to you, I think it would probably make the most sense to tackle the question from a purely arithmetic approach. It's a tradeoff between being able to "solve" a lot of problems quickly with an approach that is "abstract" (algebra) versus hitting it at a tedious but concrete level (arithmetic). Let's start with a simply case of two tries, but as long as we are doing it this step-by-step way, let's go ahead and include the possibility that the chances of success/failure are not the same for both tries. Suppose the first try has success 10% of the time and failure 90% of the time. Then _before_ the first try, we know: Pr( 0 successes in 0 tries ) = 100% Pr( 1 success in 0 tries ) = 0% Pr( 2 successes in 0 tries ) = 0% ... and so on. [Obviously with 0 tries we are certain to 0 successes.] Okay, _after_ the first try, we know: Pr( 0 successes in 1 try ) = 90% Pr( 1 success in 1 try ) = 10% Pr( 2 successes in 1 try ) = 0% ... and so on. Of course this seems pretty clear, but that may be just because this is the first step. The second step will start to make it clear that there's a rule for computing a new sequence of probabilities following each additional try. For the sake of illustration, I'm going to let you pick the probability of success (and thus of failure) on the second try, and then apply those figures to the results above. This will hopefully let you see where the numbers are used more clearly. Remember that the chance of success can be anything between 0 and 1 (or between 0% and 100%, if that sounds more familiar). regards, mathtalk-ga``` Request for Answer Clarification by thog-ga on 19 Apr 2004 13:27 PDT ```This sounds like a better approach for me. I work well with the concrete examples, and once down, can often learn the abstract terminology handling. Ok, so in example 1 you have zero attempts, so zero chance of success. In example 2 we have 1 attempt at 10%, so a total of 10% chance of success. If for example 3 we had an additional 27% chance of success (.27), we'd have one chance at 10%, one at 27% and two attempts total. If you could illustrate how that looks and works, and how it would look in comparision to two attempts at 10% each, that would help. For future attempts, throw in either flat odds and multiple attempts, or the following sets; (starting with current) .1 .27 .18 .56 Thanks!``` Clarification of Answer by mathtalk-ga on 19 Apr 2004 20:40 PDT ```Hi, thog-ga: 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, mathtalk-ga``` Request for Answer Clarification by thog-ga on 20 Apr 2004 12:00 PDT ```Ok, I think I've got it (hell, I could easily make an Excel spreadsheet to do this). And I've mostly sorted out the 'why' as well as the 'what. My thanks. You have the distinction of being the first person to teach me anything useful in terms of math since around the 6th grade. *grin* I'll let you go now, and if I've further questions I'll post another bid. Thanks again. Duri / Thog``` Clarification of Answer by mathtalk-ga on 20 Apr 2004 13:23 PDT ```Uhh, I guess I should confess that I _did_ use an Excel spreadsheet to whip out the very last table. I was terrified that I'd get an arithmetic or clerical mistake in the mix, just adding to the innate confusion! best wishes, mathtalk-ga```
 thog-ga rated this answer: and gave an additional tip of: \$10.00 ```Excellent. I have an effectively non-existant math education, which required the researcher to explain in step-by-step, easy to follow terms a problem that many have failed to clarify in the past. The researcher was quite patient and thorough. Highly recommended. Great service Google!```