Compute win/lose chances picking two integers in different overlapping intervals I'm asking some help to compute a probability formula, as I'm not sure of my computation and approximation.
The problem:
Two players P1 and P2 pick a random integer in different number ranges, the problem is to compute the probability of lose of P1.

*

*a, b, n are positive integers

*b > a

*n < (b - a)    (The two intervals have common values)

*in case of equality, P1 lose

P1 picks a number in [a,b] 
P2 picks a number in [a+n,b+n]
My try to estimate the % of lose of P1:

*

*Always lose cases
P1 always lose is it picks a number between [a, a+n]
Always loose ratio: n/(b-a)


*Lose % for P1
When P1 pick a number x over a+n, the probability of lose are:
(b+n-x)/(b-a)
Each one has a probability of 1/(b-a)
formula would be:
SUM((b+n-x)/(b-a)², x=a+n..b+n)
But my interval are big with no real way to compute that sum.
Can this be appoximated by the using the average value of each interval ?
P1 average: a+(b-a)/2 = (b-a)/2
P2 average: a+n+(b-a)/2 = n + (b-a)/2
So probability P1 lose would be:
((n + (b-a)/2) - ((b-a)/2))/(b-a)
So: n/(b-a)+1/2
For the global:
n/(b-a)+(1-n/(b-a))*(n/(b-a)+1/2)
That's OK ? or ?
Many thanks for the review !

Here is the simplest way to calculate this. There are three ways that $P_1$ can lose.

*

*As you noted, if $P_1$ chooses strictly less than $a+n$, then she automatically loses. The probability of this occurring is $\frac{n}{b-a+1}$, as there are $n$ numbers in $\{a,a+1,\dots,a+n-1\}$, and $b-a+1$ numbers in $\{a,a+1,\dots,b\}$.


*Similarly, if $P_2$ chooses a number which is strictly more than $b$, then $P_1$ will certainly lose. The probability of this is also $\frac{n}{b-a+1}$.


*The probability that neither of the previous situations happens is
$$
\left(1-\frac{n}{b-a+1}\right)^2
$$
Furthermore, conditional on neither of these events happening, both $P_1$ and $P_2$ are picking numbers from the same range, $\{a+n,a+n+1,\dots, b\}$. There are two things that can happen.

*

*If $P_1$ and $P_2$ pick the same number, then $P_1$ loses. This happens with probability $\frac1{b-a-n+1}$ (why?).


*Conditional on them picking different numbers, $P_1$ wins exactly half the time, by symmetry.
Putting this altogether,
$$
\mathbb P(P_1 \text{ wins})=
\underbrace{\left(1-\frac{n}{b-a+1}\right)^2}
_{\text{Probability that $P_1\ge a+n$ and $P_2\le b$.}}
\times 
\underbrace{\left(1-\frac{1}{b-a-n+1}\right)}_
\text{Conditional probability $P_1\neq P_2$}
\times 
\underbrace{\frac12}
_\text{Conditional probability $P_1>P_2$.}
$$
