The path 1-2–3 has no loops, so A has zeros down its
diagonal. A² does not: its 1,1 entry is
1 and its 2,2 entry is 2. Both are
correct, and both count walks that go out and come back.
Words you need (10 key words in this lesson)
The maths words this lesson uses, in plain English. Open this before you start if English is not your first language.
matrix
A rectangle of numbers in rows and columns.A matrix with 2 rows and 2 columns.
vertex
A corner of a shape. Also, the turning point of a parabola.A triangle has three vertices.
edge
A line where two faces meet. In graph theory, a line joining two points.A cube has twelve edges.
degree
The highest power of x in a polynomial. Also, the unit for measuring angles.The degree of x cubed plus x is 3.
at most
This number or less.At most 5 means 5 or less.
exact
Not rounded. Completely correct.The exact answer is one third, not 0.33.
power
A small raised number that shows how many times to multiply a number by itself.2 to the power 3 is 8.
write down
Give the answer with little or no working.Write down the median.
add
Put numbers together to find the total.Add 3 and 4 to get 7.
hence
Using your last result.Hence find the area means use the previous answer.
Four quick ones from earlier work. Try each on paper before you open the answer.
Work out the product (2, 1; 0, 3)(1, 4; 2, 0), where each bracket lists its rows separated by semicolons.
Answer
(4, 8; 6, 0). Each entry is a row of the first matrix dotted with a column of the second: top left is 2 Ă— 1 + 1 Ă— 2 = 4. Multiplying entry by entry is the slip to watch for.
The vertices of a graph have degrees 3, 2, 2 and 1. How many edges does it have?
Answer
4. The degrees add to 8 and every edge is counted at both of its ends, so there are 8 Ă· 2 edges. This is the handshake lemma.
Write down the adjacency matrix of the triangle in which vertices 1, 2 and 3 are all joined to each other.
Answer
(0, 1, 1; 1, 0, 1; 1, 1, 0). A 1 wherever two different vertices are joined, 0 on the diagonal because no vertex joins itself, and symmetric because the graph is undirected.
Work out the row (1, 0, 2) times the column (3; 5; 4), a single number.
Answer
1 Ă— 3 + 0 Ă— 5 + 2 Ă— 4 = 11. This row-times-column step is what every entry of a matrix power is made of.
Words used in this lesson
adjacency matrix
a square table with a 1 where two vertices are joined and a 0 where they are not. For example: for two vertices joined by one edge, the matrix is (0, 1; 1, 0).
vertex (plural vertices)
a point of a graph, drawn as a dot. For example: a graph with 5 vertices has a 5 by 5 matrix.
edge
a line joining two vertices. For example: the edge between vertices 2 and 4.
degree
the number of edges meeting at a vertex. For example: a vertex with 3 edges has degree 3.
walk
a journey along edges that may go back over the same vertex or edge. For example: 1 → 2 → 1 → 3 is a walk of length 3.
loop
an edge that joins a vertex to itself. For example: a loop adds a 1 on the diagonal.
entry
one number in a matrix, named by its row then its column. For example: the 2,3 entry is in row 2, column 3.
exactly, at most
exactly 3 means 3 and no other number; at most 3 means 3 or fewer. For example: “at most 2 steps” includes walks of 1 step.
interpret
say what a number means in the situation, in a sentence. For example: “there are 7 walks” is an interpretation, “7” alone is not.
hence
use the result you have just found. For example: “find A², and hence find the number of walks”.
0entry 1,1
0entry 2,2
no loopswhat the diagonal says
A is about edges. Its powers are about walks, and a walk
is allowed to leave a vertex and come straight back.
Writing a graph as a matrix
Label the vertices and put a 1 wherever two are joined and a
0 wherever they are not. For the path 1-2–3:
A = (0, 1, 0; 1, 0, 1; 0, 1, 0)
reading row by row, so row 2 says vertex 2 is joined to 1 and to 3.
Three things follow:
It is symmetric for an undirected graph, because
"1 is joined to 2" and "2 is joined to 1" are the same fact. For a
directed graph it is not.
The diagonal is zero when there are no loops,
because no vertex is joined to itself.
Each row sums to that vertex's degree: row 1 sums
to 1, row 2 to 2, row 3 to 1. Degree sum 4, so 2 edges, which is
the handshake lemma again.
The matrix has no drawing in it. Two graphs with the SAME labelling are
identical exactly when their matrices match, which is why this is the form
every algorithm uses. Relabel the vertices and the matrix changes while
the graph does not, so a matrix records a labelled graph rather than a
shape.
The rest of this lesson is in the full course
Still to come in this lesson:
Powers count walks
Weighted tables and transition matrices
A second example, finished by you
Check before you go on
and 5 more
In the full lesson every figure moves as you drag it, and every answer you type is checked, with a note on what each wrong answer means.
IB Diploma plan: AI HL$99Every Diploma lesson in both courses and both levels, so a change of course never locks you out, and every lesson from Year 7 for the refreshers. $99 for 12 months or $149 for 2 years.
One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Pay by card on Gumroad, then come back here and type the email you paid with: we email you a sign-in link. For a refund, reply to your Gumroad receipt or email hello@ksmaths.com.