# What is the expected value of this simple random variable?

Let $X$ be some random variable. Now define a new random variable $Y$ such that it has a probability $p$ of taking some fixed number $a$, and a probability $(1-p)$ of being determined by $X$.

What is the expected value of $Y$? Is it true that it is just $E[Y] = pa + (1-p)E[X]$? If this is the case, how do I prove this?

-

## 1 Answer

Write $Y=Ba+(1-B)X$ where $B$ is independent of $X$, $\mathrm P(B=1)=p$ and $\mathrm P(B=0)=1-p$ (the random variable $B$ is called a Bernoulli random variable).

Then, $Y$ has the distribution described in the post and, by linearity of the expectation and independence of $B$ and $X$, $\mathrm E(Y)=\mathrm E(B)a+\mathrm E(1-B)\mathrm E(X)=pa+(1-p)\mathrm E(X)$.

-
@madprob Thanks for the edit. –  Did Jul 5 '12 at 16:59