Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
To transpose a matrix in LaTeX, write the transpose symbol as a superscript: A^\top for the common case, or A^{\mathsf{T}} if you want an upright sans-serif T. LaTeX has no transpose command of its own, so what you are choosing is notation, and the transposed matrix itself is typed by hand with its rows and columns swapped. This guide compares the four notations in use, shows a worked example, and gives a one-line macro so the notation stays consistent across a thesis or paper.
What it is used for in research
The transpose of a matrix A swaps its rows and columns. It appears in least-squares and regression derivations, covariance definitions and any inner-product expression written in matrix form. Journals do not enforce one symbol, so the practical rule is to pick one notation and use it everywhere in the document.
Install or access
You need a TeX distribution (TeX Live or MiKTeX, both listed on CTAN as containing the AMS font package amsfonts) or a hosted editor. For matrix environments, load amsmath; for the \intercal symbol, load amssymb. CTAN states that basic LaTeX support for the symbol fonts is provided by amsfonts.sty, with the names of individual symbols defined in amssymb.sty (CTAN, read 2026-11-08).
\usepackage{amsmath}
\usepackage{amssymb}
How to write a matrix transpose in LaTeX
Notation options compared
The Comprehensive LaTeX Symbol List (Scott Pakin, CTAN) states that some people use a superscripted \intercal for matrix transpose, and that \top, T and \mathsf{T} are other popular choices (read 2026-11-08).
| Source you type | What it is | Package needed |
|---|---|---|
A^\top |
The “top” symbol as a superscript | None beyond core LaTeX math |
A^\intercal |
AMS binary operator (Symbol List, Table 69, “AMS Binary Operators”) | amssymb |
A^T |
Italic letter T, typeset as a math variable | None |
A^{\mathsf{T}} |
Upright sans-serif T | None |
Editorial note: because A^T sets T in math italic, a reader can mistake it for a variable or an exponent named T. \top and \mathsf{T} avoid that ambiguity.
Typeset a transposed matrix with pmatrix
The amsmath package provides commands to typeset matrices with different delimiters (Overleaf, Matrices, read 2026-11-08). pmatrix gives round brackets and bmatrix square brackets. Overleaf’s page does not describe transposition, so the swap below is ordinary matrix algebra, done by hand:
A = \begin{pmatrix} 1 & 2 & 3 \\ a & b & c \end{pmatrix},
\qquad
A^\top = \begin{pmatrix} 1 & a \\ 2 & b \\ 3 & c \end{pmatrix}
A 2×3 matrix becomes 3×2: row one (1, 2, 3) becomes column one. Check this on any matrix you transpose by hand: the number of rows of A^\top must equal the number of columns of A.
Define a \T macro for consistent notation
Put this in the preamble so the notation is changed in one place if a journal or supervisor prefers another symbol:
\newcommand{\T}{^{\mathsf{T}}}
Then write A\T and (AB)\T. To switch the whole document to \top, change the definition to \newcommand{\T}{^{\top}}. \newcommand raises an error if \T is already defined by a class or package; use another name in that case.
Output and how to read it
All four variants produce a small superscript symbol attached to the matrix name. \top and \intercal render as a mark resembling a tee; the T variants render as a letter. In the matrix example, the compiled output shows the same entries as the source with rows and columns exchanged.
Troubleshooting
- Undefined control sequence on
\intercal: it belongs to the AMS symbol set, so add\usepackage{amssymb}. Overleaf’s symbol list notes that some of the symbols require loading the amssymb package. - Undefined environment pmatrix: add
\usepackage{amsmath}. - The T looks like a variable: switch from
A^TtoA^\toporA^{\mathsf{T}}. - The superscript attaches to the wrong thing: transposing a product needs parentheses, for example
(AB)^\toprather thanAB^\top.
Free alternatives
| Option | What it does | Source |
|---|---|---|
| TeX Live / MiKTeX | Local TeX distributions that contain amsfonts | CTAN, read 2026-11-08 |
realtranspose package |
Writes a transpose by rotating the symbol 90 degrees; version 1.1, MIT licence, included in TeX Live and MiKTeX. A novelty style, not standard notation, so do not rely on it for a submitted manuscript. | CTAN, read 2026-11-08 |
Related guides
- Vector notation in LaTeX
- Blackboard bold (mathbb) in LaTeX
- Piecewise functions with cases in LaTeX
- Matrix multiplication in R
FAQ
What is the LaTeX code for a matrix transpose?
Use A^\top (or A^{\mathsf{T}}, A^\intercal, A^T). There is no dedicated command; the symbol is a superscript on the matrix name.
Which transpose notation should I use?
The Symbol List calls all four popular. Follow your journal or supervisor if they specify one; otherwise choose \top or \mathsf{T} and apply it consistently through a macro.
Do I need amssymb?
Only for \intercal.
Does LaTeX transpose the matrix for me?
No. LaTeX typesets what you write; you swap the entries yourself, or generate the matrix from software such as R or Python.
Sources
- Scott Pakin, The Comprehensive LaTeX Symbol List, CTAN, https://mirrors.ctan.org/info/symbols/comprehensive/symbols-a4.pdf (read 2026-11-08).
- Overleaf, Matrices, https://www.overleaf.com/learn/latex/Matrices (read 2026-11-08).
- Overleaf, List of Greek letters and math symbols, https://www.overleaf.com/learn/latex/List_of_Greek_letters_and_math_symbols (read 2026-11-08).
- CTAN, amsfonts, https://ctan.org/pkg/amsfonts (read 2026-11-08).
- CTAN, realtranspose, https://ctan.org/pkg/realtranspose (read 2026-11-08).







