Trace in LaTeX (\text{tr}(A))

tr(A)\text{tr}(A)
LaTeX command
\text{tr}(A)
Package
Add to your preamble:\usepackage{amsmath}
Mode
Text and math mode

Where it is used

Trace of A, the sum of its diagonal entries, written with an upright 'tr' label.

The trace appears in identities like \operatorname{tr}(AB) = \operatorname{tr}(BA) and in the Frobenius norm \lVert A \rVert_F^2 = \operatorname{tr}(A^{\top}A). Using \text{tr} gets upright letters, but it inherits the surrounding text font, turning italic inside a theorem, and adds no operator spacing. The sturdier choice is \operatorname{tr}, or a global \DeclareMathOperator{\tr}{tr} in the preamble, so \tr A spaces correctly without parentheses. Physicists often write Tr with a capital, especially for density matrices. The trace also equals the sum of the eigenvalues counted with multiplicity.

Minimal compilable example

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

tr(A)=∑i=1naii\text{tr}(A) = \sum_{i=1}^{n} a_{ii}
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Trace: $\text{tr}(A)$

\[ \text{tr}(A) = \sum_{i=1}^{n} a_{ii} \]
\end{document}

Related symbols

All Linear Algebra →

Frequently asked questions

How do I write Trace in LaTeX?
Type \text{tr}(A) in math mode, for example $\text{tr}(A) = \sum_{i=1}^{n} a_{ii}$. Load amsmath first with \usepackage{amsmath}.
Which package do I need for \text{tr}(A)?
\text{tr}(A) needs amsmath: add \usepackage{amsmath} to your preamble before the document starts.
Can I use \text{tr}(A) in text mode, or only in math mode?
Both. \text{tr}(A) compiles in running text as well as inside $...$; in a formula keep it in math mode so it gets math fonts and spacing.
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