# Finding PMF, CDF of a piecewise function of an RV

Here's the question:

Let $$Z$$ have CDF $$F$$ and pdf $$f$$ and let $$A$$ be a subset of the real line. Further, let

$$\begin{cases} W = 1 & \text{if Z \in A} \\ W = 0 &\text{otherwise} \\ \end{cases}$$.

a.) Find the PMF of $$W$$.

b.) Find the CDF of $$W$$.

For a.), I did this:

"Let $$p = P(Z \in A)$$. Then, the PMF for $$W$$ is $$f_W(w) = p * \mathbb{1}(Z \in A) + (1-p)*\mathbb{1}(Z \notin A) = p = P(W = w)$$."

Here is my work for b.):

"$$F_W(w) = P(W \leqslant w) = \int_A f_W(w) = \int_A p * \mathbb{1}(Z \in A) = \int_A p dw$$."

I'm really rusty with CDFs and PMFs, and have never taken a PMF/CDF of an identity operator of a random variable before. Where am I going wrong? Thank you!

• $W$ is a binary variate, only taking two possible values.$0$ and $1$. It does not have a pdf (for a continuous measure) but a probability mass function with masses at $1$, $p$, and at $0$, $1-p$. Its cdf follows immediately. – Xi'an Jun 22 '20 at 13:41
• Ah, it's a Bernoulli variable. I should have known. Thank you! – Bo Jack Jun 22 '20 at 13:52