Quiz 2

Matrices: Algebra, Types & Operations

3227 words
16 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Matrices: Algebra, Types & Operations ## 🎯 Learning Objectives After this topic you will be able to: - Identify a matrix by its dimensions $m \times n$ and refer to its entries $a_{ij}$ - Add and subtract matrices of the same size - Multiply a matrix by a scalar and multiply two matrices (when dimensions are comp...

Matrices: Algebra, Types & Operations

🎯 Learning Objectives

After this topic you will be able to:
  • Identify a matrix by its dimensions m×nm \times n and refer to its entries aija_{ij}
  • Add and subtract matrices of the same size
  • Multiply a matrix by a scalar and multiply two matrices (when dimensions are compatible)
  • Compute the transpose of a matrix
  • Recognise diagonal, triangular, identity, symmetric, and scalar matrices
  • Represent a system of linear equations as a matrix equation Ax=bA\mathbf{x} = \mathbf{b}
  • Apply the algebraic properties of matrix operations

📋 Prerequisites

  • Vectors Introduction (this week, previous topic) — vectors are the building blocks of matrices
  • Basic algebra — operations on real numbers
  • Matrices organise data in a rectangular grid; they are the natural language of linear algebra

1. What is a Matrix?

1.1 Intuition: A Spreadsheet of Numbers

Think of a matrix as a rectangular spreadsheet. If you run a small business selling three products across four cities, you might arrange your monthly revenue in a table:
City ACity BCity CCity D
Product 112008502100950
Product 2180092017501100
Product 395010501300780
That table is a 3×43 \times 4 (3 rows, 4 columns) matrix. Each entry records one number — the revenue for a specific product in a specific city. Matrices are everywhere in data science: datasets (rows = observations, columns = features), images (pixels), neural network weights, and more.

1.2 Formal Definition

Definition (Matrix). An m×nm \times n matrix is a rectangular array of real numbers with mm rows and nn columns. We write
>A=[a11a12a1na21a22a2nam1am2amn]>> A = \begin{bmatrix} a_{11} & a_{12} & \dots & a_{1n} \\ a_{21} & a_{22} & \dots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \dots & a_{mn} \end{bmatrix} >
The entry in row ii, column jj is aija_{ij} or AijA_{ij}. We say ARm×nA \in \mathbb{R}^{m \times n}. Key terminology:
TermMeaningExample
Dimensionm×nm \times n (rows ×\times columns)3×43 \times 4
Square matrixm=nm = n3×33 \times 3
Row vector1×n1 \times n matrix[1  2  5][1\; -2\; 5]
Column vectorm×1m \times 1 matrix[125]\begin{bmatrix}1\\-2\\5\end{bmatrix}
Zero matrixAll entries are 000m×n0_{m \times n}
Main diagonalEntries a11,a22,,akka_{11}, a_{22}, \dots, a_{kk}Where row = column

1.3 Notation Shortcuts

We often write a matrix as:
  • A=[aij]A = [a_{ij}] — shorthand for "the matrix with entry aija_{ij} at position (i,j)(i,j)"
  • Am×nA_{m \times n} — emphasising the dimensions

2. Matrix Operations

2.1 Matrix Addition (and Subtraction)

Two matrices of the same dimensions can be added entry-wise:
(A+B)ij=aij+bij(A + B)_{ij} = a_{ij} + b_{ij}
Example 1: Matrix addition
>A=[1234],B=[5678]>> A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix},\quad B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} >
>A+B=[1+52+63+74+8]=[681012]>> A + B = \begin{bmatrix} 1+5 & 2+6 \\ 3+7 & 4+8 \end{bmatrix} = \begin{bmatrix} 6 & 8 \\ 10 & 12 \end{bmatrix} >
Properties:
  • Commutativity: A+B=B+AA + B = B + A
  • Associativity: (A+B)+C=A+(B+C)(A + B) + C = A + (B + C)
  • Identity: A+0=AA + 0 = A (zero matrix is the additive identity)
  • Inverse: A+(A)=0A + (-A) = 0

2.2 Scalar Multiplication

Multiply every entry by the scalar cc:
(cA)ij=caij(cA)_{ij} = c \cdot a_{ij}
Example 2: Scalar multiplication
>A=[1204],3A=[36012]>> A = \begin{bmatrix} 1 & -2 \\ 0 & 4 \end{bmatrix},\quad 3A = \begin{bmatrix} 3 & -6 \\ 0 & 12 \end{bmatrix} >

2.3 Matrix Multiplication

This is the most important (and most confusing) operation. Unlike addition, matrix multiplication is not entry-wise.
Definition (Matrix Multiplication). If AA is m×nm \times n and BB is n×pn \times p, then the product C=ABC = AB is m×pm \times p with entries:
>cij=k=1naikbkj>> c_{ij} = \sum_{k=1}^{n} a_{ik} b_{kj} >
The (i,j)(i,j)-entry of CC is the dot product of row ii of AA with column jj of BB. Critical requirement: The number of columns of AA must equal the number of rows of BB. (Diagram) Example 3: Matrix multiplication (2×2)
>A=[1234],B=[0110]>> A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix},\quad B = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} >
AB &= \begin{bmatrix} 1(0) + 2(1) & 1(1) + 2(0) \\ 3(0) + 4(1) & 3(1) + 4(0) \end{bmatrix} \\ &= \begin{bmatrix} 0 + 2 & 1 + 0 \\ 0 + 4 & 3 + 0 \end{bmatrix} = \begin{bmatrix} 2 & 1 \\ 4 & 3 \end{bmatrix} \end{aligned}
>Example4:Matrixmultiplication(2×3by3×2)>>> **Example 4: Matrix multiplication (2×3 by 3×2)** > >
A = \begin{bmatrix} 1 & 0 & -1 \ 2 & 1 & 3 \end{bmatrix}{2 \times 3},\quad B = \begin{bmatrix} 1 & 2 \ 0 & 1 \ -2 & 0 \end{bmatrix}{3 \times 2}
> > c_{11} &= 1(1) + 0(0) + (-1)(-2) = 1 + 0 + 2 = 3 \\\\ c_{12} &= 1(2) + 0(1) + (-1)(0) = 2 + 0 + 0 = 2 \\\\ c_{21} &= 2(1) + 1(0) + 3(-2) = 2 + 0 - 6 = -4 \\\\ c_{22} &= 2(2) + 1(1) + 3(0) = 4 + 1 + 0 = 5 \\end{aligned}
AB = \begin{bmatrix} 3 & 2 \ -4 & 5 \end{bmatrix}_{2 \times 2} Example 5: Matrix × Column Vector
This is the most common case in linear algebra — a matrix multiplying a column vector produces another column vector (a linear combination of the columns).
>A=[101213],x=[210]>> A = \begin{bmatrix} 1 & 0 & -1 \\ 2 & 1 & 3 \end{bmatrix},\quad \mathbf{x} = \begin{bmatrix} 2 \\ -1 \\ 0 \end{bmatrix} >
>Ax=2[12]+(1)[01]+0[13]=[24]+[01]+[00]=[23]>> A\mathbf{x} = 2\begin{bmatrix}1\\2\end{bmatrix} + (-1)\begin{bmatrix}0\\1\end{bmatrix} + 0\begin{bmatrix}-1\\3\end{bmatrix} = \begin{bmatrix}2\\4\end{bmatrix} + \begin{bmatrix}0\\-1\end{bmatrix} + \begin{bmatrix}0\\0\end{bmatrix} = \begin{bmatrix}2\\3\end{bmatrix} >
Notice: AxA\mathbf{x} is a linear combination of the columns of AA with coefficients from x\mathbf{x}.

2.4 Properties of Matrix Multiplication

PropertyFormulaNotes
Associativity(AB)C=A(BC)(AB)C = A(BC)Always true when defined
DistributivityA(B+C)=AB+ACA(B+C) = AB + ACLeft and right distributivity
NOT commutativeABBAAB \neq BA in generalThis is a critical difference from numbers!
IdentityAI=IA=AAI = IA = AII = identity matrix
ZeroA0=0A0 = 0 , 0A=00A = 0Zero matrix
Example 6: Non-commutativity
>A=[1234],B=[0110]>> A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix},\quad B = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} >
>AB=[2143],BA=[3412]>> AB = \begin{bmatrix} 2 & 1 \\ 4 & 3 \end{bmatrix},\quad BA = \begin{bmatrix} 3 & 4 \\ 1 & 2 \end{bmatrix} >
ABBAAB \neq BA in this case.

3. Special Matrix Types

3.1 Identity Matrix

The n×nn \times n identity matrix InI_n has 1's on the main diagonal and 0's elsewhere:
In=[100010001]I_n = \begin{bmatrix} 1 & 0 & \dots & 0 \\ 0 & 1 & \dots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & 1 \end{bmatrix}
InI_n acts like the number 1 in multiplication: AIn=AA I_n = A and ImA=AI_m A = A for m×nm \times n matrix AA.

3.2 Diagonal Matrix

A square matrix where all off-diagonal entries are zero:
D=[d1000d2000dn]=diag(d1,d2,,dn)D = \begin{bmatrix} d_1 & 0 & \dots & 0 \\ 0 & d_2 & \dots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & d_n \end{bmatrix} = \text{diag}(d_1, d_2, \dots, d_n)

3.3 Scalar Matrix

A diagonal matrix where all diagonal entries are equal: D=cInD = c I_n.

3.4 Triangular Matrices

Upper triangular: all entries below the main diagonal are zero. Lower triangular: all entries above the main diagonal are zero.
U=[123045006](upper),L=[100230456](lower)U = \begin{bmatrix} 1 & 2 & 3 \\ 0 & 4 & 5 \\ 0 & 0 & 6 \end{bmatrix} \text{(upper)},\qquad L = \begin{bmatrix} 1 & 0 & 0 \\ 2 & 3 & 0 \\ 4 & 5 & 6 \end{bmatrix} \text{(lower)}

3.5 Symmetric Matrix

A square matrix AA is symmetric if A=ATA = A^T, i.e. aij=ajia_{ij} = a_{ji} for all i,ji, j.
A=[123245356]is symmetricA = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 5 \\ 3 & 5 & 6 \end{bmatrix} \text{is symmetric}
Symmetric matrices appear everywhere: distance matrices, adjacency matrices, covariance matrices, Hessian matrices (Week 11).

3.6 Zero Matrix

All entries are 0. Acts as the additive identity: A+0=AA + 0 = A.

4. Transpose of a Matrix

Definition (Transpose). The transpose of an m×nm \times n matrix AA is the n×mn \times m matrix ATA^T where (AT)ij=aji(A^T)_{ij} = a_{ji} (rows become columns). Example 7: Transpose
>A=[123456]3×2,AT=[135246]2×3>> A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \end{bmatrix}_{3 \times 2},\quad A^T = \begin{bmatrix} 1 & 3 & 5 \\ 2 & 4 & 6 \end{bmatrix}_{2 \times 3} >
Properties of transpose:
PropertyFormula
Involution(AT)T=A(A^T)^T = A
Addition(A+B)T=AT+BT(A + B)^T = A^T + B^T
Scalar(cA)T=cAT(cA)^T = cA^T
Product reversal(AB)T=BTAT(AB)^T = B^T A^T
The product reversal rule is famously easy to remember: "put your socks on before your shoes" ⇒ the transpose reverses the order.

5. Representing Linear Systems as Matrix Equations

A system of mm linear equations in nn unknowns:
{a11x1+a12x2++a1nxn=b1a21x1+a22x2++a2nxn=b2am1x1+am2x2++amnxn=bm\begin{cases} a_{11}x_1 + a_{12}x_2 + \cdots + a_{1n}x_n = b_1 \\ a_{21}x_1 + a_{22}x_2 + \cdots + a_{2n}x_n = b_2 \\ \vdots \\ a_{m1}x_1 + a_{m2}x_2 + \cdots + a_{mn}x_n = b_m \end{cases}
can be written compactly as:
Ax=bA\mathbf{x} = \mathbf{b}
where AA is the m×nm \times n coefficient matrix, x\mathbf{x} is the n×1n \times 1 unknown vector, and b\mathbf{b} is the m×1m \times 1 right-hand side vector.
Example 8: System → Matrix form
>{x+2yz=43xy+2z=1x+y+z=2    [121312111][xyz]=[412]>> \begin{cases} x + 2y - z = 4 \\ 3x - y + 2z = -1 \\ -x + y + z = 2 \end{cases} \;\Longleftrightarrow\; \begin{bmatrix} 1 & 2 & -1 \\ 3 & -1 & 2 \\ -1 & 1 & 1 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} 4 \\ -1 \\ 2 \end{bmatrix} >

6. Edge Cases & Gotchas

SituationWhat HappensWhy It Matters
Dimensions mismatch for additionOperation undefinedBoth matrices must be m×nm \times n
Inner dimensions don't match for multiplicationABAB undefined if AA is m×nm \times n and BB is r×pr \times p with nrn \neq rAlways check: columns of first = rows of second
Multiplying by zero matrixAlways gives zero matrixA0n×p=0m×pA \cdot 0_{n \times p} = 0_{m \times p}
** AB=0AB = 0 but neither AA nor BB is zero**Possible with matrices!Unlike real numbers, matrix multiplication has zero divisors
** AB=ACAB = AC does not imply B=CB = C **Cancellation fails without invertibilityMatrices have no division in general

7. Common Pitfalls

❌ Pitfall 1: Assuming commutativity

The most common mistake. ABAB and BABA are usually different, and one may be defined when the other isn't.

❌ Pitfall 2: Confusing multiplication dimensions

For ABAB, the inner dimensions must match: (m×n)(n×p)=m×p(m \times \mathbf{n})(\mathbf{n} \times p) = m \times p.

❌ Pitfall 3: Forgetting the transpose reversal rule

(AB)T=BTAT(AB)^T = B^T A^T, not ATBTA^T B^T. Students often forget the reversal.

8. Formula Summary Table

OperationFormulaDimension
Addition(A+B)ij=aij+bij(A + B)_{ij} = a_{ij} + b_{ij}Same m×nm \times n
Scalar multiplication(cA)ij=caij(cA)_{ij} = c \cdot a_{ij}Same m×nm \times n
Matrix multiplication(AB)ij=kaikbkj(AB)_{ij} = \sum_k a_{ik} b_{kj}m×pm \times p (if AA is m×nm \times n , BB is n×pn \times p )
Transpose(AT)ij=aji(A^T)_{ij} = a_{ji}n×mn \times m
Matrix × vector(Ax)i=jaijxj(A\mathbf{x})_i = \sum_j a_{ij} x_jm×1m \times 1

9. 📝 Practice Questions

Q1: Matrix addition
>A=[2103]>> A = \begin{bmatrix} 2 & -1 \\ 0 & 3 \end{bmatrix} >
,
>B=[2143]>> B = \begin{bmatrix} -2 & 1 \\ 4 & -3 \end{bmatrix} >
. Compute A+BA + B and ABA - B.
Strategy: Add/subtract corresponding entries.
Solution:
>A+B=[2+(2)1+10+43+(3)]=[0040]>> A + B = \begin{bmatrix} 2+(-2) & -1+1 \\ 0+4 & 3+(-3) \end{bmatrix} = \begin{bmatrix} 0 & 0 \\ 4 & 0 \end{bmatrix} >
>AB=[2(2)11043(3)]=[4246]>> A - B = \begin{bmatrix} 2-(-2) & -1-1 \\ 0-4 & 3-(-3) \end{bmatrix} = \begin{bmatrix} 4 & -2 \\ -4 & 6 \end{bmatrix} >
Q2: Matrix multiplication
>A=[1021]>> A = \begin{bmatrix} 1 & 0 \\ 2 & -1 \end{bmatrix} >
,
>B=[3102]>> B = \begin{bmatrix} 3 & 1 \\ 0 & -2 \end{bmatrix} >
. Compute ABAB and BABA.
Strategy: Use dot product of rows with columns.
Solution:
>AB=[1(3)+0(0)1(1)+0(2)2(3)+(1)(0)2(1)+(1)(2)]=[3164]>> AB = \begin{bmatrix} 1(3)+0(0) & 1(1)+0(-2) \\ 2(3)+(-1)(0) & 2(1)+(-1)(-2) \end{bmatrix} = \begin{bmatrix} 3 & 1 \\ 6 & 4 \end{bmatrix} >
>BA=[3(1)+1(2)3(0)+1(1)0(1)+(2)(2)0(0)+(2)(1)]=[5142]>> BA = \begin{bmatrix} 3(1)+1(2) & 3(0)+1(-1) \\ 0(1)+(-2)(2) & 0(0)+(-2)(-1) \end{bmatrix} = \begin{bmatrix} 5 & -1 \\ -4 & 2 \end{bmatrix} >
Note: ABBAAB \neq BA — matrices do not commute. Q3: Matrix-vector product
Compute AxA\mathbf{x} where
>A=[120103]>> A = \begin{bmatrix} 1 & 2 & 0 \\ -1 & 0 & 3 \end{bmatrix} >
and
>x=[211]>> \mathbf{x} = \begin{bmatrix} 2 \\ 1 \\ -1 \end{bmatrix} >
.
Strategy: Linear combination of columns of AA using entries of x\mathbf{x}.
Solution:
>Ax=2[11]+1[20]+(1)[03]=[22]+[20]+[03]=[45]>> A\mathbf{x} = 2\begin{bmatrix}1\\-1\end{bmatrix} + 1\begin{bmatrix}2\\0\end{bmatrix} + (-1)\begin{bmatrix}0\\3\end{bmatrix} = \begin{bmatrix}2\\-2\end{bmatrix} + \begin{bmatrix}2\\0\end{bmatrix} + \begin{bmatrix}0\\-3\end{bmatrix} = \begin{bmatrix}4\\-5\end{bmatrix} >
Q4: Transpose properties
Verify (AB)T=BTAT(AB)^T = B^T A^T for
>A=[1234]>> A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} >
,
>B=[0110]>> B = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix} >
.
Strategy: Compute both sides independently.
Solution:
>AB=[2143],(AB)T=[2413]>> AB = \begin{bmatrix} -2 & 1 \\ -4 & 3 \end{bmatrix},\quad (AB)^T = \begin{bmatrix} -2 & -4 \\ 1 & 3 \end{bmatrix} >
>AT=[1324],BT=[0110],BTAT=[2413]>> A^T = \begin{bmatrix} 1 & 3 \\ 2 & 4 \end{bmatrix},\quad B^T = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix},\quad B^T A^T = \begin{bmatrix} -2 & -4 \\ 1 & 3 \end{bmatrix} >
They match! ✓ Q5: Symmetric matrix check
Is
>A=[123245356]>> A = \begin{bmatrix} 1 & 2 & 3 \\ 2 & 4 & 5 \\ 3 & 5 & 6 \end{bmatrix} >
symmetric?
Strategy: Check if A=ATA = A^T (i.e., aij=ajia_{ij} = a_{ji}).
Solution: a12=2=a21a_{12} = 2 = a_{21}, a13=3=a31a_{13} = 3 = a_{31}, a23=5=a32a_{23} = 5 = a_{32}. Yes, it is symmetric. Q6: System to matrix form
Write the system as Ax=bA\mathbf{x} = \mathbf{b}:
>{2x3y+z=5x+y2z=03x+2y+4z=1>> \begin{cases} 2x - 3y + z = 5 \\ x + y - 2z = 0 \\ 3x + 2y + 4z = -1 \end{cases} >
Solution:
>[231112324][xyz]=[501]>> \begin{bmatrix} 2 & -3 & 1 \\ 1 & 1 & -2 \\ 3 & 2 & 4 \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix} = \begin{bmatrix} 5 \\ 0 \\ -1 \end{bmatrix} >
Q7: Diagonal matrix multiplication
If D=diag(2,1,3)D = \text{diag}(2, -1, 3) and
>A=[102311011]>> A = \begin{bmatrix} 1 & 0 & 2 \\ 3 & 1 & -1 \\ 0 & 1 & 1 \end{bmatrix} >
, compute DADA and ADAD.
Strategy: DD times AA scales rows of AA; AA times DD scales columns of AA.
Solution:
>DA=[2(1)2(0)2(2)1(3)1(1)1(1)3(0)3(1)3(1)]=[204311033]>> DA = \begin{bmatrix} 2(1) & 2(0) & 2(2) \\ -1(3) & -1(1) & -1(-1) \\ 3(0) & 3(1) & 3(1) \end{bmatrix} = \begin{bmatrix} 2 & 0 & 4 \\ -3 & -1 & 1 \\ 0 & 3 & 3 \end{bmatrix} >
>AD=[1(2)0(1)2(3)3(2)1(1)1(3)0(2)1(1)1(3)]=[206613013]>> AD = \begin{bmatrix} 1(2) & 0(-1) & 2(3) \\ 3(2) & 1(-1) & -1(3) \\ 0(2) & 1(-1) & 1(3) \end{bmatrix} = \begin{bmatrix} 2 & 0 & 6 \\ 6 & -1 & -3 \\ 0 & -1 & 3 \end{bmatrix} >
Q8: Zero divisors
Find A,B0A, B \neq 0 such that AB=0AB = 0.
Strategy: Try a matrix with a row of zeros, or use projection matrices.
Solution:
>A=[1020],B=[0011]>> A = \begin{bmatrix} 1 & 0 \\ 2 & 0 \end{bmatrix},\quad B = \begin{bmatrix} 0 & 0 \\ 1 & 1 \end{bmatrix} >
>AB=[1(0)+0(1)1(0)+0(1)2(0)+0(1)2(0)+0(1)]=[0000]>> AB = \begin{bmatrix} 1(0)+0(1) & 1(0)+0(1) \\ 2(0)+0(1) & 2(0)+0(1) \end{bmatrix} = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} >
Both AA and BB are non-zero, yet their product is zero! Q9: Idempotent matrix
A matrix PP is idempotent if P2=PP^2 = P. Show that
>P=[1000]>> P = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} >
is idempotent.
Solution:
>P2=[1000][1000]=[1(1)+0(0)1(0)+0(0)0(1)+0(0)0(0)+0(0)]=[1000]=P>> P^2 = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} = \begin{bmatrix} 1(1)+0(0) & 1(0)+0(0) \\ 0(1)+0(0) & 0(0)+0(0) \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 0 \end{bmatrix} = P >
Q10: Trace of a matrix
The trace of a square matrix AA is tr(A)=iaii\text{tr}(A) = \sum_i a_{ii}. Compute tr(A)\text{tr}(A) for
>A=[123456789]>> A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix} >
. Also show tr(AB)=tr(BA)\text{tr}(AB) = \text{tr}(BA) for 2×22 \times 2 matrices.
Solution: tr(A)=1+5+9=15\text{tr}(A) = 1 + 5 + 9 = 15.
For A,BA, B 2×22 \times 2:
>tr(AB)=a11b11+a12b21+a21b12+a22b22>> \text{tr}(AB) = a_{11}b_{11} + a_{12}b_{21} + a_{21}b_{12} + a_{22}b_{22} >
>tr(BA)=b11a11+b12a21+b21a12+b22a22>> \text{tr}(BA) = b_{11}a_{11} + b_{12}a_{21} + b_{21}a_{12} + b_{22}a_{22} >
These are the same four terms in a different order, so tr(AB)=tr(BA)\text{tr}(AB) = \text{tr}(BA). ✓

🔗 Cross-References

  • Next topic: Determinants — a single number that captures key properties of a square matrix
  • Week 2 (Gaussian Elimination): Row operations transform matrices into simpler forms
  • Week 7 (Similarity): Two matrices can represent the same linear transformation in different bases
  • BSMA1001 (Maths 1): Matrix methods for solving systems
  • BSCS2004 (ML Foundations): Design matrices, feature matrices, weight matrices
  • BSCS3004 (Deep Learning): Neural network weights are matrices; backpropagation uses matrix calculus Join Discord Previous1.1 Vectors IntroductionNext1.3 Determinants
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.