5

Let's think of two events $1$ and $2$.

Both events happen randomly $n_1$/$n_2$-times during a given time $T$ and last for a time of $t_1$/$t_2$.

What is probability $P$, that both events happen simultaneously at some moment?



EXAMPLE 1:

$T = 60$ min

Event $1$ - looking out of the office window: $n_1 = 8$ and $t_1 = 1$ min

Event $2$ - a green car is on the street visible: $n_2 = 20$ and $t_2 = 0.5$ min

$P$: How likely do I see a green car during these $60$ min?

  • 1
    You still need some clarification. For example, in your first case, one person cannot start looking out the window while he is already looking out the window, but it is possible for another green car to come into view during the 30 seconds when a green car is in view. – Thomas Andrews Dec 06 '16 at 14:51
  • No, I will add this to the question, thanks – lukas.simon Dec 06 '16 at 14:52
  • @ThomasAndrews is correct. Unless you make some assumptions about the car, there is the possibility that the entire visibility of the cars lasts for only 50 seconds, even with the assumption that it requires a second between cars. – Avraham Dec 06 '16 at 14:56
  • I'm not absolutely sure what you mean, but the conditions for both events are the same: I cant start looking out of the window while I'm looking, there is only one green car visible at the time... but I might look out of the window 8 min straight and there might be a green car visible for 10 min - than nothing of this will happen for the rest of the time – lukas.simon Dec 06 '16 at 14:59
  • "To make $n$ random too is another (even more complicated) task" Actually, I think that could make the problem a bit easier (like going from the canonical to the grand-canonical ensemble in statistical mechanics) – leonbloy Dec 06 '16 at 15:36

2 Answers2

2

Consider the discrete version of this problem, where $T$, $t_1, t_2$ are integers under some fixed unit of time and the events always start at integer multiples of time.

Then you are selecting $n_1$ values $\{a_i\}$ from $0,...,T-t_1+1$ so that each adjacent pair differs by at least $t_1$, and $n_2$ values f$\{b_j\}$ from $0,\dots T-t_2+1$ with adjacent pairs differing by at least $t_2$. You can count these with a stars-and-bars argument get you something like:

$$\binom{T-(t_1-1)n_1}{n_1}$$

The number of ways that they don't overlap can be written as the number of ways of ordering the $n_1+n_2$ blocks of type $1$ and $2$, and then inserting gaps before and after them totaling $A=T-n_1t_1-n_2t_2$. The number of orderings is $\binom{n_1+n_2}{n_1}$. A stars-and-bars argument means we can think of this as selecting $n_1+n_2$ elements from $A+n_1+n_2=T-n_1(t_1-1)-n_2(t_2-1)$ different locations. This totals $$\binom{n_1+n_2}{n_1}\binom{T-n_1(t_1-1)-n_2(t_2-1)}{n_1+n_2}$$

So the probability they don't overlap is:

$$p(t_1,t_2,T,n_1,n_2)=\frac {\binom{n_1+n_2}{n_1}\binom{T-n_1(t_1-1)-n_2(t_2-1)}{n_1+n_2}}{\binom{T-(t_1-1)n_1}{n_1}\binom{T-(t_2-1)n_2}{n_2}}$$

Expanding and canceling, we get:

$$p(t_1,t_2,T,n_1,n_2)=\frac{(T-n_1(t_1-1)-n_2(t_2-1))!(T-t_1n_1)!(T-t_2n_2)!}{(T-n_1t_1-n_2t_2)!(T-n_1(t_1-1))!(T-n_2(t_2-1))!}$$

Letting $A_i=T-n_it_i$, and $A=T-n_1t_1-n_2T_2$ we get:

$$p(t_1,t_2,T,n_1,n_2)=\frac{(A+n_1+n_2)!A_1!A_2!}{A!(A_1+n_1)!(A_2+n_2)!}$$ For continuous $t_1,t_2,T$, you'll need a limit of the above expression.

$$\lim_{M\to\infty} p(\lfloor Mt_1\rfloor,\lfloor Mt_2\rfloor, \lfloor MT\rfloor,n_1,n_2)$$

Which will give you the probability they do not overlap.

Using the following result, which is easy to prove directly:

For fixed $m$, $$\lim_{B\to\infty}\frac{(B+m)!}{B!B^m}=1$$

we get that this is the same as:

$$\begin{align}\lim_{M\to\infty} \frac{(AM)^{n_1+n_2}}{(A_1M)^{n_1}(A_2M)^{n_2}}&=\frac{A^{n_1+n_2}}{A_1^{n_1}A_2^{n_2}}\\ &=\frac{(T-n_1t_1-n_2t_2)^{n_1+n_2}}{(T-n_1t_1)^{n_1}(T-n_2t_2)^{n_2}} \end{align}$$

as the probability that the two events won't occur at the same time.

When $n_1=n_2=1$, this agrees with a more direct calculation of $\frac{(T-t_1-t_2)^2}{(T-t_1)(T-t_2)}$.

In your first case, $T=60, t_1=1, n_1=8, t_2=\frac{1}{2}, n_2=20$ you get $A=42, A_1=52, A_2=50$ and the probability is:

$$1-\frac{42^{28}}{52^{8}50^{20}}\approx 0.99446$$

Thomas Andrews
  • 186,215
  • Wow, thank you, looks promising, I will check the details in a few hours when I'm home with pen and paper! – lukas.simon Dec 06 '16 at 17:40
  • Since you appear to me as an expert in this field: How would the equation change, if we say that the number of events is random too? Let's say an event of $1$ (and the same with $2$) happens with a probability of $p_1$ per time unit. – lukas.simon Dec 06 '16 at 17:47
  • That's likely going to be much harder, @f.schneider – Thomas Andrews Dec 06 '16 at 17:50
  • What if I first calculate the expected $n_1$ and $n_2$ with $T \cdot p_1$ and $T \cdot p_2$ and than use your equation... is this approach valid? – lukas.simon Dec 06 '16 at 18:17
  • Seems dangerous - it might be a good approximation, but seems risky. @f.schneider – Thomas Andrews Dec 06 '16 at 18:27
  • For example, if $p_1+p_2>1$, then you'd get a nonsense value for my calculation, or a probability of $1$. But there is some probability of no overlap in a time period even if the expected amount of time. In any event, this is an entirely new question, and best not handled in comments. – Thomas Andrews Dec 06 '16 at 18:30
  • Do you mind to explain this "The number of ways that they don't overlap is the number of ways of writing...." further? What is $N$? – lukas.simon Dec 06 '16 at 20:51
  • Yeah, I've got a better explanation for that value, that I'll write in a few hours. I agree that's confusing. – Thomas Andrews Dec 06 '16 at 20:56
  • Thank you. What "Stirling's formula" do you mean? This one: $$ n! \sim \sqrt{2\pi n}\left( n/e \right)^n$$ But how does this help you in the next step (the $n_1/n_2$ 'go away')? Couldn't you just say, that $AM$ gets infinite big, and since $n$ is constant, we have: $AM+n_1 \longrightarrow AM$ ? – lukas.simon Dec 06 '16 at 21:25
  • Edit: I see know, that you added an exponent, but (1) why doesn't the $\sqrt{n}$ matters and (2) where is $A$ in the exponent... when I apply this formula I get: $$ \dfrac{\sqrt{A+n_1+n_2}(A+n_1+n_2)^{A+n_1+n_2} \sqrt{A_1}(A_1)^{A_1}\sqrt{A_2}(A_2)^{A_2} }{\sqrt{A}(A)^{A} \sqrt{A_1+n_1}(A_1+n_1)^{A_1+n_1} \sqrt{A_2+n_2}(A_2+n_2)^{A_2+n_2}} $$ – lukas.simon Dec 06 '16 at 21:35
  • @f.schneider The numerator and denominator are polynomials in $M$ of the same degree, which we know how to compute the limit of. As for the square roots, the value $\sqrt{B+m}\sim \sqrt{B}$ for constant $m$ as $B\to\infty$, so the square roots cancel out. So $\frac{\sqrt{B+m}}{\sqrt{B}}\to 1$ and in particular, you can cancel the square roots. – Thomas Andrews Dec 06 '16 at 22:05
  • It's actually more direct to use $\frac{(B+m)!}{B!B^m}\to 1$, which is equally true. Updated my answer. – Thomas Andrews Dec 07 '16 at 16:25
  • And we no longer need Stirling, since, for fixed $m$, $$1\leq\frac{(B+m)!}{B!B^m}\leq(1+m/B)^m\to 1$$ as $B\to\infty$. – Thomas Andrews Dec 07 '16 at 17:16
  • Thank you for the changes, but I still got one smaller and one bigger question: (small) Why does $$ \binom{n_1+n_2}{n_1} $$ yield the number of orders and not e.g. $$ \binom{n_1+n_2}{n_2}? $$ (big) How does the equation change, if I want to include an overlaps with the end? I created an algorithm to check the probability, and for P(1,1,3,1,1) I have to get 0.555... but your equation yields 0.75: in this case I can just extend $T$ by 1, but how to proceed for different $t_1$, $t_2$ and $n$? – lukas.simon Dec 07 '16 at 20:18
  • $\binom{n_1+n_2}{n_1}=\binom{n_1+n_2}{n_2}$. No idea about the "big" question. – Thomas Andrews Dec 07 '16 at 20:27
  • mhh ok, but your equation is still a good approximation for my problem. – lukas.simon Dec 07 '16 at 20:50
0

[Not an answer, but some pointers]

In statistical physics parlance, you have a pair of independent 1D hard-rods (or Tonk gas). In the limit $L\to \infty$ the "canonical ensemble" (fixed volumen and number of particles) can be replaced by other ensembles, for example, a grand-canonical in which the number of particles is variable (only the average is prescribed). I turn, this ensemble (en 1D only) is equivalent to a causal stochastic process, or a point process. This can be useful, no only for theoretical analysis but also for simulation [*].

Specifically, the distance among particles in our model, in which we prescribe a "density" $\rho = \overline n/L$ and a particle "diameter" $d$, would follow a density

$$f_X(x)=\lambda e^{-\lambda(x-d)} u(x-d)$$

where $u(\cdot)$ is the unit step function and $\lambda$ is given by $E(X)=d+\lambda^{-1}=1/\rho$ or

$$ \lambda=\frac{\rho}{1-\rho d}$$

To estimate $P_o=$ probability of "overlap" (there exist particles of both different point processses separated by less than $d^*=(d_1+d_2)/2$) I can think of two approaches:

First, compute $P_1=$ probability that a single point of the process 1 overlaps with some point of process 2, and then set $P_o=1-(1-P_1)^{n_1}$ . This would amount to assume that the events "first particle of process 1 overlaps with process 2" and "second particle of process 1 overlaps with process 2" are independent, which only could work as an approximation. $P_1$ should be computable from the theory of point processes, I think.

Alternatively, perhaps it's possible to build a "marked" point process that is equivalent to the pair of processes...

[*] You can play here https://jsfiddle.net/vdo1boue/

leonbloy
  • 66,202