How to have Ran(A) in math mode? [duplicate]

Code

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amsthm, amssymb}
\begin{document}
$\ker(A)$ works!

$\ran(A)$ does not work.
\end{document}


How can you have the Ran(A) in the math mode?

• – egreg Sep 10 '15 at 12:17

Package amsmath does not define all kind of operators, thus \ran needs to be defined:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amsthm, amssymb}
\DeclareMathOperator{\ker}{Ker}
\DeclareMathOperator{\ran}{Ran}
\begin{document}
$\ker(A)$ works!

$\ran(A)$ works after it is defined.
\end{document}


Also \ker can be changed:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amsthm, amssymb}
\let\ker\relax % "undefine \ker"
\DeclareMathOperator{\ker}{Ker}
\DeclareMathOperator{\ran}{Ran}
\begin{document}
$\ker(A)$ redefined!

$\ran(A)$ works after it is defined.
\end{document}


• Thank you for your answer! How can you replace $\ker$ representing $Ker$ when you have \usepackage{amsmath, amsthm, amssymb}? – Léo Léopold Hertz 준영 Sep 10 '15 at 11:39