## Conditioning on Events
Everything that applies to the general [[Probability Mass Function]] also applies to the conditional PMF.
| General | Conditional | Description |
| ----------------------------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| $p_X(x)=P(X=x)$ | $p_{X\vert A}(x)=P(X=x\vert A)$ | The conditional PMF returns probabilities of different values $x$ given event $A$ happened. |
| $\displaystyle \sum_x p_X(x)=1$ | $\displaystyle \sum_x p_{X\vert A}(x)=1$ | The probabilities of the conditional PMF also need to sum to $1$. |
| $\mathbb E[X] = \displaystyle \sum_x x* p_X(x)$ | $\mathbb E[X\vert A] = \displaystyle \sum_x x* p_{X\vert A}(x)$ | The conditional expectation is obtained by multiplying all values x with the conditional PMF. |
| $\mathbb E[g(X)]=\sum_x g(x)*p_X(x)$ | $\mathbb E[g(X) \vert A]=\sum_x g(x)*p_{X\vert A}(x)$ | The conditional expectation of a function is obtained by multiplying the function with the conditional PMF. |
## Conditioning on Random Variables
So far we have conditioned a [[Random Variable]] on an [[Events|event]]. However we can also condition a r.v. on another r.v.. Since an event is nothing else than a collection of outcomes, we only have to change the notation.
| Conditional on Event | Conditional on Random Variable | Statement |
| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
| $p_{X \vert A}(x,y) = \frac{p_X(x) \cap A}{P(A)}$ | $p_{X \vert Y}(x,y) = \frac{p_{XY}(x,y)}{p_Y(y)}$ | Probability Mass Function |
| $\begin{align}p_X(x)&=p_{X\vert A_1}(x)*P(A_1)+ \dots \\&+p_{X\vert A_n}(x)*P(A_n)\end{align}$ | $\begin{align} p_X(x)&= \sum_y p_{XY}(x,y)\\ p_X(x)&= \sum_y \underbrace{p_{X \vert Y}(x,y)*p_Y(y)}_{\text{multiplication rule}} \end{align}$ | [[Total Probability Theorem]] |
| $\begin{align} \mathbb E[X] &= E[X\vert A_1]*P(A_1) + \dots \\ &+ E[X\vert A_n]*P(A_n) \end{align}$ | $\mathbb E[X] = \sum_y \mathbb E[X \vert Y=y] * p_Y(y)$ | [[Total Expectation Theorem]] |