Mathematical functions: min, max and argmin, agrmax in LaTeX

In this tutorial, you will learn how to write min, max, argmin, and argmax functions in the correct way in LaTeX. Also, how to write characters under these functions (like subscript).

min and max function in LaTeX

To write the min and max functions in LaTeX, you can use the \min and \max commands.

\documentclass{article}
\begin{document}

 $$ \min \quad \max $$
 $$ \min (x,y) $$
 $$ \max (m,n) $$
 $$ \min \left\{y,\frac{1}{x}\right\} $$
 $$ \max \left\{y,\frac{1}{x}\right\} $$

\end{document}

Output:

min and max function.

Text or characters under the min and max function

You can use the \min_{<char>} and \mix_{<char>} commands to get text or characters under the min and max function.

But in inline math mode, the position of the <char> will be different that you can adjust with the \limits and \nolimits command.

\documentclass{article}
\begin{document}

  \textbf{min} function in math mode:
  $$ \min_x $$
  $$ \min_{\forall s \in S_j} q_k(s) $$
  
  \textbf{max} function in math mode:
  $$ \max_x $$
  $$ \max_{x \in S_j} q_k(s) $$
  
  \textbf{min} and \textbf{max} function in inline math mode without \textbf{limits}:
  \begin{center}
      $ \min_x $\\[4pt]
      $ \min_{\forall s \in S_j} q_k(s) $\\[4pt]
      $ \max_x $\\[4pt]
      $ \max_{x \in S_j} q_k(s) $
  \end{center}

  \textbf{max} and \textbf{max} function in inline math mode with \textbf{limits}:
  \begin{center}
      $ \min_x $\\[4pt]
      $ \min\limits_{\forall s \in S_j} q_k(s) $\\[4pt]
      $ \max_x $\\[4pt]
      $ \max\limits_{x \in S_j} q_k(s) $
  \end{center}
  
\end{document}

Output:

min and max function with subscript.

argmin and argmax function in LaTeX

In order to write the argmin and argmax functions in LaTeX, you can use the \arg\min and \arg\max command.

But if you don’t want any space between \arg and \min or \max, then you can write like this \arg\!\min and \arg\!\max.

\documentclass{article}
\begin{document}

  $$ \arg\min \quad \arg\max $$
  $$ \arg\min f(x) $$
  $$ \arg\max f(x) $$
  $$ \arg\!\min f(x) $$
  $$ \arg\!\max f(x) $$
  
\end{document}

Output:

argmin and argmax function.

Text or characters under the argmin and argmax function

To write text or characters under the argmin and argmax function, you can use \arg\min_{<char>} and \arg\mix_{<char>}.  But in this case, the <char> will not come to the center under the whole function.

To overcome this problem you can use this code in the preamble.

\usepackage{amsmath}
\DeclareMathOperator*{\argmaxo}{argmax}
\DeclareMathOperator*{\argmino}{argmin}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}

Also, you can use \underset{<char>}{\arg\min} and \underset{<char>}{\arg\max} to get <char> to the center under the whole function. Don’t forget to use \usepackage{amasmath}.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\argmaxo}{argmax}
\DeclareMathOperator*{\argmino}{argmin}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\begin{document}

  $$ \verb|\arg\min_x| \rightarrow \arg\min_x $$
  $$ \verb|\arg\max_x| \rightarrow \arg\max_x $$
  $$ \argmino_x f(x) $$
  $$ \argmaxo_x f(x) $$
  $$ \argmin_x f(x) $$
  $$ \argmax_x f(x) $$
  With the \textbackslash underset\{\}\{\} command:
  $$ \underset{x}{\arg\min} $$
  $$ \underset{x}{\arg\max} $$
  $$ \underset{x}{\arg\!\min} $$
  $$ \underset{x}{\arg\!\max} $$
  
\end{document}

Output:

argmin and argmax function with subscript.

In inline math mode, the position of the <char> will be different but you can control it with the \limits command.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\argmaxo}{argmax}
\DeclareMathOperator*{\argmino}{argmin}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
\begin{document}

\textbf{argmin} and \textbf{argmax} without \textbackslash limits:\\
  $ \argmino_x f(x) $\\[4pt]
  $ \argmaxo_x f(x) $\\[4pt]
  $ \argmin_x f(x) $\\[4pt]
  $ \argmax_x f(x) $
  
  \textbf{argmin} and \textbf{argmax} with \textbackslash limits:\\
  $ \argmino\limits_x f(x) $\\[4pt]
  $ \argmaxo\limits_x f(x) $\\[4pt]
  $ \argmin\limits_x f(x) $\\[4pt]
  $ \argmax\limits_x f(x) $
  
\end{document}

Output:

argmin and argmax function with subscript.

Leave a Reply

Your email address will not be published. Required fields are marked *