Special Matrix Operations

Info sheet · Statistics for Psychology & Neuroscience

Author

Andrew Bell

Published

August 13, 2026

Info sheet 0.2 (draft) · Prerequisites: matrix algebra basics (multiplication) · Give feedback ↗

Working notes for the author — not shown to students once collapsed; remove before publishing.

  • [ ]

What you’ll get from this sheet

A few tricks with matrices. On their own they look abstract, but combined with the operations from last sheet they let us do some genuinely useful things (which pay off after reading week). By the end you should be able to:

  1. Transpose a matrix, and say why you’d need to.
  2. Recognise the identity matrix and its “matrix equivalent of 1” property.
  3. Invert a 2×2 matrix by hand, and say when an inverse doesn’t exist.

Transpose (\(A^{\mathsf T}\)) flips rows and columns. The identity \(I\) is the matrix version of “1” — \(AI = A\). The inverse \(A^{-1}\) undoes \(A\) so that \(AA^{-1} = I\) — but it only exists for a square, non‑singular matrix (one whose determinant ≠ 0).

Transpose

Because matrix operations have such strict size and orientation rules, we often need to quickly “rotate” a matrix to make things fit. Want to multiply an M×N by a P×N? You can’t — but transpose the second and you’ve got an M×N by an N×P, which works. Transposition reflects a matrix along its top‑left‑to‑bottom‑right diagonal: rows become columns and columns become rows, so a 4×3 becomes a 3×4. Transpose twice and you’re back where you started. We mark it with a superscript \(\mathsf T\); in R it’s t(), in MATLAB an apostrophe '.

The identity matrix

The identity matrix is any square (n×n) matrix with 1s down the diagonal and 0s everywhere else. Its headline property: any matrix multiplied by the appropriately sized identity gives itself back — it’s the matrix equivalent of 1 (anything × 1 is itself). We write it \(I\) with a size subscript, so \(I_3\) is the 3×3 identity. In R you make one with diag(n), in MATLAB with eye(n).

Inverse — and the determinant

Recall a scalar fact: any number times its reciprocal equals 1 — \(5 \times \tfrac{1}{5} = 1\) — which we can write \(5 \times 5^{-1}\). That reciprocal is the number’s multiplicative inverse. Matrices have the same idea: the inverse of a matrix is the matrix that, multiplied by the original, gives the identity\(A \times A^{-1} = I\).

For a 2×2 there’s a tidy formula. Label the matrix \(\begin{bmatrix} a & b \\ c & d \end{bmatrix}\); then

\[A^{-1} = \frac{1}{ad - bc}\begin{bmatrix} d & -b \\ -c & a \end{bmatrix}.\]

That fraction’s denominator, \(ad - bc\), is the determinant. Set the four entries below and watch the determinant, the inverse, and the check \(A A^{-1} = I\):

Try a,b,c,d = 2,4,1,2: the determinant collapses to \(4 - 4 = 0\). That matrix is singular — its rows are proportional, so no inverse exists (the formula would divide by zero). For anything bigger than 2×2 the algebra explodes, so we hand it to software: solve() in R, inv() in MATLAB.

See it in code

A = [1 2; 3 4];
A'          % transpose (apostrophe)
eye(2)      % 2x2 identity

inv(A)      % inverse
A * inv(A)  % identity

The R and Python tabs run live; MATLAB is a static reference.

Why can’t you invert \(\begin{bmatrix} 2 & 4 \\ 1 & 2 \end{bmatrix}\)?

Its determinant is \(ad - bc = (2)(2) - (4)(1) = 0\). A zero determinant means the matrix is singular, and the inverse formula would divide by zero — so no inverse exists. Geometrically, the two rows are just scaled copies of each other (the second is half the first), so the matrix squashes information it can’t undo.

Only square matrices can have an inverse, and only if they’re non‑singular (determinant ≠ 0). The neat 2×2 formula (swap \(a\) and \(d\), negate \(b\) and \(c\), divide by the determinant) is a special case — larger matrices need software. Watch for near‑singular matrices too: they technically invert, but unstably — MATLAB warns you the answer is poor, and R often refuses outright. And don’t confuse the transpose with the inverse: \(A^{\mathsf T}\) just reflects the matrix; it doesn’t undo it.

Where this shows up next

After reading week we cash these in on real applications — including where the inverse quietly solves regression (the normal equation) and where the determinant resurfaces in eigen‑analysis. See Appendix (Matrix Algebra) for the full treatment.