Lecture 7: Grids of Numbers

Matrices: organized collections of numbers that encode structure and transformation.

The Hook

Consider this rectangular array:

$$\begin{pmatrix} 0.96 & -0.24 \\ 0.00 & 0.93 \\ 0.00 & 0.00 \end{pmatrix}$$

What is it?

Same grid of numbers. Three different meanings. This is a matrix.

Recognition

ARRANGEMENT: "Order matters."

A matrix is an organized collection of numbers where:

When to Use Matrices

SituationMatrix gives you
"I have several vectors to track"Store as columns (or rows)
"I need to transform vectors"Linear transformation Av
"I have a system of linear equations"Ax = b
"I need to rotate/reflect/scale"Transformation matrix
"I have relational data"Adjacency matrix
"I'm doing quantum mechanics"Operators as matrices

Matrix Fundamentals

Definition: An m × n matrix A is a rectangular array of numbers with m rows and n columns.

The entry in row i, column j is denoted $a_{ij}$ or $A_{ij}$.

Special Matrices

Special Matrix Types

Matrix Operations

Matrix Multiplication

Matrix Multiplication Visualizer

Entry (i,j) of AB = dot product of row i of A with column j of B

Key requirement: Number of columns of A = number of rows of B.

(m × n) · (n × p) = (m × p)

Matrix Multiplication is NOT Commutative

AB vs BA

Matrix A

Matrix B

AB =

BA =

Matrices as Linear Transformations

Transformation Visualizer

Matrix:

Composition of Transformations

Transformation Composer

Combined matrix = Second × First:

The Inverse Matrix

Definition: For a square matrix A, the inverse A⁻¹ (if it exists) satisfies:

$$A^{-1}A = AA^{-1} = I$$

2×2 Inverse Calculator

Matrix A

det(A) = ad - bc = 1

A⁻¹ =

The 2×2 inverse formula:

$$\begin{pmatrix} a & b \\ c & d \end{pmatrix}^{-1} = \frac{1}{ad - bc} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix}$$

Chemistry Connection: Molecular Coordinates

A molecule with N atoms can be stored as a 3 × N matrix — each column is one atom's position.

Molecular Coordinate Transformer

Rotation matrix Rz(θ) transforms all atom positions simultaneously.

Chemistry Connection: Hückel Theory

For π-electron systems, the Hamiltonian in the basis of p-orbitals is encoded as a matrix where diagonal = α (orbital energy) and off-diagonal = β (interaction).

Hückel Matrix Builder

Hückel matrix (α = 0, β = -1):

Summary: Matrix Toolkit

OperationNotationResult Dimensions
AdditionA + BSame as A, B
Scalar multcASame as A
TransposeATSwap m ↔ n
MultiplicationAB(m×n)(n×p) → m×p
InverseA⁻¹Same as A (square)

Exercises

Exercise 1: Matrix Operations

Let A = [[1,2],[3,4]] and B = [[5,6],[7,8]].

(a) Compute AB. (b) Compute BA. (c) Verify AB ≠ BA.

(a) AB = [[1·5+2·7, 1·6+2·8], [3·5+4·7, 3·6+4·8]] = [[19, 22], [43, 50]]

(b) BA = [[5·1+6·3, 5·2+6·4], [7·1+8·3, 7·2+8·4]] = [[23, 34], [31, 46]]

(c) [[19,22],[43,50]] ≠ [[23,34],[31,46]] ✓

Exercise 2: Inverse

Find the inverse of A = [[4,3],[3,2]]. Verify AA⁻¹ = I.

det(A) = 4·2 - 3·3 = 8 - 9 = -1

A⁻¹ = (1/-1)[[2,-3],[-3,4]] = [[-2,3],[3,-4]]

Check: AA⁻¹ = [[4,3],[3,2]][[-2,3],[3,-4]] = [[-8+9, 12-12],[−6+6, 9−8]] = [[1,0],[0,1]] ✓

Exercise 3: Transformation Composition

(a) Write the matrix for reflection across y-axis.

(b) Write the matrix for rotation by 90°.

(c) Find the matrix that first reflects, then rotates.

(a) Reflect y: [[-1,0],[0,1]]

(b) Rotate 90°: [[0,-1],[1,0]]

(c) Combined = Rotate × Reflect = [[0,-1],[1,0]][[-1,0],[0,1]] = [[0,-1],[-1,0]]

This is reflection across y = -x.

Exercise 4: Hückel Matrix

For allyl radical (3 carbons in a row), write the Hückel matrix with α=0, β=-1. What is its trace?

H = [[0,-1,0],[-1,0,-1],[0,-1,0]]

Trace = 0 + 0 + 0 = 0 = 3α ✓