Archive Blog Cast Forum RSS Books! Poll Results About Search Fan Art Podcast More Stuff Random Support on Patreon 
New comics MonFri; reruns SatSun

1 C3PO: Sir, the possibility of successfully navigating an asteroid field is approximately three thousand, seven hundred and twenty to one.
2 Han: Never tell me the odds!
3 {beat}
4 Han: Especially when you misuse the binomial theorem and donâ€™t take the Bayesian priors into account properly!
First (1)  Previous (4683)  Next (4685)  Latest Rerun (2561) 
Latest New (5143) First 5  Previous 5  Next 5  Latest 5 Star Wars theme: First  Previous  Next  Latest  First 5  Previous 5  Next 5  Latest 5 This strip's permanent URL: http://www.irregularwebcomic.net/4684.html
Annotations off: turn on
Annotations on: turn off

In the other 3719 universes, Han crashed the Falcon into an asteroid and the Empire ruled the Galaxy with an iron fist for 10,000 years.
The binomial theorem is a theorem in algebra that describes the expansion of the polynomial (x + y)^{n} into a sum of terms of the form ax^{b}y^{c}. The exponents b and c in each term sum to equal n, and the coefficient a is an integer that depends on the values of n and b (or equivalently n and c).
That's a bit abstract, so an example:
(x + y)^{5} = x^{5} + 5x^{4}y + 10x^{3}y^{2} + 10x^{2}y^{3} + 5xy^{4} + y^{5}
The numbers 1, 5, 10, 10, 5, 1 (where the 1 is implicit in front of the first and last terms) are the binomial coefficients for the power n = 5. The binomial coefficient for the power n and the exponent b is given by the expression n!/(b!(n  b)!), where ! is the factorial function. The binomial coefficients can also be calculated from Pascal's triangle.
There's a lot more to go into about the binomial theorem and coefficients, because they have lots of interesting mathematical properties and applications, but I'll leave that as research for the reader, beginning with those Wikipedia links. For the purposes of today's comic, it's enough to know that the binomial theorem is important in probability and statistics, being the basis of the binomial distribution and negative binomial distribution of probability theory. These distributions are useful in calculating probabilities related to repeated coin tossing and die rolling, or in fact any case where some discrete event that has a particular probability of occurring once, regardless of how many previous times the event might have occurred, is repeated.
In particular, the binomial distribution determines that if a single success of a trial (e.g. rolling a 6 on a die) has probability p (e.g. 1/6), and you perform n trials (e.g. rolling the die 5 times), then the probability of exactly k successes is given by the expression:
n!/(k!(n  k)!) p^{k}(1  p)^{nk}.
Notice that the first term there is the binomial coefficient for the power n and the exponent k.
So for example if you say that the probability of any given asteroid in an asteroid belt that you fly through hitting your ship is 1 chance in 1000, or 0.001, then if you fly through an asteroid belt containing n = 100 asteroids, your chances of being hit by exactly k = 1 of them is given by
100!/(1!(100  1)!) 0.001^{1}(1  0.001)^{1001} = 0.09057.
That's less than a 10% chance, which might seem odd at first. But wait, there's more! There's also the chance of being hit by exactly k = 2 asteroids:
100!/(2!(100  2)!) 0.001^{2}(1  0.001)^{1002} = 0.00449.
To get the chance of being hit by either one or two asteroids, you add these together, giving a probability of 0.09506.
To get the chance of being hit by one or more asteroids, you need to add up the individual binomial probabilities of being hit by 1, 2, 3, 4, ... 100 asteroids. If you do this manually, besides taking forever, you'll notice the probabilities of being hit by larger numbers of asteroids goes down very quickly. If you do it using Matlab like I did^{[1]}, you can quickly calculate that the probability of being hit by at least one asteroid is 0.0952. So it's actually a shade under 10%.
How many asteroids do you need to make the odds of not being hit by any of them 3720 to 1? It turns out the answer (assuming each asteroid individually has a 1 in 1000 chance of hitting you) is between 8217 and 8218 asteroids^{[2]}. Of course if you change the probability of being hit by each individual asteroid to something else, this changes the total number of asteroids in the belt substantially. Not to mention that the probabilities will in reality vary, based on the asteroid's size and speed relative to the Falcon. And we haven't factored in any evasive manoeuvres by the pilot. Clearly 3PO has some very advanced probability calculation circuitry.
Bayesian priors... I think I'll leave as further reading material for today.
Reader Neil R. points out: The chance of you not hitting any asteroids is obviously p(k=0) which is just (1p)^{n}, directly giving you the answer of 0.9048, or 90.48%.
Which is 1  0.0952, as expected. I admit I neglected to notice this much simpler way of calculating the desired answer, since I was so focused on explaining the binomial theorem!
[1] Matlab code:
1binocdf(0,100,0.001)
ans = 0.0952078528862911
[2] Matlab code:
1/binocdf(0,8217,0.001)
ans = 3718.63238434979
1/binocdf(0,8218,0.001)
ans = 3722.35473908888
LEGO^{®} is a registered trademark of the LEGO Group of companies,
which does not sponsor, authorise, or endorse this site. This material is presented in accordance with the LEGO^{®} Fair Play Guidelines. 