Trace in LaTeX (\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.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Trace: $\text{tr}(A)$
\[ \text{tr}(A) = \sum_{i=1}^{n} a_{ii} \]
\end{document}Related symbols
All Aljabar Linear →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.
Editor LaTeX AI Terbaik, Alternatif Overleaf
Octree membantu peneliti dari 15+ universitas menulis makalah penelitian lebih cepat menggunakan AI
- Hasilkan diagram TikZ yang indah menggunakan AI
- Unggah gambar dan konversi ke LaTeX dengan mulus
- Dapatkan bantuan instan untuk menulis dan memformat makalah penelitian