Probability of collision: mathematical vs probabilistic modeling $\newcommand{\icol}[1]{% inline column vector
  \left(\begin{smallmatrix}#1\end{smallmatrix}\right)%
}$
Scenario:
Let's consider a road segment on which there is continuous flow of cars circulating at a constant speed $V_{car_1}$ and where cars are all equally spaced by a distance $l$.
Now imagine that a car 2 is crossing the road at a constant speed $V_{car_2}$ with an intersection angle $\theta$. Assuming both cars having a square shape of length $\lambda$, the goal is to estimate the probability of collision.

Method 1:
The probability of collision is given by:
$$
P_{collision} = P_{car2\_hits\_car1} \lor P_{car1\_hits\_car2}
$$
$$
\\P_{car2\_hits\_car1} \approx \frac{2\lambda}{l}
\\P_{car1\_hits\_car2} \approx crossing\_time \,\frac{|V_{car_1}-V_{car_2}\,cos(\theta)|}{l} = \frac{2\lambda \,|V_{car_1}-V_{car_2}\,cos(\theta)|}{l\, V_{car_2}\,sin (\theta)}
$$
which leads to:
$$P_{col\_method\_1} \approx \frac{2 \lambda}{l}\left(1+ \frac{|V_{car_1}-V_{car_2}cos(\theta)|}{V_{car_2}sin (\theta)}\right)$$
Method 2:
Now for some reasons, we want to estimate this probability of collision using a different method. The car 1 position probability density is estimated using a kernel density estimation. The function $f(x,y)$ gives the probability of the center of the car 1 being at coordinates $(x , y)$.
$f$ is obtained using traffic observation data: each car 1 trajectory observation on the segment of length $l$ is represented by a uniformly time sampled (dt = 0.01 seconds) series of position $(x_1(t), y_1(t))$. Multiple trajectory observation (taking a year of observations for example) are concatenated and $f$ is obtained by fitting a kernel density estimate on these concatenated observations (using scikit-learn kde in practice). We then have:
$$
\int\limits_{min(y_1)}^{max(y_1)} \int\limits_{0}^{l}{f\left(x, y\right) \,dx\,dy} = 1
$$
Here is an example of contour plot for an estimated density f:

Now, let's consider $C_2 = \icol{x_2\\y_2}$ the coordinates of the car 2, we have:
$$
C_2(t) = 
\begin{pmatrix}
    x_2(t)\\
 y_2(t)
\end{pmatrix} = 
\begin{pmatrix}
    x_{2_0}+V_2 cos(\theta) t\\
 y_{2_0}+V_2 sin(\theta) t
\end{pmatrix}
$$
Considering that the car 1 always comes from the left of the crossing point and that the car2 always come from the bottom, I expect the probability of collision to be:
$$
P_{collision} = P_{car2\_hits\_car1} \lor P_{car1\_hits\_car2}
$$
Using density integration:
$$
\\P_{car2\_hits\_car1} \approx \int\limits_{0}^{+\infty} \int\limits_{y_2(t)-\lambda}^{y_2(t)+\lambda}{f\left(x_2(t)-\lambda, y\right) \,dy\,dt}
\\P_{car1\_hits\_car2} \approx \int\limits_{0}^{+\infty} \int\limits_{x_2(t)-\lambda}^{x_2(t)+\lambda}{f\left(x, y_2(t)+\lambda\right) \,dx\,dt}
$$
$$
P_{col\_method\_2} \approx \int\limits_{0}^{+\infty} \int\limits_{y_2(t)-\lambda}^{y_2(t)+\lambda}{f\left(x_2(t)-\lambda, y\right) \,dy\,dt} + \int\limits_{0}^{+\infty} \int\limits_{x_2(t)-\lambda}^{x_2(t)+\lambda}{f\left(x, y_2(t)+\lambda\right) \,dx\,dt}  
$$
Motivation for the choice of integral bounds:

Basically at rach dt, we integrate the probability of a car1 beeing on the blue line and on the red line.
Results:
The obtained results between the 2 methods are different and the following relation has been found empirically:
$$ 
P_{col\_method\_1} = \frac{V_{car_2} sin \theta +|V_{car_1} - V_{car_2}cos\theta|}{2}P_{col\_method\_2}
$$
For example considering both cars of size $\lambda=3$ running at $V_1=V_2=10m/s$ crossing at a $\theta = 90deg$ and taking $l=100m$ gives:
$$
\\ P_{col\_method\_1} = 0.12
\\ P_{col\_method\_2} = 0.012
$$
Question:
While I understand that there need to be a "scaling factor" that needs to be in m/s to obtain correct units for the second method, I can't explain its formula. Does anyone have an explanation for it?
The code is available as a python notebook:
https://colab.research.google.com/drive/1ypeq7SSPUGqMyxn1Dxs6_lhenCnCTUFD?usp=sharing
Info:
A quick Monte-Carlo simulation shows that the method 1 is giving the right probabilities.

First, once you know where you are in this picture relative to the position of the car 1, there's nothing probabilistic left in the problem: you know exactly whether you're colliding or not. So the event of collision and its probability boils down to what is random about your relative location.
Reduction to 1D
Let's describe how car 1 moves and looks in the coordinate system where car 2 is stationary and y-axis is parallel with car 1 speed vector. This also means that x-component of car 1 speed is zero.
We start with the original setup here:

Then we introduce a new coordinate system as follows:

In the new coordinate system Car 1 has a speed vector
$$\vec v=(v_x,v_y)=\left(0,-\sqrt{v_1^2+v_2^2-2v_1v_2\cos\theta}\right)$$
Its cross section in direction of y-axis is $\lambda_1=\lambda(|\sin\alpha|+\cos\alpha)$, where $\cos\alpha=\frac{v_2\sin\theta}{v_y}$ and $\sin\alpha=\frac{v1-v_2\cos\theta}{v_y}$. Note, that in this coordinate system x-axis isn't parallel to the speed vector $\vec v_2$ of a Car 2. The angle between them is defined by speeds and angle $\theta$.
The gap between cars 1 is then $l\cos\alpha-\lambda_1$. Notice that, depending on parameters of the problem the gap can be zero or even negative, meaning there's no way for car 2 to avoid a collision.
Now, the car 2 cross section relative to this new y-axis is $\lambda_2=\lambda(|\sin(\theta-\alpha)|+|\cos(\theta-\alpha)|)$.
Probabilities: nothing is known about car locations
Finally, the probability to avoid collision given $v_1,v_2,\lambda,l,\theta$ seems to be a simple ratio:
$$p=\max\left[\frac{l\cos\alpha-\lambda_1-\lambda_2}{l\cos\alpha},0\right],$$ where $\theta\in(0,\pi)$. When  $\theta=0$ there's no crossing the road, so I exclude this case.
When formulate it like this, we assume that all parameters are given except the current locations of cars!
Now we need to make an assumption on what is probability density of car locations. Due to translation symmetry, we can further reduce the free variables to the relative location of Car 2 to Car 1. If we assume that the location is a uniform random point on Euclidian space of the surface, then the equation will work. Why? Because the new coordinate system is a simple rotation relative to that Euclidian system. Therefore, we can assume that the location of car 2 in this new system's x-axis is a uniform random.
Special cases
Let's see what happens when $v_1=v_2\cos\theta$:
$$v_y=v_2\sin\theta\\
\cos\alpha=1\\
\sin\alpha=0\Rightarrow \alpha=0\\
\lambda_1=\lambda\\
\lambda_2=\lambda\left(|\sin(\theta)|+\cos\theta\right)\\
p=\frac{l-\lambda(1+(|\sin\theta|+\cos\theta))}{l}$$
This is a intuitive expression for cars 1 and 2 moving along at the same East-West speed while car 2 is drifting North bound.
When $\theta\to 0+$ this further simplifies into a intuitive expression of cars 1 and 2 moving almost in parallel West bound at the same speed while car 2 is also slowly drifting North bound:
$$p\to 1-2\frac{\lambda}{l}$$
When $\theta\to\pi$ we get another intuitive solution:
$$\cos\alpha\to 0+\\
\sin\alpha=1\Rightarrow \alpha=\pi/2\\
\lambda_1=\lambda\\
\lambda_2=\lambda\\
p=\max\left[0,\frac{-2\lambda}{0+}\right]=0$$
This is an unavoidable head on collision.
Conclusion
In my solution the important thing is not the equations, they may have errors in them. The important thing is to recognize that this problem is univariate! By turning the coordinate system we revealed 1D nature of this problem that was formulated in 3 dimensions originally: 2D plane plus time dimension. I then explain why uniform distribution can be used here, which also important. Then the probability becomes simply the ratio.
