The trace is a [linear map](Linear%20map.md) that gives the sum of the diagonal elements of an [$n \times n$ matrix](Matrices.md#Square%20matrices), which can be expressed as
$\mbox{tr}{A} = \sum_{n} A_{nn}$ ^4b0758
In addition we find that on an [inner product space](Inner%20products.md#Inner%20product%20spaces) containing $A$ and vectors $|i\rangle,$
[$\mathrm{tr}(A)=\sum_{i} \langle i|A|i \rangle$](Trace.md#^582dc2)
if the vectors $|i \rangle$ form an [orthonormal basis](Orthonormal%20bases.md).
# The trace as the sum of eigenvalues
The [trace](Trace.md) of a matrix is alternatively defined as the sum of its [eigenvalues.](Eigenvalues%20and%20eigenvectors.md) Such that,
$\mbox{tr}(A)=\sum_i^n{d_i\lambda_i}$ ^68b62b
where $d_i$ is the multiplicity of the eigenvalues.
# Properties of the trace
The [trace](Trace.md) has the following properties:
1. For any product of $m$ matrices for which we may take the [trace,](Trace.md) $\mbox{tr}{(A_1A_2...A_{m-1}A_m)} = \mbox{tr}{(A_mA_2...A_{m-1}A_1)}$ (the cyclic property)([proof](Trace.md#Proof%20of%20the%20cyclic%20property)) ^fcff10
* This means that for a product of only two matrices, $AB$, it is always the case that $\mbox{tr}(AB)=\mbox{tr}(BA).$ ^c768aa
2. $\mbox{tr}(A) = \mbox{tr}(P^{-1} AP)$ (invariance under [similarity transformation](Matrix%20similarity.md))
* invariance under all similarity transformations implies that $\mbox{tr}(A) = \mbox{tr}(U^\dagger AU)$ (invariance under [unitary similarity transformation](Matrix%20similarity.md#Unitary%20Similarity)) ^db2110
[property 2](Trace.md#^db2110) can be shown from [property 1](Trace.md#^fcff10) as follows: $\mbox{tr}(A) = \mbox{tr}(\mathbb{I}A) = \mbox{tr}(PP^{-1} A) =\mbox{tr}(P^{-1} A P)$. Unitary similarity follows directly from this where [$U^{-1}= U^{\dagger}$](Unitary%20operators.md#^332d8e) for [unitary operators.](Unitary%20operators.md) It follows then that trace is also invariant under [change of basis.](Change%20of%20basis.md)
%%Expand to prove general invariance under similarity transformation either here or on a separate proof.%%
# Trace of an operator
[Property 2.](Trace.md#^db2110) of the [trace](Trace.md) also allows us to define the trace of an [operator.](linear%20operator)
%%not clear, needs elaborating on%%
Since the trace is only defined for [$n \times n$ matrices](trace#^4b0758) (i.e. matrices square matrices with finite rows and columns), it is only defined for operators that may be represented by finite matrices.
## Trace with respect to an orthonormal basis
Consider an [orthonormal basis](Orthonormal%20bases.md) defined by a set of vectors $\{|i\rangle\},$ where $\{|i\rangle\},A \in \mathcal{V},$ and where $\mathcal{V}$ is an [inner product space.](Inner%20products.md#Inner%20product%20spaces) Then the trace may be given with respect to the orthonormal basis such that $\mathrm{tr}(A)=\sum_{i} \langle i|A|i \rangle$ This may be used to [prove the cyclic property.](Trace.md#Proof%20of%20the%20cyclic%20property%20of%20trace%20with%20respect%20to%20an%20orthonormal%20basis)^582dc2
%%Does this generalize to a basis that's infinite but not continuous?%%
## Trace with respect to a continuous orthonormal basis
%%here trace becomes an integral%%
# Partial trace
([... see more](Partial%20trace))
---
# Proofs and examples
## Proof of the cyclic property
### Proof of the cyclic property of trace with respect to an orthonormal basis



%%Does still work for an infinite product of operators?%%
%%There are some things to check here:
Are the corresponding vectors with each matrix in the proof corresponding with those matrices in any way? Does this proof or property make sense if you take m to infinity? Probably not because you can't define an infinitieth element.
And is this a sum over multiple bases? yes.%%
---
# Recommended reading
A definition and discussion of the trace of a matrix can be find in any introductory linear algebra textbook. For example, one text where it is introduced is
* [Axler S., Gerhing F.W., Ribet K.A. _Linear Algebra Done Right_, Springer, 2nd edition, 1997](Axler%20S.,%20Gerhing%20F.W.,%20Ribet%20K.A.%20Linear%20Algebra%20Done%20Right,%20Springer,%202nd%20edition,%201997.md) pgs. 217-222. In particular here trace is introduced as being defined as [the sum of eigenvalues](Trace.md#The%20trace%20as%20the%20sum%20of%20eigenvalues) of a matrix.
For an introduction to trace from a perspective that's helpful towards understanding the role of trace in quantum mechanics see:
* [Nielson, M. A., Chuang, I. L. _Quantum Computation and Quantum Information_, Cambridge University Press, 2010](Nielsen,%20M.%20A.,%20Chuang,%20I.%20L.%20Quantum%20Computation%20and%20Quantum%20Information,%20Cambridge%20University%20Press,%202010.md) pg 75. Here the implications surrounding the fact that the trace is invariant under unitary similarity transformation are emphasized. Here trace is also defined with respect to an [orthonormal basis.](Trace.md#Trace%20with%20respect%20to%20an%20orthonormal%20basis) ^81c930
An explanation given as to how it is we can write trace in terms of an orthonormal basis is provided here:
* [joshphysics (https://physics.stackexchange.com/users/19976/joshphysics), Trace of an operator matrix (Quantum computation and quantum information), URL (version: 2015-04-24): https://physics.stackexchange.com/q/104155](joshphysics%20Trace%20of%20an%20operator%20matrix%20(Quantum%20computation%20and%20quantum%20information),%20URL%20(version%202015-04-24).md)
#MathematicalFoundations/Algebra/AbstractAlgebra/LinearAlgebra