In the conditional universe, the [[Probability Density Function]] is analogous to the [[Probability Mass Function]] (see [[Conditional Probability Mass Function]]).
## Conditioning on an Event
When conditioning on an [[Events|event]], we just scale the respective range that the event covers, so that the conditional PDF sums to $1$.
$
f_{X \vert A}(x)=
\begin{cases}
0 & \text{if } A \text{ does not happen}\\
\frac{f_x(x)}{\mathbf P(A)} & \text{if } A \text{ happens}
\end{cases}
$
![[conditional-pdf-event.png|center|400]]
**Derivation:**
$
\begin{align}
f_{X \vert A}(x) * \delta
&\approx \mathbf P(x \le X \le x + \delta \vert A) \tag{1}\\[10pt]
&\approx \frac{\mathbf P\big((x \le X \le x+ \delta) \space \cap \space A\big)}{\mathbf P(A)} \tag{2}\\[10pt]
&\approx \frac{\mathbf P(x \le X \le x+ \delta)}{\mathbf P(A)} \tag{3}\\[10pt]
f_{X \vert A}(x) * \delta &\approx \frac{f_X(x) *\delta}{\mathbf P(A)} \tag{4}\\[10pt]
f_{X \vert A}(x) &\approx \frac{f_X(x)}{\mathbf P(A)} \tag{5}
\end{align}
$
where:
- (2) Apply [[Bayes Rule]] to the conditional probability.
- (3) The intersection of the denominator can be approximated by $(x \ge X \ge x+\delta)$ as it has only $\delta$ length. Note that if $x \not \in A$, then the intersection would be $\emptyset$. But we are not interested in that part of the proof.
- (4) We get rid of the $\delta$ on both sides.
## Conditioning on a Random Variable
We apply Bayes’ theorem as usual, also when we condition a r.v. on another r.v..
$ f_{X \vert Y}(x \vert y) = \frac{f_{X,Y}(x,y)}{f_Y(y)} $
- However, for discrete conditions we always had the constraint, that the conditioning probability (denominator) has to be non-negative.
- With continuous r.v’s. as conditions, this is now problematic, since the denominator $f_Y(y)=0$ at a specific point $y$. Therefore the formula has to be interpreted for small intervals.
$ \begin{align}
\mathbf P \big (x \le X \le x+\delta \, \vert \, y \le Y \le y+ \epsilon \big) &
\approx \frac{f_{X,Y}(x,y)*\delta *\epsilon}{f_Y(y)* \epsilon} \\[10pt]
&\approx \frac{f_{X,Y}(x,y)}{f_Y(y)}*\delta \\[14pt]
&\approx f_{X \vert Y}(x,y)*\delta
\end{align}
$
![[conditional-pdf-random-variable.png|center|400]]
**Relationship to Joint Distribution:**
The conditional PDF $f_{X \vert Y}(x,y)$ is the [[Joint Probability Density Function|Joint PDF]] $f_{X,Y}(x,y)$ fixed at some value $y$ and scaled by $f_Y(y)$ so that it integrates to $1$.
$ \int_{-\infty}^\infty f_{X \vert Y}(x,y) = \frac{\int_{-\infty}^\infty f_{X,Y}(x,y)}{f_Y(y)}=1 $
![[conditional-pdf-from-joint.png|center|300]]