Irregular Webcomic!

Archive     Blog     Cast     Forum     RSS     Books!     Poll Results     About     Search     Fan Art     Podcast     More Stuff     Random     Support on Patreon
New comics Mon-Fri; reruns Sat-Sun
<   No. 4684   2022-01-06   >

Comic #4684

1 C-3PO: 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 (2578) | Latest New (5175)
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:
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 axbyc. 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 = x5 + 5x4y + 10x3y2 + 10x2y3 + 5xy4 + y5

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)!) pk(1 - p)n-k.

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.0011(1 - 0.001)100-1 = 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.0012(1 - 0.001)100-2 = 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 (1-p)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:
ans = 0.0952078528862911

[2] Matlab code:
ans = 3718.63238434979
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.

My comics: Irregular Webcomic! | Darths & Droids | Eavesdropper | Planet of Hats | The Dinosaur Whiteboard | mezzacotta
My blogs: (daily updates) | 100 Proofs that the Earth is a Globe (science!) | Carpe DMM (long form posts) | Snot Block & Roll (food reviews)
More comics I host: The Prisoner of Monty Hall | Lightning Made of Owls | Square Root of Minus Garfield | iToons | Comments on a Postcard | Awkward Fumbles
© 2002-2024 Creative Commons License
This work is copyright and is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 International Licence by David Morgan-Mar.