I need to find the expectancy of x^2 and im given that: x~Bin(15, 0.22). I figure I cant use the linearity property here since this is a logaritmic function. Any help would be appreciated.
non linear Expectancy with binomial distribution
99 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 2 best solutions below
On
Actually you can use the linearity of expectations as long as you make the correct sum of variables.
For the sake of illustration, first let's do this with a binomial random variable $Y \sim B(2,p).$
We can write $Y = Z_1 + Z_2$ where $Z_i$ ($i=1,2$) is Bernoulli with expectation $p.$ Now let's take notice of two facts about products of Bernoulli variables:
Fact 1: Since $Z_i$ takes on the value $1$ with probability $p$ and $0$ with probability $1-p,$ $Z_i^2$ also takes on the value $1$ with probability $p$ and $0$ with probability $1-p.$ That is $Z_i^2 = Z_i,$ so $E\left[Z_i^2\right] = E[Z_i] = p.$
Fact 2: The product $Z_iZ_j$ (for $i \neq j$) is $1$ if both of the two independent variables $Z_1$ and $Z_2$ are $1,$ which happens with probability $p^2,$ and otherwise it is $0,$ so $E[Z_iZ_j] = p^2.$
It follows that \begin{align} E\left[Y^2\right] &= E\left[\left(Z_1 + Z_2\right)^2\right] \\ &= E\left[Z_1^2 + Z_2^2 + Z_1Z_2 + Z_2Z_1\right] \\ &= E\left[Z_1 + Z_2 + Z_1Z_2 + Z_2Z_1\right] \\ &= E\left[Z_1\right] + E\left[Z_2\right] + E\left[Z_1Z_2\right] + E\left[Z_2Z_1\right] \\ &= 2p + 2p^2. \\ \end{align}
Of course we could use commutativity of multiplication to write $2Z_1Z_2$ instead of $Z_1Z_2 + Z_2Z_1,$ but I think the counting of terms in the following argument will be a little bit simpler if we don't combine terms that way. The idea is that when we square $Z_1 + Z_2,$ we get one term of the form $Z_i^2$ for each index value $i,$ and one term of the form $Z_iZ_j$ for each ordered pair of unequal index values $i,j.$
For the more general binomial variable $X \sim B(n,p),$ we can write $X = Z_1 + Z_2 + \cdots + Z_n = \sum_{i=1}^n Z_i$ where each $Z_i$ is a Bernoulli variable with expectation $p.$ When we square this variable, we again get one term of the form $Z_i^2 = Z_i$ for each index value $i$ and one term of the form $Z_iZ_j$ for each ordered pair of unequal index values $(i,j).$ There are $n^2 - n$ such terms (all of the $n^2$ ordered pairs $(i,j)$ except for the $n$ pairs with $i=j.$) Then \begin{align} E\left[X^2\right] &= E\left[\left(\sum_{1\leq i\leq n} Z_i\right)^2\right] \\ &= E\left[\sum_{1\leq i\leq n} Z_i + \sum_{i\neq j} Z_iZ_j\right] \\ &= \sum_{1\leq i\leq n} E[Z_i] + \sum_{i\neq j} E[Z_iZ_j] \\ &= n p + (n^2-n)p^2. \end{align}
This is the same as the result you get by using the formula for variance. The method using the formula for variance is easier (and if you do not recall the formula for the variance of a binomial distribution you can derive it using the linearity of variance), but it may be useful to know how general the linearity of expectation really is.
Hint: The variance of a binomial distribution $X\sim B(n,P)$ is $Var(X)=np(1-p)$ while the mean is $np$, so we can use $Var(X) = E[X^2]-(E[X])^2$ to get $$E[X^2]=Var(X)+(E[X])^2=np-np^2+n^2p^2$$and you can just plug in $n=15$, $p=0.22$ to get what you want.