Expectation symbol

Probabilists use the word “expectation” to describe the average of a random variable (which is by the way rather badly defined by the OED:

8. The degree of probability of the occurrence of any contingent event.

1832 WEBSTER s.v., If the chances of receiving or not receiving a hundred dollars..are equal; then..the expectation is worth half the money. 1838 DE MORGAN Ess. Probab. v. (1841) 97 The balance is the average required, and is known by the name of the mathematical expectation. 1848 WHARTON Law Lex., Expectation, in the doctrine of chances, is applied to any contingent event, upon the happening of which some benefit is expected. Ibid., The value of the expectation is..£5.

but let us leave that aside), and the notation is typically


or maybe with a blackboard “E”, or something similar. The notation is also more and more commonly used in some parts of analytic number theory to simplify the writing of (typically) finite averages, with things like

\frac{1}{|X|}\sum_{x\in X}{f(x)}=\mathbf{E}_{x\in X}(f(x))

quite common, e.g., in the papers of Green and Tao or the book of additive combinatorics of Tao and Vu.

This is indeed quite convenient, but I find that the LaTeX formatting is often rather ugly, especially in displayed formulas and when there are also integration and summation signs on the line. What I would really like to have is a way to typeset an expectation operator “E” rather like a summation sign “Σ”, with respect to size, and with upper and lower subscripts to indicate the conditions involved. I’ve looked in various collections of LaTeX fonts and symbols without success, and my vanishingly small LaTeX/Metafonting skills are quite insufficient to create such a symbol myself. Does anyone know of a satisfactory solution?

Published by


I am a professor of mathematics at ETH Zürich since 2008.

7 thoughts on “Expectation symbol”

  1. This way of typesetting the blackboard bold E had never occurred to me, but it seems obviously correct. So tell me if you find out how to do it.

  2. You can use the command \mathop

    For example,

    \[ \mathop {\mathbb E}_{i=1}^n \]

    will show a “blackboard” ‘E’ with subscript put under it and superscript put above it.

    You can also define
    \newcommand{\E}{\mathop{\mathbb E}}
    at the beginning and then use \E as your expectation symbol.

  3. Thanks a lot!

    Trying this, I noticed that the size is the same as the usual capital “E”; searching a bit for “mathop” on Google and more experiments lead to a macro like the following


    which is fine as far as size is concerned (and has subscripts, etc).

    However, the font doesn’t look quite right, and neither does mathbb because it’s very different from the summation signs, when both occur on the same line. Unfortunately, I seem to be unable to include images in the comments, but I’ve put some at the following URLs:




  4. P.S. The relsize thing in my macro requires a corresponding \usepackage{relsize}
    It shouldn’t actually be needed, but I couldn’t figure out how to adjust the size of the “E” automatically. As it is, it only works for displayed formulas, and for inline ones, one needs another one, which is a bit awkward.

  5. This is the one I use:

    \newcommand{\Ex}{\mathop{\bf E\/}}

    The wackiness with the \/ fixes some obscure LaTeX bug which causes the E to not be vertically aligned in the right way.

  6. I’m currently using this one:

    \DeclareMathOperator*{\E}{\mbox{\large E}}

    I think DeclareMathOperator does the same thing as mathop, etc. The starred form has the advantage that subscripts and superscripts appear above and blow the E, same as a \sum.

Leave a Reply

Your email address will not be published. Required fields are marked *