Probability Distribution in LaTeX (p(x))

p(x)p(x)
LaTeX command
p(x)
Package
No package needed: built into LaTeX
Mode
Text and math mode

Where it is used

Probability (density or mass) of x under a distribution p, the basic notation for a distribution in ML.

Lowercase p(x) denotes a density or mass function, while uppercase P(X = x) or \Pr is often reserved for probabilities of events. Machine learning overloads p freely, letting the argument decide which distribution is meant, as in p(x) versus p(z); when this gets confusing, add subscripts like p_\theta(x) or p_{\text{data}}(x). Normalization requires \sum_x p(x) = 1 or \int p(x)\,dx = 1, with a thin space \, before dx. Sampling is written x \sim p(x), using \sim.

Minimal compilable example

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

∫−∞∞p(x) dx=1,x∼p(x)\int_{-\infty}^{\infty} p(x)\, dx = 1, \quad x \sim p(x)
\documentclass{article}
\begin{document}
Probability Distribution: $p(x)$

\[ \int_{-\infty}^{\infty} p(x)\, dx = 1, \quad x \sim p(x) \]
\end{document}

Related symbols

All Machine Learning at AI →

Frequently asked questions

How do I write Probability Distribution in LaTeX?
Type p(x) in math mode, for example $\int_{-\infty}^{\infty} p(x)\, dx = 1, \quad x \sim p(x)$. It works in plain LaTeX without loading any package.
Which package do I need for p(x)?
None. p(x) is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use p(x) in text mode, or only in math mode?
Both. p(x) compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
Math poweredSumulat ng LaTeX gamit ang AI

Pinakamahusay na AI LaTeX Editor, Alternatibo sa Overleaf

Tinutulungan ng Octree ang mga researcher mula sa 15+ na unibersidad na sumulat ng research papers nang mas mabilis gamit ang AI

  • Gumawa ng magagandang TikZ diagrams gamit ang AI
  • Mag-upload ng larawan at i-convert ito sa LaTeX nang walang problema
  • Makakuha ng instant na tulong sa pagsulat at pag-format ng research papers