Problem: Let $X$ be a random variable with the following probability distribution:
\[
\begin{array}{|c|c|c|c|}
\hline
x & -3 & 6 & 9 \\ \hline
P(X = x) & \frac{1}{6} & \frac{1}{2} & \frac{1}{3} \\ \hline
\end{array}
\]
Let $E[X]$ denote the expectation of $X$. Find $E[X], E[X^2]$ and $E[(2x + 1)^2]$.
Solution: We recall that for any random variable $X$, the ejection of $X$ is given by
\begin{align*}
E[X] & = \sum_{x} x \cdot P(X = x) \\
& = -3 \times \frac{1}{6} + 6 \times \frac{1}{2} + 9 \times \frac{1}{3} = \frac{11}{2}.
\end{align*}
Thus,
\[
\textcolor{teal}{
\boxed{
E[X] = \frac{11}{2}
}
}
\]
We also have
\begin{align*}
E[X^2] & = \sum_{x} x^2 \cdot P(X = x) \\
& = (-3)^2 \times \frac{1}{6}+ 6^2 \times \frac{1}{2} + 9^2 \times \frac{1}{3} = \frac{93}{2}.
\end{align*}
So, \[
\textcolor{teal}{
\boxed{
E[X^2] = \frac{93}{2}
}
}
\]
Now to find the expectation of $(2x + 1)^2$, we recall some properties of the expectation. For any random variables $X,X_1, X_2, \dots, X_n$
\begin{align*}
& E \left[ \sum_{i=1}^{n} X_i \right] = \sum_{i=1}^{n} E[X_i] \\[1ex]
& E[\alpha X] = \alpha E[X] \text{ and } E[X + \alpha ] = E[X] + \alpha
\end{align*}
for any constant $\alpha $.
So,
\begin{align*}
E[(2x + 1)^2] & = E \left[ 4X^2 + 4X + 1 \right] \\
& = 4 E[X^2] + 4 E[X] + 1 \\
& = 4 \times \frac{93}{2} + 4 \times \frac{11}{2} + 1 \\
& = 209.
\end{align*}
Hence,
\[
\textcolor{teal}{
\boxed{
E[(2x + 1)^2] = 209
}
}
\]