# Conditional probability

## In words...

Given two events A and B, the conditional probability of A given B is the probability of observing A given that B occurred. Its value is obtained by dividing the probability that the events occur together by the probability of B.

For a random pair (or a random vector), the conditional probability distribution models the distribution of a subset of the variables given the value of the others.

## In maths...

### Conditional probability of events

Given a probability space $(\Omega,\Sigma,P)$, the conditional probability of the event $A\in\Sigma$ given that the event $B\in\Sigma$ occurred is $$P(A\ |\ B) = \frac{P(A,\ B)}{P(B)} ,$$ i.e., it is the probability that the two events occur simultaneously divided by the probability of the event $B$.

### Conditional probability distribution of discrete random pairs

Given a discrete random pair $(X,Y)\in\X\times\Y$, the conditional probability distribution of $X$ given that $Y=y$ is defined for all $y\in\Y$ as $$P_{X|Y=y} : \Sigma_X \rightarrow [0,1]$$ with $$P_{X|Y=y} ( x ) = P(X=x\ |\ Y=y) = \frac{P(X=x,\ Y=y)}{P(Y=y)} = \frac{P_{X,Y}(x,y)}{P_Y(y)} ,$$ where $P_{X,Y}$ is the joint probability distribution of $(X,Y)$ and $P_Y$ the marginal distribution of $Y$.

### Conditional probability density function of continuous random pairs

Given a continuous random pair $(X,Y)\in\X\times\Y$, the conditional probability density function of $X$ given $Y$ is defined for all $y\in\Y$ as $$p_{X|Y}(\cdot, y) : \X \rightarrow \R^+$$ with $$p_{X|Y}( x \ |\ y ) = \frac{p_{X,Y}(x, y)}{p_Y(y)} ,$$ where $p_{X,Y}$ is the joint probability density function of $(X,Y)$ and $p_Y$ the marginal density function of $Y$.

### Conditional probabilities with mixed random pairs

Given a mixed random pair $(X,Y)\in\X\times\Y$ with $\X\subseteq\R$, $\Y\subset\Z$, the conditional probability density function of $X$ given $Y$ is defined for all $y\in\Y$ as $$p_{X|Y=y}(\cdot, Y=y) : \X \rightarrow \R^+$$ with $$p_{X|Y=y}( x \ |\ Y=y ) = \frac{p_{X,Y}(x, y)}{P_Y(y)} ,$$ where $p_{X,Y}$ is the joint probability density function of $(X,Y)$ and $P_Y$ the marginal distribution of $Y$.

## Notes

The conditional probability $P(A|B)$ is not well-defined when $P(B)=0$. However, this case can be dealt with by setting $P(A|B)$ to an arbitrary value. Indeed, this value does not influence the computations involving $P(A|B)$ since it corresponds to the probability of observing $A$ given that an event with zero probability occurred.