# Law of the unconscious statistician

*Accidentally correct expected values*

The law of the unconscious statistician is the theorem for calculating the expected value of the transformation $g(X)$ (of a known random variable $X$) without knowing the probability distribution of $g(X)$. In the discrete case, we have

$\mathbb{E}[g(X)] = \sum_x{g(x)f_X(x)}$

and in the continuous case

$\mathbb{E}[g(X)] = \int_{-\infty}^\infty{g(x)f_X(x)dx}$

This theorem is assigned its name due to anecdotes of students making use of it without knowledge of its origins. This is due to its fundamental, intuitive looking form that one might expect (ha) is definitionally true, whereas in reality it is the consequence of rigorous derivation.