Independence/Dependence of Random variable Say that I have two independent discrete random variables $X,Y$ st 
$X+Y=Z$
I think that $Z=z$ ($Z$ is constant)  makes $X$ and $Y$ dependent?
However in my notes it says that we can compute the conditional distribution of $X$ given $Z=z$ as follows:
$Pr(X=x|Z=z)\propto Pr(X=x \cap Z=z)=Pr(Y=z-x \cap X=x)=Pr(Y=z-x)Pr(X=x)$
But the last step implies that $X$ and $Y$ are independent?
 A: Let $X=1$ and $Y=1$ with probability one. As random variables, $X$ and $Y$ are independent:
$$P(X=1)=1, P(X\not =1)=0, P(Y=1)=1, P(Y\not =1)=0$$
and
$$P(X=1\cap Y=1)=P(X=1)P(Y=1)=1$$
$$P(X=1\cap Y\not=1)=P(X=1)P(Y\not=1)=0$$
$$P(X\not =1\cap Y=1)=P(X\not =1)P(Y=1)=0$$
$$P(X\not=1\cap Y\not =1)=P(X\not =1)P(Y\not =1)=0.$$
At the same time 
$$P(Z=X+Y=2)=1.$$
That is, $Z=X+Y=$contant does not necessarily mean that $X$ and $Y$ are dependent (not independent.)
A: For a simple counterexample, suppose $X\sim\operatorname{Ber}(p)$ and $Y\sim\operatorname{Ber}(q)$ are independent, and $Z=X+Y$. Then
$$\mathbb P(X=0,Y=0\mid Z=1)=0 $$
while
$$\mathbb P(X=0,Y=0) = \mathbb P(X=0)\mathbb P(Y=0) = (1-p)(1-q)\ne 0. $$
A: $X$ and $Y$ are independent iff they are both constant.
Assume they are both independent. Since the map $x \mapsto z - x$ is a homeomorphism, the identity $\sigma(X) = \sigma(z - Y) = \sigma(Y)$ holds. But a sigma-algebra is independent from itself iff it is $P$-trivial, that is all sets have a probability of either $0$ or $1$. But this means that $X$ and $Y$ are constant.
A: Let $x_0,x_1$ be distinct with $P(X=x_0)$ and $P(X=x_1)$ both positive. 
Then: $$P(Y=z-x_0\mid X=x_0)=1\neq0=P(Y=z-x_0\mid X=x_1)$$
This shows that $X$ and $Y$ are not independent.
There is one escape: $P(X=x_0)=1=P(Y=y_0)$ for some $x_0,y_0$ with $x_0+y_0=z$.
Two rv's that are both a.s. constant are independent.
