Artificial intelligent assistant

Expected number of overlaps between intervals Suppose $N$ intervals of length $\delta$ are positioned in $[0,1]$. The starting point $l_i$ of each interval is drawn from an uniform distribution, i.e., $l_i \in [0, 1-\delta]$, thus it will determine the position of the $i$-th interval. These intervals may overlap at some point in $[0,1]$. I call "overlap" each superimposition of an interval over another interval. E.g. A = [0, 0.2] B = [0.1, 0.3] C = [0.25 0.45]. Number of overlaps = 2 (A with B, B with C) Since an overlap occurs between a pair of intervals, $\frac{N(N-1)}{2}$ is the maximum number of overlaps. I would like to compute the expected number of overlaps between the intervals in $[0,1]$.

I found a reference where it is stated that: " _To compute the expected number of intersections, use the fact that expectation is additive. The expected number of intersections is just $\binom{N}{2}p$ where $p$ is the probability of an intersection_ ".

(To be honest, I can't figure out why $\binom{N}{2}p$ is the expected number. I ask you some suggestions in the comments. I tried with a Monte Carlo simulation and it seems to work fine.)

Then the probability $p=P(|l_i - l_j| < \delta)$ of having one intersection is computed as the portion of the area of the square $[0,1-\delta]\times[0,1-\delta]$ between the curves: $l_i - l_j > \delta$ and $l_i - l_j > -\delta$, and it is equal to: $$ P(|l_i - l_j| < \delta) = \frac{2\delta-3\delta^2}{(1-\delta)^2} $$

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 0df7963ed9ae53e49566e2db523d63e0