# probability of two events occurring in same time

This is very practical question, I am not fully aware in mathematical sense what my variables are.

Apologies if question should be presented as mathematical, but if I were able to do that, I think I would be able to answer it.

Consider I have two computer networks, let's call them A and O networks. I will only need O network, when A network fails. Let's also assume they fail independently.

I want probability for both networks being down same time in any given hour.

Let's say that A network fails twice a year, for 3h each time. For simplicity let's assume O network has similar, but independent failure mode.

Is that 2*3h failure probability equivalent for 1*6h? That is, is my probability of failure 6/(365*24)?

And if so, is the probability for A and O network to fail at same time (6/(365*24))**2? That is 1 failure every 243 years?

What about if I want probability of no failure inside specific window? In 3h window is the probability then: 1/(1-((1-((6.0/(365*24))**2))**3))/24/365 - that is, once every 81 years?

Am I even looking at the problem correctly? If not, how can I analyse the availability requirements for A and O networks?

• Very roughly speaking, the chance a network is down at a given hour is 6/8760 or 1/1460, so the chance both are down is roughly that squared or 1/2131600, or 1 in 2,131,600 hours, which is about once every 243 years. I would be suspicious of answers that are too far away from this estimate. – user1566 Sep 20 '16 at 16:55
• Problem is, I know I don't understand the problem. And now I have 3 distinct solutions, yours is same as mine, which in my case lends less credibility as I don't really trust myself. – ytti Sep 22 '16 at 10:02
• I wrote simulation - p.ip.fi/HWVk - unsure if it is fair. I made failure count reset every year, and choose failure from normal distribution, and choose failure length at start of failure from normal distribution. With the parameters in the code now, I'm seeing sub-hour outages maybe every 250 years or so (the parameters are more aggressive than in my question) => p.ip.fi/n94f – ytti Sep 23 '16 at 12:35

For a rough estimate: There are 8760 hours in a year, and thus 2920 3-hour blocks. Assuming that the failures always occur in these blocks (and excluding cases where A might be dead from 1 to 4 PM and O dead from 2 to 5, for example), there's a 2/2920 = 0.07% probability of O at any given block of time. Since you claim that the failures are independent, this means that given that A is down, there is a 0.07% chance that O is down as well. Combining these, there is a $(2/2920)^2$ probability that both will be down at any given block; in the course of a year with 2920 block there are thus an average of 4/2920 = 0.0014 blocks where both A and B are down, and you really only expect it to occur once every thousand years or so.

For a more exact answer: The exact statistical model of your process is a Poisson process with dead time. There is a given rate at which failure occur, but once they occur there is a period of time (3 hours) where nothing else happens. There are some analytic ways of modeling this (see here for example), but the rough estimate above is going to be close, and would likely be easier to write a small Monte Carlo simulation in Python than it would be to apply the analytic formalism (though for such small rates that could take a while).

• "There are 8760 hours in a year, and thus 2920 3-hour blocks" - that is not true. There is 8760 - 2 such blocks. You ignore the fact that blocks can cross. – Tim Sep 20 '16 at 12:30
• @Tim I purposely ignored crossing blocks and stated so in the answer. And you're still assuming that 1 hour is an indivisible unit. If you include the fact that blocks can cross, you must count an infinite number of blocks: 1:00PM to 3:00PM, 1:01PM to 3:01PM, 1:15PM to 3:15PM, 1:15PM + 7 microseconds to 3:15PM + 7 microseconds, etc. Considering overlaps in blocks requires a difficult Poisson process + deadtime analysis; hence the approximation that I stated for my "rough estimate." – jwimberley Sep 20 '16 at 12:58

The answer to your question depeneds on the distribution of failure times. You say that $A$ fails twice a year. Is it exactly twice a year, or on average? Is it more likely to fail at some specific part of the year?

I will give a simple example for illustration.

Let us assume that $T_A$ is the failure time of $A$, and that $T_A$ is distributed uniformly over $[0,1]$ (this interval will represent the year). This means, that the probability of $T_A$ being in some specific time interval is the proportion of this time interval out of the entire interval. For example, the probability of $T_A\in(1/2,3/4)$ is 1/4.

Let $T_O$ be defined similarly with regards to O, and suppose that $T_A$ and $T_O$ are independent. We assume further that the down time is (deterministiclly) a proportion of $d$ out of the entire time interval. To calculate the probability that both of them are down at the same time, you need to use $T_A$ and $T_O$'s mutual density, which (since they are independent) is uniform over the unit square $B=[0,1]\times [0,1]\in \mathbb{R}^2$.

Now, the probability that you want, is the total area of the set $\{(x,y)\in B:\ |x-y|<d\}$, divided by the total area of $B$ (which is 1).

There is a lot of information here that you might not be familiar with, and is taught on probability introductory course.

Anyway, hope this helps

• On average. I don't actually have real data of historic failures, but I think I would know how to model probability of failure in future if I had historic failure rates. Thanks, I will indeed need time and research to digest your answer. – ytti Sep 20 '16 at 13:33
• I think that a 'Poisson point process' might be a good way to model the consecutive failure times. To read about this process, I recommend chapter 2 in "Daley, Vere-Jones: an introduction to the theory of point processes" (again, requires basic background in probability) – Snoop Catt Sep 20 '16 at 14:02

Summary: @jwimberly is correct

Let's take the problem very literally and assume that both networks MUST fail EXACTLY 2 times per year. Let's also briefly assume that the networks fail at the start of a given hour.

There are 8760 ways to choose "A" network's first failure hour and 8757 ways to choose "A" network's second failure (since it can't overlap the first failure). Since we can choose any pair of failure times in either order, we divide by two. Thus, there are 8760*8757/2 ways to choose the two failure times for network "A".

There also 8760*8757/2 ways to choose the two failure times for network "O". Of these ways, how many don't overlap the two "A" failures? There's 8754 start hours for the first failure (avoiding the 6 failure hours taken up by "A"), and 8751 start hours for the second failure (avoiding the 6 "A" failure hours and the 3 "O" first failure hours). Again, we can choose these in either order, for a total of 8754*8751/2

Dividing these, we get (8754*8751/2)/(8760*8757/2) = 4255903/4261740 as the chance of non-failure in a given year, and thus 1-4255903/4261740 = 5837/4261740 chance of failure, which is about 0.14%, which agrees with @jwimberley's computation. This is roughly 1/730, so you would expect a failure once every 730.125 years or so.

Above, we assumed the failures started exactly on the hour. Now, let's suppose the failures start any second of the year. There are 8760*3600 seconds in a year, and thus that many possible start times for one of "A"'s failures. Since 3 hours is 10800 seconds, there are 8760*3600-10800 seconds for "A"'s other failure. Again by symmetry, there are (8760*3600)*(8760*3600-10800)/2 total pairs of start seconds for "A"'s failure.

The same is true for "O"'s failure, so let's compute the number of ways "O" can fail without overlapping "A"'s failure. This is (8760*3600-10800*2) ways for one failure (excluding 6 hours) and (8760*3600-10800*3) for the other (excluding "A"'s six hours and "O"'s failure). Again by symmetry, there are (8760*3600-10800*2)*(8760*3600-10800*3)/2 total pairs of seconds in which "O"'s failures can start without overlapping "A"'s.

Taking the ratio ((8760*3600-10800*2)*(8760*3600-10800*3)/2)/((8760*3600)*(8760*3600-10800)/2) we have 4255903/4261740 times when that doesn't happen, exactly the same as we got before. Of course, we could do the same computation for microseconds, but the above demonstrates we'd end up getting the same answer each time.

Ultimately, we're doing what @jwimberley did, but using discrete/combinatoric methods.

My comment of once every 243 years was wrong for the following reason: if you choose a random point in the year, the chances that both networks are down is indeed 1 in 2,131,600. However, there's no guarantee the double outage would last the entire hour. In fact, my guess is almost exactly 3 times too small, suggesting that, if there is a double outage at a given point in time, it will resolve itself within 1/3 hour or 20 minutes (however, I haven't done the math on this last part)

Minutiae: in the Gregorian calendar, there are 8765.82 hours in a year, excluding leap seconds.