Given in LaTeX (P(A \mid B))

P(A∣B)P(A \mid B)
LaTeX command
P(A \mid B)
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Conditional probability of A given that the event B has already occurred.

Defined by P(A \mid B) = P(A \cap B)/P(B) for P(B) > 0, it is the building block of Bayes' theorem. Always use \mid rather than |: the bare bar gets no surrounding space and the expression looks cramped. For tall arguments, write P\left(A \,\middle|\, B\right) so the bar scales with the parentheses. Chains of conditioning, P(A \mid B, C), put a comma after the bar rather than a second bar. In likelihood notation, p(x \mid \theta) follows the same convention, and some statisticians use a semicolon, p(x; \theta), when \theta is a fixed parameter rather than a random variable.

Minimal compilable example

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

P(A∣B)=P(B∣A) P(A)P(B)P(A \mid B) = \frac{P(B \mid A)\, P(A)}{P(B)}
\documentclass{article}
\begin{document}
Given: $P(A \mid B)$

\[ P(A \mid B) = \frac{P(B \mid A)\, P(A)}{P(B)} \]
\end{document}

Related symbols

All Kansrekening & Statistiek →

Frequently asked questions

How do I write Given in LaTeX?
Type P(A \mid B) in math mode, for example $P(A \mid B) = \frac{P(B \mid A)\, P(A)}{P(B)}$. It works in plain LaTeX without loading any package.
Which package do I need for P(A \mid B)?
None. P(A \mid B) is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use P(A \mid B) in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $P(A \mid B)$ in running text.
Math poweredSchrijf LaTeX met AI

Beste AI LaTeX Editor, Overleaf Alternatief

Octree helpt onderzoekers van 15+ universiteiten sneller onderzoeksartikelen schrijven met AI

  • Genereer mooie TikZ-diagrammen met AI
  • Upload afbeelding en converteer naadloos naar LaTeX
  • Krijg directe hulp bij het schrijven en opmaken van onderzoeksartikelen