Expected value or expectation of a random variable $X$ is defined, if it exists, in a mathematically precise way with respect to a probability space, typically denoted as $(\Omega, \mathcal{A}, \mathbb{P})$, where $\Omega$ is the universe of possibilities, $\mathcal{A}$ the set of possible events (which are the possible values of the random variable $X$) and $\mathbb{P}$ a probability measure such that $\mathbb{P}(\Omega)=1$.

Latex expected value using mathbb function

To use the latex expected value using mathbb function, you must load amssymb package

\documentclass[12pt]{article}
\usepackage{amssymb}
...
\end{document}

Next, we use \mathbb function.

Here are five examples using LaTeX to write expected value of a random variable $X$ :

\documentclass[12pt]{article}
\usepackage{amssymb}
$$ \mathbb{E}[X] = \sum_{i=1}^{n} x_i \cdot p_i $$

$$ \mathbb{E}[X] = \frac{\displaystyle\sum_{i=1}^{n} x_i \cdot p_i}{\displaystyle\sum_{i=1}^{n} p_i} $$

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

$$ \mathbb{E}[X] = \frac{1}{n} \sum_{i=1}^{n} x_i $$

$$ \mathbb{E}[X] = \int_{-\infty}^{\infty} x \, dF(x) $$
\end{document}
\[\mathbb{E}[X] = \sum_{i=1}^{n} x_i \cdot p_i\] \[\mathbb{E}[X] = \frac{\displaystyle\sum_{i=1}^{n} x_i \cdot p_i}{\displaystyle\sum_{i=1}^{n} p_i}\] \[\mathbb{E}[X] = \int_{-\infty}^{\infty} xf(x) \, dx\] \[\mathbb{E}[X] = \frac{1}{n} \sum_{i=1}^{n} x_i\] \[\mathbb{E}[X] = \int_{-\infty}^{\infty} x \, dF(x)\]