what formula to calculate F(x,y) function? The number of minor surgeries $X$, and the number of major surgeries $Y$, for a 
policyholder, this decade, has joint cumulative distribution function
$$F(x, y) = (1-(0.5)^{x+1})(1-(0.2)^{y+1})$$, for nonnegative integers x and y. 
Calculate the probability that the policyholder experiences exactly three minor surgeries 
and exactly three major surgeries this decade.
Part of Solution:
$$P(X = 3,Y = 3)) = F(3,3) - F(2,3) - F(3,2) + F(2,2)$$
I know they are using a formula to calculate this. What is the formula they are using here in this case?
 A: Recall the definition of a joint cumulative function:
The joint cumulative function of two random variables X and Y is defined as
$$F(x,y) = P(X \leq x,Y \leq y)$$
so for example F(3,3) tells you the probability that a policyholder needs 3 or fewer minor surgeries and three or fewer major surgeries.
The first step in deriving that formula is to realize that
$$P(X = 3, Y = 3) = P(X \leq 3, Y = 3) - P(X \leq 2, Y = 3)$$
Can you understand why that is the case? If so, you can then apply the same logic to the two new terms and should be able to arrive at the solution.
A: Recall that $F(x,y)=P(X\leq x,Y\leq y)$. You effectively need to now write the event $\{X=x,Y=Y\}$ as unions and differences of events like $\{X\leq a,Y\leq b\}$. It's easiest to draw yourself a picture of the events:

Each box represents sets $(X\leq x,Y\leq y)$, $(X\leq x-1,Y\leq x)$, $(X\leq x-1,Y\leq x-1)$ and $(X\leq x,Y\leq y-1)$. Technically all boxes should extend infinitely left and down, but you get the idea.
The even you are interested is the top right point. It's important to point out here that your events are discrete. Now it's very easy to see that:
\begin{align*}
P(X=x,Y=y)&=P(X\leq x,Y\leq y)-P(X\leq x-1,Y\leq y)\\
&\mbox{ }\ \ -P(X\leq x,Y\leq y-1)+P(X\leq x-1,Y\leq y-1),
\end{align*}
where the last term accounts for the bottem left box being counted twice, i.e. the usual $P(A\cup B)=P(A)+P(B)-P(A\cap B)$ rule. 
