# Let X,Y be independent random variables, and Z=X+Y.

Confusion about sum of random variables conditional probabilities
Let X,Y be independent random variables, and $Z=X+Y.$. Then I want to calculate $Pr\left[X=x\mid Z=z\right].$. My confusion is on evaluating this expression. On the one hand, I have
$Pr\left[X=x\mid Z=z\right]=Pr\left[Z-Y=x\mid Z=z\right]=Pr\left[z-Y=x\right]=Pr\left[Y=z-x\right].$
But also, $Pr\left[Z=z\mid X=x\right]=Pr\left[X+Y=z\mid X=x\right]=Pr\left[Y=z-x\right].$ So these two probabilities are equal? But $Pr\left[Z=z\mid X=x\right]Pr\left[X=x\right]=Pr\left[X=x\mid Z=z\right]Pr\left[Z=z\right]$ and in general $Pr\left[X=x\right]$ and $Pr\left[Z=z\right]$ are not equal. I believe it should be $Pr\left[X=x\mid Z=z\right]=Pr\left[Y=z-x\mid Z=z\right]$ but I don't think the conditional $Z=z$ can be removed since Y and Z are not independent?
I'm not sure whether the first equation holds either. For example, if I roll a fair six sided die X (numbered 1 to 6) and roll a fair ten sided die Y and take the sum, then $Pr\left[X=1\mid Z=2\right]=1$ since the only possible outcome is $\left(x,y\right)=\left(1,1\right),$, and this is not equal to $Pr\left[Y=\left(2-1\right)\right]=1/10.$. On the other hand it is equal to $Pr\left[Y=\left(2-1\right)\mid Z=2\right]=1.$. I think I'm making a mistake in one of these but it's not clear to me in which step.
(The context of this was that X is a random variable with given distribution representing some unknown parameter and Y is a standard normal error. Then you observe $z=x+y$ and want to estimate the X.)
You can still ask an expert for help

## Want to know more about Probability?

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Ramiro Sosa
Step 1
The mistake lies in this step:
$Pr\left[Z-Y=x\mid Z=z\right]=Pr\left[z-Y=x\right]$
Note that $P\left(A|B\right)=\frac{P\left(B|A\right)\cdot P\left(A\right)}{P\left(B\right)}$. The actual evaluation is instead
$P\left(Z-Y=x|Z=z\right)=\frac{P\left(Z=z|Z-Y=x\right)\cdot P\left(Z-Y=x\right)}{P\left(Z=z\right)}=\frac{P\left(Z=z|X=x\right)\cdot P\left(X=x\right)}{P\left(Z=z\right)}$
If we are given $X=x$, $Z=z$ only when $Y=z-x$. Thus, $P\left(Z=z|X=x\right)=P\left(Y=z-x\right)$. The above formulation should make it clear that this is not true for $P\left(X=x|Z=z\right).$ We now have
$P\left(Z-Y=x|Z=z\right)=P\left(Y=z-x\right)\cdot \frac{P\left(X=x\right)}{P\left(Z=z\right)}$
Step 2
In your dice example, this evaluates as
$P\left(X=1|Z=2\right)=P\left(Y=1\right)\cdot \frac{P\left(X=1\right)}{P\left(Z=2\right)}=\frac{1}{10}\cdot \frac{\frac{1}{6}}{\frac{1}{60}}=1$ as expected.
I shall take another example, to make it clearer. Let us calculate the probability $P\left(X=2|Z=5\right)$. We see that $Z=5$ is achieved by the following pairs:
$\left(X,Y\right)=\left\{\left(1,4\right),\left(2,3\right),\left(3,2\right),\left(4,1\right)\right\}\phantom{\rule{thickmathspace}{0ex}}⟹\phantom{\rule{thickmathspace}{0ex}}P\left(X=2|Z=5\right)=\frac{1}{4}$
Using the formula, we can calculate the same as
$P\left(X=2|Z=5\right)=P\left(Y=3\right)\cdot \frac{P\left(X=2\right)}{P\left(Z=5\right)}=\frac{1}{10}\cdot \frac{\frac{1}{6}}{\frac{4}{60}}=\frac{1}{4}$
which is the same as before.
[$P\left(Z=5\right)=\frac{4}{60}$ as there are 60 possible (X,Y) and $Z=5$ is only achieved by 4]