Skip to main content

Matrix applications and networks (SACE Stage 2 General Mathematics)

Syllabus dot point

“Represent networks with adjacency matrices and use matrix powers to count walks of a given length between vertices.”

8 min read

Quick answer

An adjacency matrix records the direct links of a network: entry in row ii, column jj counts the edges from vertex ii to vertex jj. The matrix power AnA^n gives the number of walks of length exactly nn between each pair of vertices.

Jump to a section
  1. What this dot point is asking
  2. Building an adjacency matrix
  3. Counting two-step walks with matrix powers
  4. Reading the diagonal and the row sums
  5. Why matrix powers count walks
  6. Directed networks and dominance
  7. Direct plus indirect connections
  8. Exam-style questions

What this dot point is asking

You must build an adjacency matrix from a graph, interpret its entries, and use A2A^2 or higher powers to count multi-step connections.

Building an adjacency matrix

A network (graph) has vertices joined by edges. Its adjacency matrix AA is square, with one row and one column per vertex. Each entry counts the edges joining that pair of vertices.

For an undirected network the matrix is symmetric (a link from AA to BB is also a link from BB to AA). For a directed network the entry in row ii, column jj counts only edges pointing from ii to jj, so the matrix need not be symmetric.

Adjacency matrix

For a network with vertices labelled 1,2,…,n1, 2, \dots, n, the adjacency matrix AA is the n×nn \times n matrix whose entry aija_{ij} is the number of edges joining vertex ii to vertex jj.

Worked example

Adjacency matrix of a road map

Towns P, Q, R have direct roads: P to Q, Q to R, and P to R. Write the adjacency matrix.

Order the rows and columns P, Q, R. Each direct road gives a 1 in both symmetric positions (undirected), and there are no roads from a town to itself, so the diagonal is 0:

A=[011101110]A = \begin{bmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix}

Counting two-step walks with matrix powers

A walk of length 2 uses two edges, passing through one intermediate vertex. The entry of A2A^2 in row ii, column jj counts exactly these two-edge walks from ii to jj.

Powers count walks

The entry in row ii, column jj of AnA^n gives the number of walks of length exactly nn from vertex ii to vertex jj. So A2A^2 counts two-step routes, A3A^3 counts three-step routes, and so on.

Worked example

Two-step routes between towns

Using AA from the road map above, find how many two-step routes go from P to R.

Square the matrix:

A2=[011101110][011101110]=[211121112]A^2 = \begin{bmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix}\begin{bmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix} = \begin{bmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{bmatrix}

The entry in row P (row 1), column R (column 3) is 11. So there is one two-step route from P to R: the route P to Q to R.

Reading the diagonal and the row sums

The diagonal entries of A2A^2 count two-step walks that return to the starting vertex. In the example each diagonal entry is 2, because each town can reach two others and come straight back, giving two such loops.

Row sums of AA are also useful: in an undirected network the sum of row ii gives the degree of vertex ii, the number of edges meeting it.

Match labels to rows and columns

Always write the vertex labels beside the rows and above the columns. When you read an answer like "row P, column R", you can pick out the correct entry instead of guessing which number applies.

Why matrix powers count walks

The walk-counting property follows directly from how matrix multiplication works. The entry in row ii, column jj of A2A^2 is the sum over every intermediate vertex kk of aikakja_{ik}a_{kj} - the number of edges from ii to kk times the number from kk to jj. Each such product counts the two-edge routes that pass through kk, and summing over all kk counts every two-step walk from ii to jj. The same reasoning extends to higher powers: A3A^3 sums over all pairs of intermediate vertices, so it counts three-step walks, and so on. Understanding this explains why the technique works rather than treating it as a rule to memorise.

Directed networks and dominance

For a directed network, where edges have a direction, the adjacency matrix is generally not symmetric, and its powers count directed walks that respect the arrows. A common application is a dominance matrix for a round-robin competition, where aij=1a_{ij} = 1 if player ii beat player jj. The row sums of AA give first-order dominance (direct wins), and the row sums of A+A2A + A^2 combine direct wins with "wins over someone who beat someone", giving an overall ranking. This is a standard SACE context for adjacency matrices beyond simple road maps.

Direct plus indirect connections

A common task is to add matrices to combine route lengths. For example, A+A2A + A^2 gives the number of routes of length 1 or 2 between each pair of vertices, useful for asking "in how many ways can I get from P to R in at most two steps?"

Common mistake

Do not confuse the adjacency matrix AA (direct links only) with its powers. The entry "1" in AA from P to R means a direct road, but a "1" in A2A^2 means a two-step route. Also remember to square the matrix using proper matrix multiplication, not by squaring each entry individually.

Exam-style questions

Questions in the style of SACE Board exam questions on this dot point, each with a worked answer. They are written by ExamExplained unless tagged "Past paper"; the year shows the paper a question is modelled on.

Practice4 marks
Calculator-assumed. Towns P, Q, R have direct roads P to Q, Q to R and P to R, with the adjacency matrix A=[011101110]A = \begin{bmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix}. (a) Find A2A^2. (b) State how many two-step routes go from P to R and describe one.
Show worked answer →

(a) A2=[211121112]A^2 = \begin{bmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{bmatrix}. (2 marks)

(b) The entry in row P (row 1), column R (column 3) of A2A^2 is 11, so there is one two-step route: P to Q to R. (2 marks)

Marks: two for squaring the matrix, two for reading the correct entry and describing the route.

Practice3 marks
Calculator-assumed. For the adjacency matrix A=[011101110]A = \begin{bmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix}, find the number of routes of length 1 or 2 from Q to R using A+A2A + A^2.
Show worked answer →

A+A2=[011101110]+[211121112]=[222222222]A + A^2 = \begin{bmatrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{bmatrix} + \begin{bmatrix} 2 & 1 & 1 \\ 1 & 2 & 1 \\ 1 & 1 & 2 \end{bmatrix} = \begin{bmatrix} 2 & 2 & 2 \\ 2 & 2 & 2 \\ 2 & 2 & 2 \end{bmatrix}. [2 marks]

The entry in row Q (row 2), column R (column 3) is 22, so there are 2 routes of length at most 2 from Q to R (the direct road Q to R, and Q to P to R). [1 mark]

Practise this

Sources & how we know this

ExamExplained