Same margins, two joints

Construct two pairs (X,Y) with Bernoulli(1/2) margins, one independent and one dependent. Compare \mathrm{P}(X=Y).

Let X and Y be independent Bernoulli(1/2). Then \mathrm{P}(X=Y)=1/2. The pair (X,X) has the same margins, and \mathrm{P}(X=X)=1.