# Conditional probability distribution of one variable given that it is equal to another variable

If I have two random variables $$X$$ and $$Y$$ that map to the same sample space $$S = \{1, 2, 3, ..., N\}$$, and each variable has a probability distribution $$\pi_x(x)$$ and $$\pi_y(y)$$, then what is the conditional probability distribution of $$X$$ if we know that $$X = Y$$? My first thought was that it would just be $$\pi_y(y)$$, but it doesn't make sense to me that the conditional distribution would be independent of $$\pi_x(x)$$.

• You cannot find the conditional disrtibution with the given information. Apr 7, 2021 at 5:23

## 1 Answer

Indeed, you can see that your answer ought to be symmetric in $$X$$ and $$Y$$, since $$P(X=x|X=Y)$$ must be the same as $$P(Y=x|X=Y)$$.

Suppose you know $$X$$ and $$Y$$ are independent. Then \begin{align*} P(X=x|X=Y)=&\frac{P(X=x,X=Y)}{P(X=Y)}\\ =&\frac{P(X=x,Y=x)}{\sum_y P(X=y, Y=y)}\\ =&\frac{P(X=x)P(Y=x)}{\sum_y P(X=y)P(Y=y)}\\ =&\frac{\pi_X(x)\pi_Y(x)}{\sum_y \pi_X(y)\pi_Y(y)}. \end{align*} So the mass at $$x$$ is proportional to $$\pi_X(x)\pi_Y(x)$$.

If you don't assume independence, you need to know more about the joint probability mass function of $$X$$ and $$Y$$. Let $$\pi_{X,Y}(x,y)=P(X=x, Y=y)$$. Then in a similar way $$P(X=x|X=Y)=\frac{\pi_{X,Y}(x,x)}{\sum_y \pi_{X,Y}(y,y)}.$$