Argmax in LaTeX (\arg\max)

arg⁡max⁡\arg\max
LaTeX command
\arg\max
Package
No package needed: built into LaTeX
Mode
Math mode only

Where it is used

The argument of the maximum: the input value at which a function attains its largest value.

Written as \arg\max, it combines two predefined operators: \arg, which never takes limits, and \max, which does. The result is that a subscript in display style lands under max only, so the constraint sits off-center. A cleaner approach is \operatorname*{arg\,max}, or defining \DeclareMathOperator*{\argmax}{arg\,max} in the preamble, which centers the subscript beneath the whole word. It appears in classification rules like \hat{y} = \arg\max_k p(k|x), in maximum likelihood estimation, and in greedy policies in reinforcement learning. Note that it returns a set when the maximizer is not unique.

Also listed under: Optimization

Minimal compilable example

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

y^=arg⁡max⁡k p(y=k∣x)\hat{y} = \arg\max_{k} \, p(y = k \mid x)
\documentclass{article}
\begin{document}
Argmax: $\arg\max$

\[ \hat{y} = \arg\max_{k} \, p(y = k \mid x) \]
\end{document}

Related symbols

All Machine Learning at AI →

Frequently asked questions

How do I write Argmax in LaTeX?
Type \arg\max in math mode, for example $\hat{y} = \arg\max_{k} \, p(y = k \mid x)$. It works in plain LaTeX without loading any package.
Which package do I need for \arg\max?
None. \arg\max is part of standard LaTeX, so it compiles with nothing in the preamble but the document class.
Can I use \arg\max in text mode, or only in math mode?
Only in math mode. Outside $...$ LaTeX stops with "Missing $ inserted", so write $\arg\max$ 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