I am working on problems from the textbook Statistical Inference (2nd Edition) by George Casella and Roger L. Berger.
I am running into difficulty with Exercise 6 of Chapter 4, which reads:
Person A and Person B agree to meet at a certain place between 1PM and 2PM. Suppose they arrive at the meeting place independently and randomly during the hour. Find the distribution of the length of time that Person A waits for Person B. If Person B arrives before Person A, define Person A's waiting time as 0.
I have found the solution to this problem, but I do not quite understand it. The solution reads:
Solution. Let $A$ and $B$ be random variables representing the time at which Person A and Person B arrives, respectively. By the problem statement, random variables $A$ and $B$ both follow a uniform distribution on the interval $(1,2)$. Note that the interval is open because it is stated that the two people arrive at the destination specifically between 1PM and 2PM. Hence, we may define the joint PDF of $A$ and $B$ as a uniform distribution over the open square formed by $(1,2) \times (1,2)$, which is to say $f_{AB}(a,b) = 1$ for $(a,b) \in (1,2) \times (1,2)$.
Now, let $X$ be a random variable representing the amount of time Person A waits for Person B if Person A arrives before Person B, defining $X$ to be $0$ if Person B arrives before Person A, which is to say $X = B - A$ if $A < B$ and $X = 0$ if $A \geq B$. If Person B arrives before Person A then $B - A < 0$ and so we may define $F_X(x) = P(X \leq x) = 0$ for $x = B-A < 0$. If $A = B$, which is to say they show up at the same time, then we have $x \leq 0$ and we may write $$ F_X(x) = P(X < x) = P(A = B) = \int_1^2 \int_1^a (1) \text{d}b \text{d}a = \frac{1}{2} $$ If $A < B$ and $B-A < 1$, then we have $0 < x < 1$. The probability that $B - A > x$ for $0 < x < 1$ is given by $$ P(B-A > x) = \int_1^{2-x} \int_{a+x}^{2} (1) \text{d}b \text{d}a = \frac{1}{2} + x - \frac{1}{2}x^2 $$ and thus we have $$ F_X(x) = P(B-A \leq x) = 1 - P(B-A > x) = \frac{1}{2} - x + \frac{1}{2}x^2 $$ Finally, if $x \geq 1$ then $B-A > 1$, and thus $F_X(x) = P(X < x) = 1$ for $x \geq 1$. Thus, the CDF of $X$ is given by $$ F_X(x) = \begin{cases} 0 & \text{ for } x < 0 \\ \frac{1}{2} & \text{ for } x = 0 \\ \frac{1}{2} + x - \frac{1}{2}x^2 & \text{ for } 0 \leq x < 1 \\ 1 & \text{ for } x \geq 1 \\ \end{cases}$$ QED.
Now, I understand this solution except for what is the arguably the most important part: finding $F_X(x) = P(X \leq x)$ for $x \in (0,1)$. Can someone explain the construction of this integral, and if there is any particular reasoning behind calculating $1 - P(X > x)$ as opposed to $P(X \leq x)$ directly? I have been staring at this for the better part of two days and still cannot seem to construct it myself, any and all help would be greatly appreciated.
This question is very easy if you think of it geometrically. Take a uniform distribution over the unit square, with lower left corner at (0,0) and upper right corner at (1,1). Now pick a random point in the square, and let the x-value represent the arrival time of A and the y-value represent the arrival time of B.
The probability that A waits more than x hours (with x between 0 and 1) is then just the area of the triangle on the lower right, with corners at (x,0), (1,1-x) and (1,0).
The area of this triangle is $\frac{1}{2}(1-x)^2$. The double integral is just a fancy way of finding this area. Finding $P(X>x)$ is just more convenient because finding the area of the triangle is easier than finding the rest of the square.