Kebarangkalian & Statistik

Kebarangkalian, jangkaan, varians, dan taburan.

Probability and statistics symbols in LaTeX

The probability symbol in LaTeX is \Pr or \mathbb{P}, and the expectation operator is \mathbb{E}[X]. The table lists the eight commands people use most, with the package each one needs; the full list of probability and statistics symbols follows below.

SymbolCommandUsePackageCopy
Pr⁡(A)\Pr(A)
\Pr(A)Probability operator (upright Pr)built in
P(A)\mathbb{P}(A)
\mathbb{P}(A)Probability symbol, blackboard boldamssymb
E[X]\mathbb{E}[X]
\mathbb{E}[X]Expectation operatoramssymb
Var⁡(X)\operatorname{Var}(X)
\operatorname{Var}(X)Varianceamsmath
Cov⁡(X,Y)\operatorname{Cov}(X, Y)
\operatorname{Cov}(X, Y)Covarianceamsmath
P(A∣B)P(A \mid B)
P(A \mid B)Conditional probabilitybuilt in
X∼N(μ,σ2)X \sim \mathcal{N}(\mu, \sigma^2)
X \sim \mathcal{N}(\mu, \sigma^2)Distributed as (normal)built in
(nk)\binom{n}{k}
\binom{n}{k}Binomial coefficientamsmath

Probability notation starts with the probability operator. LaTeX ships \Pr, which typesets an upright “Pr” with operator spacing, while most papers use blackboard bold \mathbb{P} for probability and \mathbb{E} for expectation, as in \mathbb{E}[X]. Conditional probability uses the vertical bar \mid, which gets the right spacing where a plain | does not: P(A \mid B). A random variable’s distribution is written with \sim, for example X \sim \mathcal{N}(\mu, \sigma^2), and \propto says a density is proportional to something.

Variance and covariance are not built in, so write them as operators: \operatorname{Var}(X) and \operatorname{Cov}(X, Y) from amsmath, or declare them once in the preamble with \DeclareMathOperator{\Var}{Var}. The parameters themselves are Greek letters: \mu, \sigma, \rho, \lambda and \theta, with estimates marked by \hat{\theta} and sample means by \bar{x}. Binomial coefficients come from amsmath’s \binom{n}{k}, chi-squared is \chi^2, and independence is usually \perp or the double symbol \perp\!\!\!\perp.

Load \usepackage{amsmath, amssymb} for \mathbb, \operatorname and \binom. For the full alphabet see our guide to Greek letters and math symbols and the page on math functions and operators.

Frequently asked questions

How do I write the probability symbol in LaTeX?
Use the built-in operator \Pr, as in \Pr(A), for an upright Pr with operator spacing, or blackboard bold \mathbb{P}(A) with \usepackage{amssymb}. For conditional probability write P(A \mid B); \mid spaces the bar correctly where a plain | does not.
How do I write the expectation operator in LaTeX?
Write \mathbb{E}[X] (amssymb) for a blackboard-bold E, or \operatorname{E}[X] (amsmath) for an upright E. To reuse it, declare it once in the preamble with \DeclareMathOperator{\E}{\mathbb{E}} and then write \E[X].
How do I write variance in LaTeX?
Variance has no built-in command, so write \operatorname{Var}(X) with amsmath, or declare \DeclareMathOperator{\Var}{Var} in the preamble and use \Var(X). The standard deviation is \sigma and the variance can also be written \sigma^2.
P\mathbb{P}

Probability

\mathbb{P}
P(A)P(A)
E[X]\mathbb{E}[X]

Expectation

\mathbb{E}[X]
E[X]E[X]
Var(X)\text{Var}(X)

Variance

\text{Var}(X)
Cov(X,Y)\text{Cov}(X,Y)

Covariance

\text{Cov}(X,Y)
σ\sigma
μ\mu

Mean

\mu
xˉ\bar{x}
∼\sim
N(μ,σ2)\mathcal{N}(\mu, \sigma^2)

Normal Distribution

\mathcal{N}(\mu, \sigma^2)
⊥\perp
⊥ ⁣ ⁣ ⁣⊥\perp\!\!\!\perp

Independent (Double)

\perp\!\!\!\perp
∣\mid
P(A∣B)P(A \mid B)

Given

P(A \mid B)
ρ\rho
χ2\chi^2
(nk)\binom{n}{k}
n!n!
∝\propto