Log Likelihood in LaTeX (\log p(x | \theta))

log⁡p(x∣θ)\log p(x | \theta)
LaTeX command
\log p(x | \theta)
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

Log-likelihood of data x under parameters theta, the quantity maximized in maximum likelihood estimation.

Taking logs turns products of independent likelihoods into sums, \log \prod_i p(x_i|\theta) = \sum_i \log p(x_i|\theta), which is easier to differentiate and numerically stable. Its negative is the familiar NLL loss. A typographic tip: a bare | is an ordinary symbol, so it gets no space on either side; \mid is a relation and adds balanced spacing, giving p(x \mid \theta). Some authors use a semicolon, p(x; \theta), to signal that theta is a fixed parameter rather than a random variable being conditioned on, which is the frequentist reading.

Minimal compilable example

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

ℓ(θ)=∑i=1Nlog⁡p(xi∣θ)\ell(\theta) = \sum_{i=1}^{N} \log p(x_i \mid \theta)
\documentclass{article}
\begin{document}
Log Likelihood: $\log p(x | \theta)$

\[ \ell(\theta) = \sum_{i=1}^{N} \log p(x_i \mid \theta) \]
\end{document}

Related symbols

All Machine Learning at AI →

Frequently asked questions

How do I write Log Likelihood in LaTeX?
Type \log p(x | \theta) in math mode, for example $\ell(\theta) = \sum_{i=1}^{N} \log p(x_i \mid \theta)$. It works in plain LaTeX without loading any package.
Which package do I need for \log p(x | \theta)?
None. \log p(x | \theta) is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \log p(x | \theta) in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\log p(x | \theta)$ in running text.
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