Expectation (E) in LaTeX (E[X])
- LaTeX command
E[X]- Package
- No package needed: built into LaTeX
- Mode
- Text and math mode
Where it is used
Expectation of X in plain italic E, the mean of its distribution.
Many statistics textbooks write E[X] or E(X) for the expected value, with the variance identity \operatorname{Var}(X) = E[X^2] - (E[X])^2 as a standard example. An italic E can collide with other meanings such as energy or an event called E, which is why \mathbb{E} or an upright \mathrm{E} are common in research papers. If you settle on upright, define \DeclareMathOperator{\E}{E} so spacing and font stay uniform everywhere. Conditional expectation follows the same style, E[X \mid Y]. Whichever form you choose, use it consistently from start to finish.
Minimal compilable example
Paste this into an empty .tex file and compile it with pdfLaTeX, XeLaTeX or LuaLaTeX.
\documentclass{article}
\begin{document}
Expectation (E): $E[X]$
\[ E[X^2] - (E[X])^2 \geq 0 \]
\end{document}Related symbols
- Variance
\text{Var}(X) - Expectation
\mathbb{E}[X] - Covariance
\text{Cov}(X,Y) - Probability of A
P(A) - Sigma
\sigma - Probability
\mathbb{P}
Frequently asked questions
- How do I write Expectation (E) in LaTeX?
- Type E[X] in math mode, for example $E[X^2] - (E[X])^2 \geq 0$. It works in plain LaTeX without loading any package.
- Which package do I need for E[X]?
- None. E[X] is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
- Can I use E[X] in text mode, or only in math mode?
- Both. E[X] compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf
يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي
- أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
- ارفع صورة وحولها إلى LaTeX بسلاسة
- احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث