Introduction

A matrix is a rectangular array of numbers. Matrices represent linear maps, systems of linear equations, graphs (adjacency matrices) and transformations in graphics. Later topics in linear algebra (determinants, rank, eigenvalues, LU decomposition) build on these operations and special types. The tasks are to apply the algebra of matrix products, transposes and inverses, and to use the defining properties of special matrices such as symmetric, orthogonal and idempotent matrices.

Prerequisites

None within this subject. Familiarity with real numbers, summation notation and solving two linear equations is enough.

Core concepts

Notation

An m×nm \times n matrix A=[aij]A = [a_{ij}] has mm rows and nn columns; aija_{ij} is the entry in row ii, column jj. AA is square if m=nm = n; its main diagonal is a11,a22,…,anna_{11}, a_{22}, \ldots, a_{nn}. Entries are real unless stated otherwise. Vectors are column matrices (n×1n \times 1).

Operations

  • Addition requires equal matrix sizes; addition and scalar multiplication are entrywise: (A+B)ij=aij+bij(A + B)_{ij} = a_{ij} + b_{ij}, (cA)ij=c aij(cA)_{ij} = c\,a_{ij}.
  • Product. If AA is m×nm \times n and BB is n×pn \times p, then ABAB is m×pm \times p with
(AB)ij=∑k=1naikbkj.(AB)_{ij} = \sum_{k=1}^{n} a_{ik} b_{kj}.

The inner sizes must agree. Computing ABAB directly takes mnpmnp scalar multiplications.

Properties of the product:

  • Associative: (AB)C=A(BC)(AB)C = A(BC); distributive: A(B+C)=AB+ACA(B + C) = AB + AC.
  • Not commutative in general: AB≠BAAB \ne BA, and one may be defined when the other is not.
  • Cancellation requires the relevant rank condition: full column rank of AA guarantees AB=AC⇒B=CAB=AC\Rightarrow B=C; full row rank of a right factor guarantees right cancellation. For square factors these conditions are equivalent to invertibility; AB=0AB = 0 is possible with A≠0A \ne 0 and B≠0B \ne 0.
  • Because of non-commutativity, (A+B)2=A2+AB+BA+B2(A + B)^2 = A^2 + AB + BA + B^2, which equals A2+2AB+B2A^2 + 2AB + B^2 only if AB=BAAB = BA.

The cost depends on the bracketing even though the result does not; choosing the best order is the matrix chain multiplication problem.

Transpose and trace

The transpose ATA^T has (AT)ij=aji(A^T)_{ij} = a_{ji}. Rules: (AT)T=A(A^T)^T = A, (A+B)T=AT+BT(A + B)^T = A^T + B^T, (cA)T=cAT(cA)^T = cA^T, and the order reverses for products:

(AB)T=BTAT.(AB)^T = B^T A^T .

The trace of a square matrix is the sum of its diagonal entries, tr⁡(A)=∑iaii\operatorname{tr}(A) = \sum_i a_{ii}. It is linear, tr⁡(AT)=tr⁡(A)\operatorname{tr}(A^T) = \operatorname{tr}(A), and tr⁡(AB)=tr⁡(BA)\operatorname{tr}(AB) = \operatorname{tr}(BA) whenever both products are defined (even for non-square A,BA, B). In general tr⁡(AB)≠tr⁡(A)tr⁡(B)\operatorname{tr}(AB) \ne \operatorname{tr}(A)\operatorname{tr}(B).

Inverse

A square AA is invertible (non-singular) if there is BB with AB=BA=IAB = BA = I; then B=A−1B = A^{-1} is unique. For square matrices, AB=IAB = I alone already implies BA=IBA = I. AA is invertible if and only if det⁡A≠0\det A \ne 0 (see Determinants). Rules:

(AB)−1=B−1A−1,(AT)−1=(A−1)T,(cA)−1=1cA−1 (c≠0),A−1=adj⁡(A)det⁡A.(AB)^{-1} = B^{-1}A^{-1}, \qquad (A^T)^{-1} = (A^{-1})^T, \qquad (cA)^{-1} = \tfrac{1}{c}A^{-1} \ (c \ne 0), \qquad A^{-1} = \frac{\operatorname{adj}(A)}{\det A}.

For 2×22 \times 2:

(abcd)−1=1ad−bc(d−b−ca),ad−bc≠0.\begin{pmatrix} a & b \\ c & d \end{pmatrix}^{-1} = \frac{1}{ad - bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}, \qquad ad - bc \ne 0 .

Special matrices

TypeDefinition (square AA)Notes
Diagonalaij=0a_{ij} = 0 for i≠ji \ne jproducts and powers act entrywise on the diagonal
Scalar / identityA=cIA = cI / IIcommutes with every matrix
Upper (lower) triangularaij=0a_{ij} = 0 for i>ji > j (i<ji < j)closed under products; determinant = product of diagonal
SymmetricAT=AA^T = Areal eigenvalues; orthogonally diagonalisable
Skew-symmetricAT=−AA^T = -Adiagonal is 0; xTAx=0x^TAx = 0 for all xx
OrthogonalATA=AAT=IA^TA = AA^T = IA−1=ATA^{-1} = A^T; det⁡A=±1\det A = \pm 1; preserves lengths
IdempotentA2=AA^2 = Aeigenvalues in {0,1}\{0, 1\}; rank = trace
NilpotentAk=0A^k = 0 for some kkall eigenvalues 0; trace 0; det⁡A=0\det A = 0
InvolutoryA2=IA^2 = IA−1=AA^{-1} = A; eigenvalues in {1,−1}\{1, -1\}

Over complex numbers the analogues are Hermitian (A∗=AA^* = A, where A∗A^* is the conjugate transpose) and unitary (A∗A=IA^*A = I).

Special matrices
Figure 1. Sparsity and symmetry patterns of the special matrices: diagonal, upper and lower triangular, symmetric (mirror across the diagonal), skew-symmetric (mirror with sign change, zero diagonal), plus defining identities for orthogonal and idempotent matrices.

Key facts:

  • Every square matrix splits uniquely as symmetric plus skew-symmetric: A=12(A+AT)+12(A−AT)A = \tfrac{1}{2}(A + A^T) + \tfrac{1}{2}(A - A^T).
  • AATAA^T and ATAA^TA are always symmetric.
  • If AA and BB are symmetric, ABAB is symmetric if and only if AB=BAAB = BA.
  • A skew-symmetric matrix of odd order has determinant 0, since det⁡A=det⁡(AT)=det⁡(−A)=(−1)ndet⁡A\det A = \det(A^T) = \det(-A) = (-1)^n \det A.
  • If AA is idempotent, so is I−AI - A, and A(I−A)=0A(I - A) = 0.
  • If NN is nilpotent with Nk=0N^k = 0, then I−NI - N is invertible with inverse I+N+⋯+Nk−1I + N + \cdots + N^{k-1}.

Rank (preview)

The rank of AA is the maximum number of linearly independent rows (equivalently, columns). It is developed with row reduction in Systems of Linear Equations and Rank. Useful facts: rank⁡(AB)≤min⁡(rank⁡A,rank⁡B)\operatorname{rank}(AB) \le \min(\operatorname{rank} A, \operatorname{rank} B) and rank⁡(AT)=rank⁡(A)\operatorname{rank}(A^T) = \operatorname{rank}(A).

More rank facts. For matrices of compatible sizes, rank⁡(A+B)≤rank⁡A+rank⁡B\operatorname{rank}(A + B) \le \operatorname{rank} A + \operatorname{rank} B; multiplying by invertible matrices does not change rank, rank⁡(PAQ)=rank⁡A\operatorname{rank}(PAQ) = \operatorname{rank} A; for real AA, rank⁡(ATA)=rank⁡(AAT)=rank⁡A\operatorname{rank}(A^TA) = \operatorname{rank}(AA^T) = \operatorname{rank} A. A non-zero column times a non-zero row, uvTuv^T, has rank 1, and every rank-1 matrix has this form.

Trace facts. tr⁡(AB)=tr⁡(BA)\operatorname{tr}(AB) = \operatorname{tr}(BA) holds even when AA is m×nm \times n and BB is n×mn \times m, so ABAB and BABA have different sizes. The trace is invariant under cyclic shifts, tr⁡(ABC)=tr⁡(CAB)=tr⁡(BCA)\operatorname{tr}(ABC) = \operatorname{tr}(CAB) = \operatorname{tr}(BCA), but not under arbitrary reorderings. One consequence: no square matrices satisfy AB−BA=IAB - BA = I, because the left side has trace 0 and the right side has trace nn.

Worked examples

Example 1: non-commuting product

A=(1234)A = \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}, B=(0110)B = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}. Then AB=(2143)AB = \begin{pmatrix} 2 & 1 \\ 4 & 3 \end{pmatrix} (columns swapped) while BA=(3412)BA = \begin{pmatrix} 3 & 4 \\ 1 & 2 \end{pmatrix} (rows swapped). Both have trace 5, as tr⁡(AB)=tr⁡(BA)\operatorname{tr}(AB) = \operatorname{tr}(BA) predicts.

Example 2: zero divisors

A=(1111)A = \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}, B=(1−1−11)B = \begin{pmatrix} 1 & -1 \\ -1 & 1 \end{pmatrix}: AB=0AB = 0 although neither factor is zero.

Example 3: symmetric plus skew-symmetric

A=(1423)=(1333)+(01−10)A = \begin{pmatrix} 1 & 4 \\ 2 & 3 \end{pmatrix} = \begin{pmatrix} 1 & 3 \\ 3 & 3 \end{pmatrix} + \begin{pmatrix} 0 & 1 \\ -1 & 0 \end{pmatrix}.

Example 4: inverse

(2153)\begin{pmatrix} 2 & 1 \\ 5 & 3 \end{pmatrix} has determinant 11, so its inverse is (3−1−52)\begin{pmatrix} 3 & -1 \\ -5 & 2 \end{pmatrix}. Check by multiplying.

Example 5: powers

A=(1101)A = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix} gives An=(1n01)A^n = \begin{pmatrix} 1 & n \\ 0 & 1 \end{pmatrix} by induction. The idempotent P=(1100)P = \begin{pmatrix} 1 & 1 \\ 0 & 0 \end{pmatrix} satisfies P2=PP^2 = P, tr⁡P=1=rank⁡P\operatorname{tr} P = 1 = \operatorname{rank} P. The rotation Rθ=(cos⁡θ−sin⁡θsin⁡θcos⁡θ)R_\theta = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix} is orthogonal with Rθ−1=RθT=R−θR_\theta^{-1} = R_\theta^T = R_{-\theta}.

Example 6: bracketing cost

AA is 10×10010 \times 100, BB is 100×5100 \times 5, CC is 5×505 \times 50. (AB)C(AB)C costs 10⋅100⋅5+10⋅5⋅50=750010 \cdot 100 \cdot 5 + 10 \cdot 5 \cdot 50 = 7500 multiplications; A(BC)A(BC) costs 100⋅5⋅50+10⋅100⋅50=75000100 \cdot 5 \cdot 50 + 10 \cdot 100 \cdot 50 = 75000.

Example 7: counting special matrices

An n×nn \times n symmetric matrix is fixed by its entries on and above the diagonal: n(n+1)/2n(n + 1)/2 free entries. With entries from {0,1}\{0, 1\} there are 2n(n+1)/22^{n(n+1)/2} such matrices (64 for n=3n = 3). A skew-symmetric matrix has a zero diagonal and n(n−1)/2n(n - 1)/2 free entries above it; with entries from {−1,0,1}\{-1, 0, 1\} there are 3n(n−1)/23^{n(n-1)/2} (27 for n=3n = 3).

Example 8: inverse via nilpotency

N=(010001000)N = \begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{pmatrix} has N3=0N^3 = 0, so (I+N)−1=I−N+N2=(1−1101−1001)(I + N)^{-1} = I - N + N^2 = \begin{pmatrix} 1 & -1 & 1 \\ 0 & 1 & -1 \\ 0 & 0 & 1 \end{pmatrix}.

Example 9: powers of a rank-one matrix

Let u=(1,2,3)Tu = (1, 2, 3)^T and v=(1,1,1)Tv = (1, 1, 1)^T, so A=uvTA = uv^T has rows (1,1,1)(1, 1, 1), (2,2,2)(2, 2, 2), (3,3,3)(3, 3, 3) and rank 1. Since A2=u(vTu)vT=(vTu)AA^2 = u(v^Tu)v^T = (v^Tu)A and vTu=6=tr⁡Av^Tu = 6 = \operatorname{tr}A,

A2=6A,Ak=6k−1A(k≥1),A^2 = 6A, \qquad A^k = 6^{k-1}A \quad (k \ge 1),

so A3=36AA^3 = 36A and every entry of A3A^3 is 36 times the matching entry of AA. No matrix multiplication is needed.

Example 10: trace with rectangular factors

A=(120013)A = \begin{pmatrix} 1 & 2 & 0 \\ 0 & 1 & 3 \end{pmatrix} and B=(102104)B = \begin{pmatrix} 1 & 0 \\ 2 & 1 \\ 0 & 4 \end{pmatrix}. Then AB=(52213)AB = \begin{pmatrix} 5 & 2 \\ 2 & 13 \end{pmatrix} is 2×22 \times 2 and BA=(1202530412)BA = \begin{pmatrix} 1 & 2 & 0 \\ 2 & 5 & 3 \\ 0 & 4 & 12 \end{pmatrix} is 3×33 \times 3, yet both traces are 18. For a non-cyclic reordering, take the matrix units E12,E21,E11E_{12}, E_{21}, E_{11} (a single 1 in the named position): tr⁡(E12E21E11)=1\operatorname{tr}(E_{12}E_{21}E_{11}) = 1 but tr⁡(E12E11E21)=0\operatorname{tr}(E_{12}E_{11}E_{21}) = 0.

Important properties and observations

  • Diagonal matrices commute with each other; a general matrix commutes with all matrices only if it is scalar.
  • The product of two upper triangular matrices is upper triangular, and its diagonal is the product of the diagonals.
  • Orthogonal matrices have orthonormal rows and orthonormal columns.
  • The only invertible idempotent matrix is II; the only nilpotent matrix that is diagonalisable is 00.

GATE examination perspective

  • Algebra of products, transposes and inverses, especially the order reversal in (AB)T(AB)^T and (AB)−1(AB)^{-1}.
  • Properties of special matrices: determinant, eigenvalues, trace or rank of idempotent, nilpotent, orthogonal, skew-symmetric matrices.
  • Counting symmetric or skew-symmetric matrices over a finite set of entries.
  • Trap: assuming AB=BAAB = BA, or cancelling a factor without the required full-column-rank (left) or full-row-rank (right) condition.
  • Rank-one matrices. A=uvTA = uv^T satisfies A2=(tr⁡A) AA^2 = (\operatorname{tr}A)\,A; powers follow at once (Example 9).
  • Trap: rank⁡(A+B)=rank⁡A+rank⁡B\operatorname{rank}(A + B) = \operatorname{rank}A + \operatorname{rank}B and tr⁡(ABC)=tr⁡(ACB)\operatorname{tr}(ABC) = \operatorname{tr}(ACB) are both false in general.

Summary

Sources

  1. G. Strang, Introduction to Linear Algebra, 5th ed., Wellesley-Cambridge Press, 2016: Chapter 2 (Solving Linear Equations), Sections 2.4 (Rules for Matrix Operations), 2.5 (Inverse Matrices) and 2.7 (Transposes and Permutations).
  2. E. Kreyszig, Advanced Engineering Mathematics, 10th ed., Wiley, 2011: Chapter 7 (Linear Algebra: Matrices, Vectors, Determinants. Linear Systems).

Next steps