4.3 Continuous expectation & variance

Expected values

The expected value of a discrete RV \(X\) is defined by

\[ \text{E}[X]=\sum_x x \cdot p_X(x) \]

In complete analogy, for a continuous RV \(X\),

\[ \text{E}[X]=\int_{-\infty}^{+\infty} x \cdot f_X(x) dx \]

LOTUS

Let \(Y=g(X)\) be a function of a discrete RV \(X\).

\[ \text{E}[Y]=\text{E}\big[g(X)\big]=\sum_x g(x) \cdot p_X(x) \]

In complete analogy, if \(X\) is continuous,

\[ \text{E}[Y]=\text{E}\big[g(X)\big]=\int_{-\infty}^{+\infty} g(x) \cdot f_X(x) dx \]

Linearity of the expected value

\[ \text{For any two constants $a$ and $b$,} \]

\[ \text{E}[aX+b]= a \text{E}[X] + b \]

Proof

\[ \begin{aligned} \text{E}[aX+b]&=\int_{-\infty}^{+\infty} (ax+b) f_X(x) dx \; \color{gray}{\leftarrow\text{by LOTUS}} \\ \\ &=\int_{-\infty}^{+\infty} ax f_X(x)dx + \int_{-\infty}^{+\infty}b f_X(x) dx \\ \\ &=a\int_{-\infty}^{+\infty} x f_X(x)dx + b\int_{-\infty}^{+\infty}f_X(x) dx \\ \\ &=a \text{E}[X] + b \\ \end{aligned} \]

Variance

The variance of a RV \(X\) is always defined as

\[ \text{var}(X)=\text{E}\big[(X-\text{E}[X])^2\big] \]

By applying LOTUS, it can be calculated as

\[ \text{var}(X)=\int_{-\infty}^{+\infty} \big(x-\text{E}[X]\big)^2 \cdot f_X(x) dx \]

Property

\[ \text{var}(X) \geq 0, \;\;\;\; \text{for any $X$.} \]

The shortcut formula also holds for continuous RVs.

\[ \text{var}(X)=\text{E}[X^2]-(\text{E}[X])^2 \]

\[ % \small{ \begin{aligned} \text{Proof:}\;\;\;\;\text{var}(X)&=\text{E}[(X-\text{E}[X])^2] \\ \\ &=\text{E}[X^2-2X\cdot\text{E}[X]+\text{E}[X])^2] \\ \\ &=\text{E}[X^2] -2\text{E}[X]\text{E}[X] + (\text{E}[X])^2 \\ \\ &=\text{E}[X^2]-(\text{E}[X])^2 \end{aligned} % } \]

Other properties of variance

\[ \text{For any two constants $a$ and $b$,} \]

\[ \text{var}(aX+b)=a^2\text{var}(X) \]