Expectation in LaTeX (\mathbb{E}[X])

E[X]\mathbb{E}[X]
LaTeX command
\mathbb{E}[X]
Package
Add to your preamble:\usepackage{amssymb}
Mode
Math mode only

Where it is used

Expected value of a random variable X, written with a blackboard-bold E.

Expectation is the mean of X weighted by its distribution, \mathbb{E}[X] = \sum_x x\,p(x) or \int x f(x)\,dx. Machine learning papers use it everywhere, often with a subscript naming the distribution: \mathbb{E}_{x \sim p}[\ell(x)]. Square brackets are conventional, and \left[ \right] or \bigl[ \bigr] help when the argument contains fractions. The blackboard E sets the operator apart from an energy E or an edge set E. Linearity, \mathbb{E}[aX + bY] = a\mathbb{E}[X] + b\mathbb{E}[Y], holds even without independence, which is why it is used so freely.

Also listed under: 머신러닝 및 AI

Minimal compilable example

Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.

Ex∼p[f(x)]=∫f(x) p(x) dx\mathbb{E}_{x \sim p}[f(x)] = \int f(x)\, p(x)\, dx
\documentclass{article}
\usepackage{amssymb}
\begin{document}
Expectation: $\mathbb{E}[X]$

\[ \mathbb{E}_{x \sim p}[f(x)] = \int f(x)\, p(x)\, dx \]
\end{document}

Related symbols

All 확률 및 통계 →

Frequently asked questions

How do I write Expectation in LaTeX?
Type \mathbb{E}[X] in math mode, for example $\mathbb{E}_{x \sim p}[f(x)] = \int f(x)\, p(x)\, dx$. Load amssymb first with \usepackage{amssymb}.
Which package do I need for \mathbb{E}[X]?
\mathbb{E}[X] needs amssymb: add \usepackage{amssymb} to your preamble before the document starts.
Can I use \mathbb{E}[X] in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\mathbb{E}[X]$ in running text.
Math poweredAI로 LaTeX 작성

최고의 AI LaTeX 편집기, Overleaf 대안

Octree는 15개 이상의 대학의 연구자들이 AI를 사용하여 논문을 더 빠르게 작성하도록 도움

  • AI로 아름다운 TikZ 다이어그램 생성
  • 이미지를 업로드하고 LaTeX로 원활하게 변환
  • 논문 작성 및 서식에 대한 즉각적인 지원 받기