Random variables defined by other random variables? Let $X$ and $Y$ be two random variables with a Bernoulli Distribution of $\frac{1}{2}$. Now, define random variables $A = X + Y$ and $B = |X - Y|$
Are $A$ and $B$ dependent vs. independent?
Now, obviously if they are independent, then $$P(A=0, B=0) = P(A=0)*P(B=0)$$
and $$P(A=1, B=1) = P(A=1)*P(B=1)$$ but I'm not quite sure how to compute $P(A=0, B=0)$ nor am I sure how to compute $P(A=0)$, $P(A=0)$ or $P(B=1)$ for example. The notion of a random variable defined by another random variable is confusing to me, would appreciate some help, thanks in advance!
 A: I'll assume $X$ and $Y$ are independent, which you didn't state in your question.
In this case, an easy way to see that $A$ and $B$ are dependent is the following: suppose $B = 0$, then that means $X = Y$ (since $\lvert X - Y \rvert = 0$), so either $X=Y=0$ or $X=Y=1$, which implies $A = 0$ or $A = 2$, so in particular, $A$ cannot be $1$. This means that $P(A = 1, B = 0) = 0$: there is no possible pair $(X, Y)$ such that $A=1$ and $B=0$.
However, the product $P(A = 1) P(B = 0)$ is not zero. If you are unsure about this, we can compute explicitly $P(A = 1) = P(X + Y = 1) = P(X=0, Y=1) + P(X=1, Y=0) = 1/4 + 1/4 = 1/2$ and $P(B = 0) = P(X = Y) = P(X = 0, Y = 0) + P(X = 1, Y = 1) = 1/4 + 1/4 =  1/2$ so therefore $P(A=1)P(B=0) = \frac12 \cdot \frac12 = \frac14$.
So we have $P(A = 1, B = 0) = 0$ while $P(A=1)P(B=0) = \frac14$, which shows that they $A$ and $B$ are dependent.
A: $A=0\iff X=0\land Y=0,\\ A=1\iff (X=0\land Y=1)\lor(X=1\land Y=0),\\ A=2\iff(X=1\land Y=1)$
Therefore: $P(A=0)=P(A=2)=0.25, P(A=1)=0.5$
$B=0\iff (X=0\land Y=0)\lor (X=1\land Y=1),\\ B=1\iff (X=1\land Y=0)\lor(X=0\land Y=1)$
Therefore $P(B=0)=P(B=1)=0.5$
But $P(A=0,B=0)=P(B=0|A=0)P(A=0)=0.25\neq P(A=0)\cdot P(B=0)=0.25\cdot 0.5$
A: We can establish the dependence between variables with no explicit computation of the probabilities. Consider the following small table containing all possible outcomes.
$$XYAB$$
$$0 0 0 0$$
$$0 1 1 1$$
$$1 0 1 1$$
$$1 1 2 0$$
This immediately shows that $B$ is a function of $A$, therefore dependent. The reverse is not true, because $B=0$ does not determine A, which could be $0$ or $2$.
We may express the relationship with particular functions containing the three points $(A,B)$ $$(0,0),(1,1),(2,0).$$
Some options are a parabola $$B=2A-A^2,$$
a sinus $$B=\sin\left(A\frac{\pi}{2}\right),$$
or a remainder $$B = A\mod 2.$$
