Say I flip a fair coin once and if I get heads I have $X\sim Normal(0,1)$ and at tails $X\sim Normal(0,2)$.
I want to derive the CDF of $X$.
My thoughts:
Let $Y$ be my random variable representing a coinflip, mapping Heads to 0 and Tails to 1 where $P(Y=0)=P(Y=1)=1/2$.
Then by law of total probability:
$P(X\leq x)=P(X\leq x \ \cap Y = 0) +P(X\leq x \ \cap Y =1)$
And then by conditional probability: $P(X\leq x) = P(Y = 0)P(X\leq x | Y =0)+P(Y=1)P(X\leq x|Y = 1)$
So then:
$F_X(x)=P(X\leq x) = \frac{1}{2}F_{N(0,1)}(x)+\frac{1}{2}F_{N(0,2)}(x)$