1. Home
  2. Explore
  3. Mathematics
  4. Visualizing Matrix Trace

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Visualizing Matrix Trace

Trace as Divergence: A Geometric Understanding of Matrix Properties

The trace of a square matrix is usually introduced algebraically: add the entries on the main diagonal. For a matrix

A=(abcd),A= \begin{pmatrix} a & b\\ c & d \end{pmatrix},A=(ac​bd​),

the trace is

tr⁡(A)=a+d.\operatorname{tr}(A)=a+d.tr(A)=a+d.

That calculation is simple, but it does not immediately explain why the diagonal entries are important or why trace appears in so many different formulas. A geometric viewpoint provides that explanation.

The central idea is:

The trace of a matrix is the divergence of the vector field generated by that matrix.

Divergence measures how quickly a small region expands or contracts as it moves through a vector field. Once this connection is understood, several properties of trace—including its relationship to eigenvalues, determinants, matrix exponentials, changes of basis, and Jacobi’s formula—become natural.

Matrices as Vector Fields

Consider a matrix AAA and a point in the plane represented by its position vector x\mathbf{x}x. The matrix attaches a new vector to that point:

x⟼Ax.\mathbf{x}\longmapsto A\mathbf{x}.x⟼Ax.

Thus, every point x\mathbf{x}x has an associated vector AxA\mathbf{x}Ax. Drawing all these vectors produces a vector field.

The vectors may have very different lengths. For visualization, diagrams often standardize the lengths and preserve only the directions. Colors can then be used to indicate the original magnitudes. The mathematical vector field itself still consists of the actual vectors AxA\mathbf{x}Ax.

Two especially important points are the standard basis vectors:

e1=(10),e2=(01).\mathbf{e}_1= \begin{pmatrix} 1\\ 0 \end{pmatrix}, \qquad \mathbf{e}_2= \begin{pmatrix} 0\\ 1 \end{pmatrix}.e1​=(10​),e2​=(01​).

For the matrix

A=(abcd),A= \begin{pmatrix} a & b\\ c & d \end{pmatrix},A=(ac​bd​),

the vectors attached to these points are

Ae1=(ac),Ae2=(bd).A\mathbf{e}_1= \begin{pmatrix} a\\ c \end{pmatrix}, \qquad A\mathbf{e}_2= \begin{pmatrix} b\\ d \end{pmatrix}.Ae1​=(ac​),Ae2​=(bd​).

These are precisely the first and second columns of AAA. This is one reason columns are geometrically significant: each column records where a standard basis direction is sent.

Divergence and Area Change

The local meaning of divergence

Suppose a small region surrounds a point in a vector field. Every point in that region is allowed to move according to the vector attached to it. As the points move, the region may expand, contract, or change shape.

The divergence at the point measures the initial rate of area change per unit area:

divergence⁡=lim⁡ε→0change in areaε⋅initial area.\operatorname{divergence} = \lim_{\varepsilon\to 0} \frac{\text{change in area}}{\varepsilon\cdot\text{initial area}}.divergence=ε→0lim​ε⋅initial areachange in area​.

Here, ε\varepsilonε represents a very short amount of time.

  • Positive divergence means that the region initially expands.
  • Negative divergence means that the region initially contracts.
  • Zero divergence means that there is no initial net change in area.

The phrase per area is essential. If the initial region is made four times larger, the absolute change in area is also four times larger. However, the change divided by the original area remains the same.

For example, suppose one region experiences an area change of approximately −0.148-0.148−0.148. If a region with four times the initial area experiences a change of approximately −0.595-0.595−0.595, the second change is about four times the first. The divergence is unchanged because both the change and the original area were multiplied by the same factor.

Why divergence is normally local

In a general vector field, divergence can vary from point to point. A small region near one point may expand while a small region elsewhere contracts.

A matrix-generated vector field has a special structure. Let x\mathbf{x}x be a point and let x+d\mathbf{x}+\mathbf{d}x+d be a nearby point, where d\mathbf{d}d is a small displacement. Their attached vectors are

AxandA(x+d).A\mathbf{x} \qquad\text{and}\qquad A(\mathbf{x}+\mathbf{d}).AxandA(x+d).

After a short time ε\varepsilonε, the two points move approximately to

x+εAx\mathbf{x}+\varepsilon A\mathbf{x}x+εAx

and

x+d+εA(x+d).\mathbf{x}+\mathbf{d}+\varepsilon A(\mathbf{x}+\mathbf{d}).x+d+εA(x+d).

The new displacement between them is

d+εAd.\mathbf{d}+\varepsilon A\mathbf{d}.d+εAd.

The key feature is that the original position x\mathbf{x}x has disappeared. The change in the displacement depends only on d\mathbf{d}d and AAA, not on where the region was located.

Therefore, any two initially identical small regions undergo the same shape change under the flow generated by AAA. The area change is the same everywhere, so the divergence is constant throughout the entire matrix-generated vector field.

From small regions to ordinary regions

Because the divergence is constant, the region used to measure it does not need to be infinitesimally small. A larger region can be divided into many small pieces. If each small piece has its area multiplied by approximately

1+ε divergence⁡,1+\varepsilon\,\operatorname{divergence},1+εdivergence,

then the entire region is multiplied by the same factor.

This allows a convenient region to be chosen: the unit square spanned by the standard basis vectors. Its initial area is 111, so its area change directly represents the rate of area change.

For a matrix-generated vector field, divergence is constant everywhere, so a convenient finite region can be used to calculate it.

Why Trace Equals Divergence

Consider again

A=(abcd).A= \begin{pmatrix} a & b\\ c & d \end{pmatrix}.A=(ac​bd​).

The unit square has corners determined by the vectors e1\mathbf{e}_1e1​ and e2\mathbf{e}_2e2​. The vector attached to e1\mathbf{e}_1e1​ is

Ae1=(ac).A\mathbf{e}_1= \begin{pmatrix} a\\ c \end{pmatrix}.Ae1​=(ac​).

The horizontal component aaa changes the width of the square. The vertical component ccc merely slides the corresponding side upward or downward; it changes the shape but does not contribute to the first-order change in area.

Likewise, the vector attached to e2\mathbf{e}_2e2​ is

Ae2=(bd).A\mathbf{e}_2= \begin{pmatrix} b\\ d \end{pmatrix}.Ae2​=(bd​).

The vertical component ddd changes the height of the square. The horizontal component bbb shears the square sideways but does not contribute to the first-order area change.

Consequently:

  • The first diagonal entry aaa measures the contribution from horizontal expansion.
  • The second diagonal entry ddd measures the contribution from vertical expansion.
  • The off-diagonal entries bbb and ccc produce shearing effects, which do not change area to first order.

The total rate of area change is therefore

a+d.a+d.a+d.

Since this is exactly the trace,

tr⁡(A)=divergence of the vector field Ax.\boxed{\operatorname{tr}(A)=\text{divergence of the vector field }A\mathbf{x}.}tr(A)=divergence of the vector field Ax.​

The determinant confirmation

The same result can be obtained through the determinant. After a short time ε\varepsilonε, the standard basis vectors move to approximately

(10)+ε(ac)=(1+εaεc)\begin{pmatrix} 1\\ 0 \end{pmatrix} + \varepsilon \begin{pmatrix} a\\ c \end{pmatrix} = \begin{pmatrix} 1+\varepsilon a\\ \varepsilon c \end{pmatrix}(10​)+ε(ac​)=(1+εaεc​)

and

(01)+ε(bd)=(εb1+εd).\begin{pmatrix} 0\\ 1 \end{pmatrix} + \varepsilon \begin{pmatrix} b\\ d \end{pmatrix} = \begin{pmatrix} \varepsilon b\\ 1+\varepsilon d \end{pmatrix}.(01​)+ε(bd​)=(εb1+εd​).

The new area is the determinant of the matrix whose columns are these two vectors:

det⁡(1+εaεbεc1+εd).\det \begin{pmatrix} 1+\varepsilon a & \varepsilon b\\ \varepsilon c & 1+\varepsilon d \end{pmatrix}.det(1+εaεc​εb1+εd​).

Expanding gives

(1+εa)(1+εd)−ε2bc.(1+\varepsilon a)(1+\varepsilon d)-\varepsilon^2bc.(1+εa)(1+εd)−ε2bc.

Ignoring terms of order ε2\varepsilon^2ε2 when considering the initial rate of change, this becomes

1+ε(a+d).1+\varepsilon(a+d).1+ε(a+d).

Thus, the area changes at the rate a+da+da+d, again showing that

tr⁡(A)=a+d\operatorname{tr}(A)=a+dtr(A)=a+d

is the divergence.

Think About It

If a matrix has zero trace but nonzero off-diagonal entries, what kind of geometric effect can it produce? The answer is that it may shear or rotate regions without causing a first-order net expansion or contraction of area.

Trace and Eigenvalues

An eigenvector of AAA is a direction that the matrix does not turn away from itself. If x\mathbf{x}x is an eigenvector, then

Ax=λx,A\mathbf{x}=\lambda\mathbf{x},Ax=λx,

where λ\lambdaλ is the corresponding eigenvalue.

In the vector-field picture, the attached vector AxA\mathbf{x}Ax lies on the same line as x\mathbf{x}x. The vector may point in the same direction or the opposite direction:

  • If λ>0\lambda>0λ>0, the vector points along the same direction.
  • If λ<0\lambda<0λ<0, it points in the opposite direction.
  • The magnitude of the velocity is scaled by ∣λ∣\lvert\lambda\rvert∣λ∣.

Suppose there are two independent eigenvector directions with eigenvalues λ1\lambda_1λ1​ and λ2\lambda_2λ2​. A parallelogram can be chosen whose sides lie along these two eigenvector directions. Let the side lengths be rrr and sss, and let the angle between the directions be θ\thetaθ.

The initial area is

rssin⁡θ.rs\sin\theta.rssinθ.

Along the first eigenvector direction, the side length changes after a short time ε\varepsilonε to

r(1+ελ1).r(1+\varepsilon\lambda_1).r(1+ελ1​).

Along the second direction, it changes to

s(1+ελ2).s(1+\varepsilon\lambda_2).s(1+ελ2​).

The new area is therefore

rs(1+ελ1)(1+ελ2)sin⁡θ.rs(1+\varepsilon\lambda_1)(1+\varepsilon\lambda_2)\sin\theta.rs(1+ελ1​)(1+ελ2​)sinθ.

The area ratio is

new areaold area=(1+ελ1)(1+ελ2).\frac{\text{new area}}{\text{old area}} = (1+\varepsilon\lambda_1)(1+\varepsilon\lambda_2).old areanew area​=(1+ελ1​)(1+ελ2​).

Expanding:

(1+ελ1)(1+ελ2)=1+ε(λ1+λ2)+ε2λ1λ2.(1+\varepsilon\lambda_1)(1+\varepsilon\lambda_2) = 1+\varepsilon(\lambda_1+\lambda_2)+\varepsilon^2\lambda_1\lambda_2.(1+ελ1​)(1+ελ2​)=1+ε(λ1​+λ2​)+ε2λ1​λ2​.

The divergence is the initial relative area-change rate:

1ε[new area−old areaold area].\frac{1}{\varepsilon} \left[ \frac{\text{new area}-\text{old area}}{\text{old area}} \right].ε1​[old areanew area−old area​].

As ε\varepsilonε approaches 000, the term involving ε2\varepsilon^2ε2 disappears, leaving

divergence⁡=λ1+λ2.\operatorname{divergence}=\lambda_1+\lambda_2.divergence=λ1​+λ2​.

Since divergence equals trace,

tr⁡(A)=λ1+λ2.\boxed{\operatorname{tr}(A)=\lambda_1+\lambda_2.}tr(A)=λ1​+λ2​.​

Thus, the trace is the sum of the eigenvalues. Geometrically, each eigenvalue contributes the expansion or contraction rate along one independent eigenvector direction.

Matrix Exponentials and Determinants

The vector field generated by AAA describes a continuous flow. If a point begins at x\mathbf{x}x and moves for time ttt, its position is

etAx,e^{tA}\mathbf{x},etAx,

where etAe^{tA}etA is the matrix exponential.

The matrix exponential transforms an initial region into the region obtained after flowing for time ttt. The determinant measures the area-scaling factor of that transformation. If S(t)S(t)S(t) denotes the area of a region at time ttt, then

S(t)=det⁡(etA)S(0).S(t)=\det(e^{tA})S(0).S(t)=det(etA)S(0).

Because the trace is the divergence, it is the rate of area change per unit area:

S′(t)S(t)=tr⁡(A).\frac{S'(t)}{S(t)}=\operatorname{tr}(A).S(t)S′(t)​=tr(A).

Equivalently,

S′(t)=tr⁡(A) S(t).S'(t)=\operatorname{tr}(A)\,S(t).S′(t)=tr(A)S(t).

The trace is constant because AAA is fixed. Solving this differential equation gives

S(t)=S(0)ettr⁡(A).S(t)=S(0)e^{t\operatorname{tr}(A)}.S(t)=S(0)ettr(A).

Therefore,

det⁡(etA)=ettr⁡(A).\det(e^{tA})=e^{t\operatorname{tr}(A)}.det(etA)=ettr(A).

In particular, setting t=1t=1t=1 yields

det⁡(eA)=etr⁡(A).\boxed{\det(e^A)=e^{\operatorname{tr}(A)}}.det(eA)=etr(A)​.

This identity is not an isolated algebraic coincidence. It says that the exponential of the total infinitesimal area-growth rate produces the total area-scaling factor after time evolution.

Think About It

If tr⁡(A)>0\operatorname{tr}(A)>0tr(A)>0, the flow produces exponential area growth. If tr⁡(A)<0\operatorname{tr}(A)<0tr(A)<0, it produces exponential area decay. If tr⁡(A)=0\operatorname{tr}(A)=0tr(A)=0, the flow preserves area to the level described by this divergence calculation.

Trace and Change of Basis

A matrix depends on the coordinates used to describe it, but its trace does not. The vector-field viewpoint explains why.

Let QQQ be an invertible linear transformation applied to the entire geometric picture. A point x\mathbf{x}x becomes

Qx.Q\mathbf{x}.Qx.

An attached vector AxA\mathbf{x}Ax becomes

Q(Ax)=QAx.Q(A\mathbf{x})=QA\mathbf{x}.Q(Ax)=QAx.

Introduce a new position vector

y=Qx.\mathbf{y}=Q\mathbf{x}.y=Qx.

Since

x=Q−1y,\mathbf{x}=Q^{-1}\mathbf{y},x=Q−1y,

the transformed attached vector is

QAQ−1y.QAQ^{-1}\mathbf{y}.QAQ−1y.

Thus, in the new coordinates, the vector field is generated by the matrix

QAQ−1.QAQ^{-1}.QAQ−1.

This is a similarity transformation.

The transformation QQQ changes every area by the factor det⁡(Q)\det(Q)det(Q). However, divergence is a ratio:

area changeinitial area.\frac{\text{area change}}{\text{initial area}}.initial areaarea change​.

Both the numerator and denominator acquire the same factor, so the factor cancels. The rate of area change per area remains unchanged.

Therefore,

tr⁡(A)=tr⁡(QAQ−1).\boxed{\operatorname{tr}(A)=\operatorname{tr}(QAQ^{-1})}.tr(A)=tr(QAQ−1)​.

The usual change-of-basis expression is P−1APP^{-1}APP−1AP. Taking Q=P−1Q=P^{-1}Q=P−1 gives

tr⁡(A)=tr⁡(P−1AP).\boxed{\operatorname{tr}(A)=\operatorname{tr}(P^{-1}AP)}.tr(A)=tr(P−1AP)​.

This means that trace is an intrinsic property of the linear transformation, not an artifact of a particular coordinate system.

The Cyclic Property: tr⁡(AB)=tr⁡(BA)\operatorname{tr}(AB)=\operatorname{tr}(BA)tr(AB)=tr(BA)

A famous property of trace is

tr⁡(AB)=tr⁡(BA).\boxed{\operatorname{tr}(AB)=\operatorname{tr}(BA)}.tr(AB)=tr(BA)​.

Suppose BBB is invertible. Since

B−1B=I,B^{-1}B=I,B−1B=I,

one may insert this product without changing ABABAB:

AB=B−1(BAB−1)BAB=B^{-1}(BAB^{-1})BAB=B−1(BAB−1)B

or, more directly, write

tr⁡(AB)=tr⁡(B−1(BA)B).\operatorname{tr}(AB) = \operatorname{tr}\left(B^{-1}(BA)B\right).tr(AB)=tr(B−1(BA)B).

The expression inside the trace is a similarity transformation of BABABA. Using invariance under similarity,

tr⁡(B−1(BA)B)=tr⁡(BA).\operatorname{tr}\left(B^{-1}(BA)B\right) = \operatorname{tr}(BA).tr(B−1(BA)B)=tr(BA).

Hence,

tr⁡(AB)=tr⁡(BA).\operatorname{tr}(AB)=\operatorname{tr}(BA).tr(AB)=tr(BA).

The geometric interpretation is that transforming the whole plane by an invertible change of coordinates does not alter divergence. The two products represent the same overall relationship viewed through a change of coordinates.

The derivation above assumes that one of the matrices is invertible so that the similarity transformation can be formed. The trace identity itself is more general, but the geometric derivation here uses invertibility.

Think About It

Matrix multiplication is generally not commutative: ABABAB usually differs from BABABA. The trace is unusual because it ignores enough coordinate detail that these two products have the same total diagonal effect.

Jacobi’s Formula

The final property concerns a time-dependent matrix A(t)A(t)A(t). For an invertible matrix, Jacobi’s formula states

ddtdet⁡A(t)=det⁡A(t) tr⁡(A(t)−1A′(t)).\boxed{ \frac{d}{dt}\det A(t) = \det A(t)\, \operatorname{tr}\left(A(t)^{-1}A'(t)\right) }.dtd​detA(t)=detA(t)tr(A(t)−1A′(t))​.

Here, A′(t)A'(t)A′(t) is the derivative of the matrix with respect to time.

Understanding the determinant geometrically

In two dimensions, the determinant of A(t)A(t)A(t) is the signed area of the parallelogram formed by applying A(t)A(t)A(t) to the two standard basis vectors. As ttt changes, the matrix changes, so the parallelogram changes.

Its corners move at velocities determined by

A′(t)e1andA′(t)e2.A'(t)\mathbf{e}_1 \qquad\text{and}\qquad A'(t)\mathbf{e}_2.A′(t)e1​andA′(t)e2​.

The determinant’s derivative,

ddtdet⁡A(t),\frac{d}{dt}\det A(t),dtd​detA(t),

is therefore the rate at which the parallelogram’s area changes.

To use the divergence interpretation, the changing parallelogram can be viewed as part of a vector field. The goal is to find a matrix MMM whose attached vector at each current position is the velocity of that position.

The current position vectors are of the form

A(t)ei.A(t)\mathbf{e}_i.A(t)ei​.

The corresponding velocities are

A′(t)ei.A'(t)\mathbf{e}_i.A′(t)ei​.

A matrix that maps the current position to its velocity is

A′(t)A(t)−1,A'(t)A(t)^{-1},A′(t)A(t)−1,

because

A′(t)A(t)−1(A(t)ei)=A′(t)ei.A'(t)A(t)^{-1}\bigl(A(t)\mathbf{e}_i\bigr) = A'(t)\mathbf{e}_i.A′(t)A(t)−1(A(t)ei​)=A′(t)ei​.

Thus, the relevant vector field is generated by

M=A′(t)A(t)−1.M=A'(t)A(t)^{-1}.M=A′(t)A(t)−1.

Since trace is divergence, the relative area-change rate is

ddtdet⁡A(t)det⁡A(t)=tr⁡(A′(t)A(t)−1).\frac{\frac{d}{dt}\det A(t)}{\det A(t)} = \operatorname{tr}\left(A'(t)A(t)^{-1}\right).detA(t)dtd​detA(t)​=tr(A′(t)A(t)−1).

Multiplying by det⁡A(t)\det A(t)detA(t) gives

ddtdet⁡A(t)=det⁡A(t) tr⁡(A′(t)A(t)−1).\frac{d}{dt}\det A(t) = \det A(t)\, \operatorname{tr}\left(A'(t)A(t)^{-1}\right).dtd​detA(t)=detA(t)tr(A′(t)A(t)−1).

Using the cyclic trace property,

tr⁡(A′(t)A(t)−1)=tr⁡(A(t)−1A′(t)),\operatorname{tr}\left(A'(t)A(t)^{-1}\right) = \operatorname{tr}\left(A(t)^{-1}A'(t)\right),tr(A′(t)A(t)−1)=tr(A(t)−1A′(t)),

so Jacobi’s formula becomes

ddtdet⁡A(t)=det⁡A(t) tr⁡(A(t)−1A′(t)).\boxed{ \frac{d}{dt}\det A(t) = \det A(t)\, \operatorname{tr}\left(A(t)^{-1}A'(t)\right) }.dtd​detA(t)=detA(t)tr(A(t)−1A′(t))​.

An equivalent geometric viewpoint

Instead of viewing the changing parallelogram in its current position, apply A(t)−1A(t)^{-1}A(t)−1 to the whole picture. This sends the parallelogram back to the standard basis positions. The attached velocity vectors then become

A(t)−1A′(t)e1andA(t)−1A′(t)e2.A(t)^{-1}A'(t)\mathbf{e}_1 \qquad\text{and}\qquad A(t)^{-1}A'(t)\mathbf{e}_2.A(t)−1A′(t)e1​andA(t)−1A′(t)e2​.

Therefore, the matrix generating the transformed vector field is

A(t)−1A′(t),A(t)^{-1}A'(t),A(t)−1A′(t),

which produces the formula directly:

ddtdet⁡A(t)=det⁡A(t) tr⁡(A(t)−1A′(t)).\frac{d}{dt}\det A(t) = \det A(t)\, \operatorname{tr}\left(A(t)^{-1}A'(t)\right).dtd​detA(t)=detA(t)tr(A(t)−1A′(t)).

The invertibility assumption is needed here because A(t)−1A(t)^{-1}A(t)−1 appears. A more general version can be written using the adjugate matrix, which remains defined even when A(t)A(t)A(t) is not invertible, but the divergence-based visualization is clearest in the invertible case.

Comprehensive Review

The geometric interpretation of trace begins with a matrix-generated vector field:

x⟼Ax.\mathbf{x}\longmapsto A\mathbf{x}.x⟼Ax.

Every point is assigned a velocity vector. When a region flows according to these velocities, its area changes. The divergence measures the initial rate of area change per unit area.

For a matrix-generated field, nearby points have displacement changes governed by

d⟼d+εAd,\mathbf{d}\longmapsto \mathbf{d}+\varepsilon A\mathbf{d},d⟼d+εAd,

which does not depend on the location of the original point. Therefore, the divergence is constant throughout the field.

For

A=(abcd),A= \begin{pmatrix} a & b\\ c & d \end{pmatrix},A=(ac​bd​),

the diagonal entries aaa and ddd produce first-order expansion or contraction, while the off-diagonal entries primarily produce shearing. Hence,

tr⁡(A)=a+d\operatorname{tr}(A)=a+dtr(A)=a+d

is exactly the divergence.

This single interpretation explains the major properties:

  • Trace equals divergence: tr⁡(A)=area-growth rate per area.\operatorname{tr}(A)=\text{area-growth rate per area}.tr(A)=area-growth rate per area.

  • Trace equals the sum of eigenvalues: tr⁡(A)=λ1+λ2,\operatorname{tr}(A)=\lambda_1+\lambda_2,tr(A)=λ1​+λ2​, because eigenvalues describe expansion or contraction along eigenvector directions.

  • Determinant of a matrix exponential: det⁡(etA)=ettr⁡(A),\det(e^{tA})=e^{t\operatorname{tr}(A)},det(etA)=ettr(A), because constant relative area growth accumulates exponentially over time.

  • Invariance under change of basis: tr⁡(A)=tr⁡(QAQ−1),\operatorname{tr}(A)=\operatorname{tr}(QAQ^{-1}),tr(A)=tr(QAQ−1), because coordinate transformations scale both area and area change by the same factor.

  • Cyclic property: tr⁡(AB)=tr⁡(BA),\operatorname{tr}(AB)=\operatorname{tr}(BA),tr(AB)=tr(BA), which follows from similarity invariance when the required inverse exists.

  • Jacobi’s formula:

    = \det A(t)\, \operatorname{tr}\left(A(t)^{-1}A'(t)\right),$$ because the trace measures the relative rate at which the determinant, interpreted as area, changes.

The trace is therefore much more than a diagonal sum. It is the total infinitesimal expansion rate of the space under a linear transformation.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent