# Expected value of a random variable power of another random variable

I have the following problem:

Suppose $$Z = Y^X$$ is a random variable, where $$Y$$ is a generic random variable and $$X$$ is a binary random variable which takes value $$1$$ with probability $$p$$ and value $$2$$ with probability $$1 - p$$.

I need to find the expected value $$\mathbb{E}[Z]$$, but I don't even understand from where to start!

Let Y be a generic random variable, and let X be a binary random variable such that $P(X=1)=p$ and $P(X=2)=1-p$.

$$E[Z] = E[Y^X|X=1]P(X=1) + E[Y^X|X=2]P(X=2) = E[Y|X=1]p + E[Y^2|X=2](1-p)$$

If $X$ and $Y$ are independent, then $E[Y|X=1]=E[Y]$ and $E[Y^2|X=2]=E[Y^2]$, which means that the above equation reduces to:

$$E[Z] = E[Y]p + E[Y^2](1-p)$$

• Note that the last step assumes $Y$ and $X$ are independent, which wasn't explicitly stated in the question. – Danica Feb 18 '17 at 1:40
• Without assuming independence, the last step should be: $~\ldots~=~\mathsf E(Y\mid X=1)~p+\mathsf E(Y^2\mid X=2)~(1-p)$ – Graham Kemp Feb 18 '17 at 6:13
• Thanks for the comments. I've updated my answer. – Michael R Feb 18 '17 at 13:48
• Indeed it's very tricky because it doesn't assume that Y and X are indipendent. The problem offers 4 possible solutions that made me crazy: A) E[Z] is the mean square value of Y if p = 0 B) E[Z] is the mean square value of Y if p = 1 C) E[Z] is the expected value of Y if p = 0 D) E[z] is always the variance of Y. I can't see none of them. Just E[Z] = E[Y] for p = 1, but not p = 0. – blocknius Feb 18 '17 at 18:41

If you know nothing about the distribution of $Y$ you can, of course, say nothing about the distribution of $Z$.

But let's say you know only that $E[Y] = \mu$ and the variance of $Y$, which is $E[(Y-E[Y])^2] = \sigma^2$, for some real $\mu$ and non-negative $\sigma^2$. Then you can in fact find $E[Z]$:

$Z$ is a variable with value which $p$ of the time is $Y$ and $(1-p)$ of the time is $Y^2$. So
$$E[Z] = pE[Y] + (1-p) E[Y^2]$$ We know $E[Y] = \mu$ and $E[E[(Y-E[Y])^2] = E[Y^2]-(E[Y])^2 = \sigma^2$ so that $$E[Y^2] = \sigma^2+\mu^2$$ and $$E[Z] = p\mu + (1-p) (\sigma^2+\mu^2)$$

• Like the other answer, this assumes that $Y$ and $X$ are independent. – Danica Feb 18 '17 at 1:42