Probability of two events occurring at overlapping times
I am trying to workout something at work and would like some input/feedback.
I have a 1km section of road and I would like to figure out the probability of 2 vehicles passing each other over an hour period.
Lets say the road runs north-to-south and there are 26 vehicles travelling northbound and 22 vehicles travelling southbound. If the vehicles travel at 50km/h and their arrival is evenly distributed over the hour for each direction, what is the probability that two vehicles will pass each other over the 1km section?
Initially I worked through it as follows but i suspect it is not as simple as this; 1km @ 50km/h - 72 seconds per trip. Therefore, over an hour there are 50 72 second blocks.
$(26/50)*(22/50) = 22.9%$
This is clearly wrong because it doesn't consider overlapping time periods. Which i'm not sure how to consider.
Any help would be great!
Thanks.
$\endgroup$ 13 Answers
$\begingroup$We assume that all arrival times are independent an uniform on the interval $[0,1]$. Suppose that a northbound car $A$ starts at time $t_0.$ Which are the possible arrival times for a fixed southbound car $B$ so that $A$ encounters $B$ on the road? A quick calculation shows that $B$ should arrive in the interval $$[t_0 {-}1/50, \ t_0 {+} 1/50]$$ where we have chose to count time in hours. This is because at time $t_0{-}1/50$ the car $A$ is just starting the trip. So if $B$ arrives before that time they don't meet. On the other hand if $B$ arrives after time $t_0{+}1/50$ if must have started after time $t_0,$ so by that time $A$ has already arrived.
Now, for any $t_0 \in[ 1/50, \ 1{-} 1/50]$ the probability of $B$ arriving in this interval is $2/50$ while for $t_0 \ge 1- 1/50$ the probability is $ 1/50 + (1-t_0),$ simply because $B$ has to start before time $1.$ Similarly if $t_0 < 1/50$ the probability that $B$ arrives in the required time interval is $t_0 + 1/50$ So we can write, with the help of some mathematical formalism, which encodes the fact that the arrival time of $A$ is uniform, which I hope is understandable:
\begin{align*} P(A \text{ encounters }& B) = \int_0^1P(A \text{ encounters } B \ |\ A \text{ arrives at time } t_0) \ dt_0 \\ & =\int_{1/50}^{1 - 1/50} 2/50 \ dt_0 + \int_{1-1/50}^1 (1/50 + 1-t_0) \ dt_0 + \int_{0}^{1/50} (1/50 + t_0) \ dt_0 \\ & =\int_{1/50}^{1 - 1/50} 2/50 \ dt_0 + 2\int_{0}^{1/50} (1/50 + t_0) \ dt_0 \\ &= \frac{99}{50^2} = p \simeq 3.96 \% \end{align*} Assuming that my calculations are correct this is a pretty high probability. In any case you get a probability $p$ of a car $A$ encountering a car $B.$ From this you can compute the probability that a given northbound car $A$ encounters no south bound car at all. This amounts to $22$ independent unsuccessful trials. You can thus compute: $$ P(A \text{ encounters no car at all}) = (1-p)^{22} $$ and now you can compute the probability of no car encountering nobody, which means that for $26$ times in a row a given car $A$ encounters no car, which gives a probabilty $$ P(\text{ no encounters }) =\big( (1-p)^{22})^{26} = (1-p)^{22 \times 26} = (1-p)^{572} \simeq 9 \times 10^{-11} \simeq 0 $$
So eventually the probability that there will be at least one encounter is $$1 - P(\text{ no encounters }) \simeq 1 -9 \times 10^{-11} \simeq 1.$$
So you can be very sure that there will be an encounter. Although you should assume that I have done some errors in the calculations, which adds an additional probability distribution to the variable $p$ :)
$\endgroup$ 4 $\begingroup$Let $L$ be the length of the bridge and $v$ be the uniform speed of the vehicles. Then a vehicle takes time $\tau=L/v$ to travel the length of the bridge. Say your observation period is $T$, during which you wish to know the probability of two vehicles arriving randomly from opposite directions pass each other by.
Let us consider two vehicles, one northward and the other southward bound. Let $t_N,t_S,$ be the starting times of northward and southward bound vehicles from opposite ends of the bridge. We must have $t_N,t_S\in[0,T]$ if at all we are to witness them passing by each other.
By drawing a spacetime diagram it is easy to verify that if northward bound vehicle starts at time $t_N\in[0,T]$ from one end of the bridge, then if there is to be meeting on the bridge in the time interval $[0,T]$, the southward bound vehicle must start at time $t_S$ such that $\mathbf{max}(0,t_N-\tau)\leq t_S\leq \mathbf{min}(T,t_N+\tau)$.
Since probability of starting times is uniformly distributed over $[0,T]$, given starting time of northward bound vehicle $t_N$, the probability that they will meet equals $(\mathbf{max}(0,t_N-\tau)- \mathbf{min}(T,t_N+\tau))/T$.
If $f(t_N)=1/T$ is the p.d.f. of starting time for northward bound vehicle then applying Bayes' theorem: \begin{align} P(\textrm{Vehicles will meet})& =\int_0^Tdt_N~f(t_N)P(\textrm{Vehicles will meet}|t_N)\\ & =\int_0^Tdt_N~\frac{1}{T}\times\frac{\mathbf{max}(0,t_N-\tau)- \mathbf{min}(T,t_N+\tau)}{T}\\ & =\frac{1}{T^2}\int_0^Tdt_N~(\mathbf{max}(0,t_N-\tau)- \mathbf{min}(T,t_N+\tau)) \end{align}
Above integral is easy to evaluate geometrically. It is the area of the hatched region in the diagram below:
Therefore \begin{align} P(\textrm{Vehicles will meet})& =\frac{1}{T^2}(T^2-(T-\tau)^2)=1-\left(1-\frac{\tau}{T} \right)^2 \end{align}
Above gives the probability that two vehicles, each starting in opposite directions, shall meet. Let us say $M_N$ number of vehicles travel northward and $M_S$ number of vehicles travel southward, during time of observation $[0,T]$. Let us label the northward bound vehicles as $1,2,...,M_N$, and southward bound vehicles as $1',2',...,M_S'$. We shall assume that the starting time of each vehicle is independent of the others. Consider the proposition: \begin{align} A(i,i')\equiv\textrm{Northward bound vehicle $i$ meets southward bound vehicle $i'$ during time $[0,T]$} \end{align}
The probability that at least one pair of vehicles will meet is: \begin{align} P(\textrm{At least one pair will meet}) & =P(\sum_{i=1}^{M_N}\sum_{i'=1'}^{M_S'}A(i,i'))=P(A(1,1')+A(1,2')+...+A(M_N,M_S'))\\ & =1-P(\overline{A(1,1')+A(1,2')+...+A(M_N,M_S')})\\ & =1-P(\overline{A}(1,1')\overline{A}(1,2')...\overline{A}(M_N,M_S'))\\ & =1-P(\overline{A}(1,1'))P(\overline{A}(1,2'))...P(\overline{A}(M_N,M_S'))\\ &=1-\left(P(\overline{A}(1,1')) \right)^{M_NM_S'}\\ &=1-\left(1-P(A(1,1')) \right)^{M_NM_S'}\\ &=1-\left[1-\left\{ 1-\left(1-\frac{\tau}{T} \right)^2\right\} \right]^{M_NM_S'}\\ &=1-\left(1-\frac{\tau}{T} \right)^{2M_NM_S'}\\ \end{align} In the first line sum of propositions indicates logical OR between them. In the second line $\overline{()}$ indicates logical negation. In the third line product of propositions indicates logical AND. We have used Demorgan's law to replace negation of sum of propositions by the product of negated propositions. Fourth line follows due to assumption of independence.
Now for $T=1$ hour, $\tau=1$ km$/50$ kmph=$1/50$ hour, $M_N=26$, $M_S'=22$, the probability that at least one pair will meet equals $1-(1-1/50)^{2\times 26\times 22}\approx 1$.
$\endgroup$ 2 $\begingroup$Here is my logic. I don't know if I am correct.
Using Poisson's distribution find out probability for $x$ vehicles to pass from, say, right end. Let, $\lambda$ is the average vehicles coming per hour from that side(well, should be the same for other side as well).
Then, for those x vehicles, to pass through, each require vechicles to pass from other end within $\frac{1}{v}$ hr where $v$ is the velocity of vechicles(assumed to be constant).
Now, use Poission distribution in other end, where we have new $\lambda '$ which is the average vehicles entering in time $\frac{1}{v}$.
Thus, in my opinion, the solution goes like this, $$ p = \sum_{x=1}^{x=\infty} \sum_{y=1}^{y=\infty} x. \frac{e^{-\lambda} \lambda^x}{\lambda !}. y. \frac{e^{-\lambda'} \lambda'^y}{\lambda' !}. \frac{1}{v}$$
where, $y$ is the number of vehicles entering from other end in given interval. And the terms $x$ and $y$ are multiplied because, if $m$ vehicles enter from one end and a single vehicle from other end in the required interval, there will be $m$ passes and thus from unitary method, for $n$ vechicles entering from other end, $m.n$ is multiplied.
Also, there is a term $\frac{1}{v}$ because, in 1 hour, there are total of $v$ intervals of size $\frac{1}{v}$ and we want vehicles to enter from other end exactly at one interval, whose probability is $\frac{1}{v}$.
EDIT: I don't think there should be $\infty$ as upper bound in any of the sums because infinite vechicles cannot enter in 1 hour or any interval of time. May be the inifinities should be replaced by 50(max vechicles entering from a end during 1 hr) and 1(max vehicles entring from other end during interval 1/50 hr)
$\endgroup$