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: التحسين

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 التعلم الآلي والذكاء الاصطناعي →

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 poweredاكتب LaTeX باستخدام الذكاء الاصطناعي

أفضل محرر LaTeX بالذكاء الاصطناعي، بديل Overleaf

يساعد Octree الباحثين من أكثر من 15 جامعة على كتابة أوراق البحث بشكل أسرع باستخدام الذكاء الاصطناعي

  • أنشئ رسوم TikZ جميلة باستخدام الذكاء الاصطناعي
  • ارفع صورة وحولها إلى LaTeX بسلاسة
  • احصل على مساعدة فورية في كتابة وتنسيق أوراق البحث