Variance as Expectation of Square minus Square of Expectation/Continuous

Theorem
Let $X$ be a continuous random variable.

Then the variance of $X$ can be expressed as:
 * $\var X = \expect {X^2} - \paren {\expect X}^2$

That is, it is the expectation of the square of $X$ minus the square of the expectation of $X$.

Proof
Let $\mu = \expect X$.

Let $X$ have probability density function $f_X$.

As $f_X$ is a probability density function:


 * $\displaystyle \int_{-\infty}^\infty f_X \paren x \rd x = \Pr \paren {-\infty < X < \infty} = 1$

Then: