35
$\begingroup$

Hypothetically, if I have a 0.00048% chance of dying when I blink, and I blink once a second, what chance do I have of dying in a single day?

I tried $1-0.0000048^{86400}$ but no calculator I could find would support this. How would I work this out manually?

$\endgroup$
  • 12
    $\begingroup$ That should rather be 1 - (1 - 0.0000048)^(24 * 60 * 60). $\endgroup$ – dxiv Jun 9 '17 at 17:48
  • 9
    $\begingroup$ It's $1-(1-0.0000048)^{86400}$...you have the parentheses wrong. That's why you're getting underflow error. $\endgroup$ – user408433 Jun 9 '17 at 17:51
  • 26
    $\begingroup$ The title just makes me sad, please change dying with turning into a beautiful flower or something like that... $\endgroup$ – Jack D'Aurizio Jun 9 '17 at 18:22
  • 6
    $\begingroup$ There's a logical fallacy here. These assumptions don't let you calculate the chance you have of "dying in a single day". They let you calculate the chance of dying in a single day while blinking. You could get hit by a bus with your eyes wide open. $\endgroup$ – candied_orange Jun 10 '17 at 3:07
  • 2
    $\begingroup$ @CandiedOrange But everyone knows the danger of - and probability of dying from - the Weeping Angels dwarfs the danger of busses. $\endgroup$ – WetSavannaAnimal Jun 10 '17 at 8:59

10 Answers 10

38
$\begingroup$

When $n$ is large, $p$ is small and $np<10$, then the Poisson approximation is very good. In that case, the answer is approximately: $$P =1 - e^{-\lambda}=1-0.6605 = 0.3395$$, where $\lambda = np = 0.41472.$

$\endgroup$
  • 4
    $\begingroup$ I assume you are approximating the binomial, but this in fact is not a binomial situation. It's geometric (once you have your first occurrence--death--the process ends.) For instance, using the Poisson approximation to the binomial with these values, the chance of dying twice (which should be 0) comes out to $e^{-.41472}\frac{.41472^2}{2!}\approx .0568$. $\endgroup$ – paw88789 Jun 9 '17 at 18:31
  • 2
    $\begingroup$ @paw88789 I would assume the probability being calculated here is the probability of the Poisson variable being nonzero (not the probability that it's equal to $1$), so the distinction between dying once and twice is immaterial. $\endgroup$ – Erick Wong Jun 9 '17 at 19:27
  • 1
    $\begingroup$ @paw88789: it is not a geometric distribution for the question of interest. A geometric distribution would answer the question "what's the distribution of number of seconds until I die?", rather than "what's the probability that I die within one day?" $\endgroup$ – Cliff AB Jun 9 '17 at 20:58
  • 2
    $\begingroup$ $n$ and $p$ are such widely used variable names that it might make it clearer if you explain what they denote in this context. And while it's more clear that $P$ is the overall probability, it might be worth a confirmation of that. $\endgroup$ – Todd Wilcox Jun 9 '17 at 21:30
  • 2
    $\begingroup$ @Mehrdad On the other hand, we only know the probability of dying to 2 significant digits, so the approximation doesn't need to be more accurate than that. :) $\endgroup$ – chepner Jun 10 '17 at 14:03
36
$\begingroup$

As @Saketh and @dxiv indicate, you want to take a large power: $(1 - p)^{86400}$, where $p$ is tiny. Calculators don't do well at this. But if you use the rule that $$ a^b = \exp(b \log a) $$ then you can compute $$ b \log a \approx 86400 \log .9999952 \approx -0.41472099533 $$ and compute $e$ to that power to get approximately $0.6605...$, and hence your probability of dying is 1 minus that, or about 34%.

The key step is in using the logarithm to compute the exponent, for your calculator's built-in log function (perhaps called "ln") is very accurate near 1, and exponentiation is pretty accurate for numbers like $e$ (a little less than $3$) with exponents between $0$ and about $5$.

$\endgroup$
  • 17
    $\begingroup$ The slide rule will never truly die. $\endgroup$ – Todd Wilcox Jun 9 '17 at 21:32
  • 2
    $\begingroup$ Note: you should make sure the default log is ln and not $\log_{10}$ if you follow this. $\endgroup$ – Kimball Jun 9 '17 at 22:04
  • $\begingroup$ @ToddWilcox Unless said slide rule gets bent! $\endgroup$ – Cort Ammon Jun 10 '17 at 1:21
  • 1
    $\begingroup$ @Mehrdad Most calculators are not 64-bit. That's modern computers. Mind you, I haven't tried doing this specific calculation in 32 bit, so I don't know how it turns out. $\endgroup$ – Arthur Jun 10 '17 at 9:49
  • 1
    $\begingroup$ @Arthur: On the scientific calculator I have by my desk (TI-30XA), I get 0.339475455 for the direct calculation, which is as many digits as it shows, and also correct as much. I just realized C++ can do 32-bit floats, so I also tried it there. I get 0.34107012 for both methods -- inaccurate, but no better performance with logs than without. Again, I fail to see what the reason for using logarithms is. exp() magnifies errors exponentially, so there's no reason a priori for logs to do better than direct computation. -1 from me for that on this answer since there's no rationale either. $\endgroup$ – Mehrdad Jun 10 '17 at 10:34
32
$\begingroup$

Basically the way you do this is use complementary probability.

The chance of you not dying every second is $99.99952\% = 0.9999952$.

$(0.9999952)^{86400}= 0.660524544429 = 66.052\%$ is the chance you don't die.

The chance you do die is $1-66.052\% = \boxed{33.948\%}$.

I want to die :0

$\endgroup$
  • 4
    $\begingroup$ Does this qualify as being numerical? Doesn't it yield the exact solution and is computationally expensive? $\endgroup$ – UTF-8 Jun 9 '17 at 20:18
  • 1
    $\begingroup$ +1 for the box. Scientists should spend someone learn basic typography to make the important results standing out in a wall of text. $\endgroup$ – Ooker Jun 10 '17 at 7:02
  • $\begingroup$ @UTF-8: I don't see anything but numbers, so it's certainly numerical... and I don't see how it's "exact" either; the exact answer is much longer than 5 digits. It's certainly the best answer on this page. $\endgroup$ – Mehrdad Jun 10 '17 at 11:30
  • $\begingroup$ @Mehrdad "I don't see anything but numbers, so it's certainly numerical" Wtf!? Do you think numerical analysis is just anything that has to do with numbers? "Numerical analysis is the study of algorithms that use numerical approximation (as opposed to general symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics)." (en.wikipedia.org/wiki/Numerical_analysis) $\endgroup$ – UTF-8 Jun 10 '17 at 13:21
  • 1
    $\begingroup$ @UTF-8: This is how I interpret the unqualified word "numerical". I said nothing about "numerical analysis"... nobody on this page had qualified it with the word "analysis" until you finally did just now. The computation here is certainly numerical; it's not symbolic. (Symbolic would also be reasonable; it'd produce a fraction in the result rather than a floating-point decimal number.) Maybe you wanted the word "iterative" (vs. "direct") to describe what you were thinking of. Numerical doesn't imply approximate; 1/2 = 0.5 is numerically exact division. $\endgroup$ – Mehrdad Jun 10 '17 at 13:38
11
$\begingroup$

Many systems (the online system WolframAlpha, Mathematica, R, etc.) will happily compute the given expression, but you can also use the series $$(1 + p)^n = 1 + \binom{n}{1}p + \binom{n}{2}p^2 + \cdots + p^n.$$ In our case, $p = -0.0000048$ and $n = 86400$. The first few terms are easily computable with a hand-held calculator, and just going to the $p^2$ and $p^4$ terms is good enough for two and three decimal places, respectively.

$\endgroup$
7
$\begingroup$

Why not use a simple spreedshet as in this figure?

enter image description here

Sometime ago all this was done using a ''little magic book'' called Logarithm Table ! (see my answer here) or was calculated wit a slide rule.

$\endgroup$
6
$\begingroup$

$$ 86400_{10}=10101000110000000_2 $$

which means

$$ 0.9999952^{86400}=0.9999952^{2^7} \times 0.9999952^{2^8} \times 0.9999952^{2^{12}} \times 0.9999952^{2^{14}} \times 0.9999952^{2^{16}} $$

Now, $x^{2^y}$ can be calculated by taking $x$, squaring it, then squaring the result, then again squaring the result, etc. until the total of $y$ squarings are done: exponentiation by squaring. Any decent calculator should be able to do it quite easily without losing too much precision (typing in a number, then pressing $\times$ followed by $=$ $y$ times usually does the trick).

So,

\begin{align} 0.9999952^{2^7}&=&((((((0.9999952^2)^2)^2)^2)^2)^2)^2&=0.99938578723137220775212944322376\\ 0.9999952^{2^8}&=&(0.9999952^{2^7})^2&=0.9987719517200695609221118676042\\ 0.9999952^{2^{12}}&=&(((0.9999952^{2^8})^2)^2)^2)^2&=0.98053116682488583016015535720841\\ 0.9999952^{2^{14}}&=&((0.9999952^{2^{12}})^2)^2&=0.92436950624567200131913471410336\\ 0.9999952^{2^{16}}&=&((0.9999952^{2^{14}})^2)^2&=0.73010015546967242085058682162284 \end{align}

And, finally, find the product of the 5 numbers above, which is:

$$ 0.66052454443033066313263272049394 $$

which is the chance of not dying, so, the chance of dying is:

$$ 1-0.66052454443033066313263272049394=0.33947545556966933686736727950606 $$

(used windows calculator in the process)

$\endgroup$
4
$\begingroup$

The best way to compute this kind of quantities on a computer is using the functions expm1(x) and log1p(y), which compute, respectively, $e^x-1$ and $\ln(1+y)$, and are more accurate than the naive formulas for tiny values of their argument. They are part of the IEEE floating point arithmetic standard and are provided in the standard libraries of most programming languages.

Rewrite your probability as $$1-(1-p)^n = -(e^{n \ln (1-p)}-1) = -\operatorname{expm1}(\operatorname{log1p}(-p)*n).$$

So, for instance, in Python you'd use the following

In [1]: from numpy import expm1, log1p
In [2]: -expm1(log1p(-4.8e-6)*86400)
Out[2]: 0.33947545556966929

In this case the number 0.339 is rather large, so the last subtraction is tame and some of these safeguards are not needed, but for better accuracy for all values of $p$ and $n$ you should use these library functions.

$\endgroup$
2
$\begingroup$

Chance of remaining alive for n seconds is $(1-p)^n$.
$\log (1-p)^n = n \log (1-p)$

The Maclaurin series for $\log(1 − x)$ is $\log(1-x) = -x-{\tfrac {1}{2}}x^{2}-{\tfrac {1}{3}}x^{3}-{\tfrac {1}{4}}x^{4}-\cdots \!$

which yields the approximation $\space \log(1-x) \sim -x$ for $0<x<<1$

Hence $(1−p)^n \sim e^{-np}$

The approximation and numeric result for staying alive: 0.6605, is the same as the answer above given by @dezdichado . However it should be noted that the @dezdichado answer derives from the Poisson approximation of the Binomial, in the case where n is large while p and k are small: Poisson Approximations. In our case, the number of deaths $k$ is $0$. When $k=0$ the binomial simplifies exactly to $(1-p)^n$, and the only part of Poisson approximation remaining is due to the truncation of the Maclaurin series.

$\endgroup$
2
$\begingroup$

For those who prefer a more programmatic syntax, using the calc arbitrary precision command-line calculator:

calc '100*(1-(1-.0000048)^86400)'

Output (percentage odds of dying in a single day):

    ~33.94754555696693368674

For a longer precision, prepend a config("display", some_precision_value); to the calc code. Here's the result up to 1,000,000 decimal places, (about ten seconds to run on an Intel Core i3):

calc 'config("display", 1000000)
      100*(1-(1-.0000048)^86400)' | fold | less

The complete answer is 604,800 digits long, (plus one more char for the leading ~), the last five digits being ...06624. (To count the the number of digits, replace fold | less above with tail -n +2 | tr -d '[:space:]' | wc -c.)

$\endgroup$
  • $\begingroup$ Certainly the calculator has arbitrary precision. But not the data. $\endgroup$ – dantopa Jun 10 '17 at 0:09
  • 1
    $\begingroup$ @dantopa, It seems calc lacks a command line switch to set decimal precision, but its config() function can do that. See revised answer for the code. $\endgroup$ – agc Jun 17 '17 at 11:54
-8
$\begingroup$

Since there are 86,400 seconds in a day, the chance of dying during a day should be 86,400 times the chance of dying in a second. 86,400 times 0.00048 percent equals 41.472 percent. So apparently someone lives a very dangerous life style if he has an 0.0048 percent change of dying every time he blinks and he blinks every second.

$\endgroup$
  • 6
    $\begingroup$ You can consider the events i.i.d. or mutually exclusive, but not both, and mutual exclusivity is a necessary condition for adding probabilities to be meaningful. $\endgroup$ – Ben Voigt Jun 9 '17 at 21:26
  • 6
    $\begingroup$ So according to your calculation the chance will be greater than 100% if we consider three days? What does that mean? $\endgroup$ – Carsten S Jun 10 '17 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.