# Probability of matching two binomial random variables

Consider the following random experiment. We are given a multiset of $n$ integers $d_1, \ldots, d_n$. For each $i \in [n]$, we draw two random variables $x_i, y_i \leftarrow \mathrm{Bin}(d_i, p)$, resulting in two multisets $X := \{x_1, \ldots ,x_n \}, Y := \{ y_1, \ldots, y_n \}$. The success probability $p$ remains the same for all trials.

Now, given $p, X, Y$ (but no ordering, and no $d_i$'s), and $x \in X, y \in Y$ what is the probability that $x$ and $y$ have the same index $i$?

To clarify, if $d = d_1 = \ldots = d_n$, and $p = 1$, the probability should be $1/n$.

I've tried approaching the problem, but so far I can't write down a convincing formulation of the problem. I've tried computing the maximum likelihood (over $d$) that two variables $x, y$ originate from the same $d$, and then divide that by the sum of all maximum likelihoods for $x, y'$. However, when I write down the probabilities that this approach yields, it gives far too large probabilities to incorrect pairs. What am I doing wrong?

-