Solution (source code)

= Solution

For a <continuous random variable> with <probability density function> $f_X$, its <mean> is
$$
\boxed{\mu=\mathbb E[X]=\int_{-\infty}^{\infty}x f_X(x)\,dx,}
$$
provided $\int_{-\infty}^{\infty}|x|f_X(x)\,dx<\infty$. Its <variance> is the <expectation> of the squared deviation from its <mean>:
$$
\boxed{\operatorname{var}(X)=\mathbb E[(X-\mu)^2]
=\int_{-\infty}^{\infty}(x-\mu)^2f_X(x)\,dx.}
$$
This is finite when $\mathbb E[X^2]<\infty$; otherwise it may be $+\infty$ if the finite <mean> exists.