Probability Distribution in LaTeX (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.
\documentclass{article}
\begin{document}
Probability Distribution: $p(x)$
\[ \int_{-\infty}^{\infty} p(x)\, dx = 1, \quad x \sim p(x) \]
\end{document}Related symbols
- Conditional Probability
p(y | x) - Log Likelihood
\log p(x | \theta) - Sum Over Classes
\sum_{c=1}^{C} - Mutual Information
I(X; Y) - Product Over Samples
\prod_{i=1}^{N} - Entropy
H(X)
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.
أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf
يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي
- أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
- ارفع صورة وحولها إلى LaTeX بسلاسة
- احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث