Leaving Certificate Applied Mathematics2.4 Matrix algebra and the product of adjacency matrices

All books

2.4 Matrix algebra and the product of adjacency matrices — Practise with help

Warm-up: remember

  1. A network has adjacency matrix (011100100)\begin{pmatrix} 0&1&1\\ 1&0&0\\ 1&0&0 \end{pmatrix}. What is the degree of each vertex?
  2. How many edges has it?
Answers and feedback
  1. Row sums: 2,1,12, 1, 1.
  2. ∑deg⁡=4\sum \deg = 4, so E=2E = 2. The edges are 1212 and 1313.

Practise with help

1. Work out (2103)(1110)\begin{pmatrix} 2&1\\ 0&3 \end{pmatrix}\begin{pmatrix} 1&1\\ 1&0 \end{pmatrix}.

Hint

Row times column, four times.

Next step

Row 1, column 1: 2×1+1×12 \times 1 + 1 \times 1.

Full working
  • Row 1, column 1: 2×1+1×1=32 \times 1 + 1 \times 1 = 3
  • Row 1, column 2: 2×1+1×0=22 \times 1 + 1 \times 0 = 2
  • Row 2, column 1: 0×1+3×1=30 \times 1 + 3 \times 1 = 3
  • Row 2, column 2: 0×1+3×0=00 \times 1 + 3 \times 0 = 0
(3230)\begin{pmatrix} 3&2\\ 3&0 \end{pmatrix}

2. A network has adjacency matrix M=(011101110)M = \begin{pmatrix} 0&1&1\\ 1&0&1\\ 1&1&0 \end{pmatrix}. Work out M2M^2.

Hint

Each entry is a row of MM times a column of MM.

Next step

Row 1 of MM is 0,1,10,1,1. Times column 1 (0,1,10,1,1) gives 0+1+1=20 + 1 + 1 = 2.

Full working M2=(211121112)M^2 = \begin{pmatrix} 2&1&1\\ 1&2&1\\ 1&1&2 \end{pmatrix}

Check: the diagonal entries are the degrees. Every vertex here has degree 22, and every diagonal entry is 22. The check passes.

3. For that network, how many walks of length 2 are there from vertex 1 to vertex 2? List them.

Hint

Read the entry in row 1, column 2 of M2M^2.

Next step

The entry is 11. Which middle vertex works?

Full working

The entry in row 1, column 2 of M2M^2 is 11, so there is exactly one walk of length 2 from 1 to 2. It is 1→3→21 \to 3 \to 2: vertex 3 is the only vertex joined to both 1 and 2.

(Vertex 1 itself does not work as a middle vertex, because there is no loop at 1.)

4. For the same network, how many walks of length 3 are there from vertex 1 back to vertex 1?

Hint

You need the diagonal entry of M3M^3. Work out M2×MM^2 \times M.

Next step

M3=M2×MM^3 = M^2 \times M. Row 1 of M2M^2 is 2,1,12,1,1. Times column 1 of MM (0,1,10,1,1).

Full working M3=(211121112)(011101110)=(233323332)M^3 = \begin{pmatrix} 2&1&1\\ 1&2&1\\ 1&1&2 \end{pmatrix}\begin{pmatrix} 0&1&1\\ 1&0&1\\ 1&1&0 \end{pmatrix} = \begin{pmatrix} 2&3&3\\ 3&2&3\\ 3&3&2 \end{pmatrix}

The diagonal entry for vertex 1 is 22, so there are 2 walks of length 3 from 1 back to

  1. They are 1→2→3→11 \to 2 \to 3 \to 1 and 1→3→2→11 \to 3 \to 2 \to 1: round the triangle in either direction.

5. A student multiplies two matrices and gets a different answer from their classmate. The classmate says "matrix multiplication is not commutative". Explain what that means, with an example, and say which order is right.

Hint

Try (1101)(1011)\begin{pmatrix} 1&1\\ 0&1 \end{pmatrix}\begin{pmatrix} 1&0\\ 1&1 \end{pmatrix} and then swap them.

Next step

Work out both products and compare.

Full working

"Not commutative" means ABAB is usually not equal to BABA: swapping the two matrices changes the answer.

(1101)(1011)=(2111)\begin{pmatrix} 1&1\\ 0&1 \end{pmatrix}\begin{pmatrix} 1&0\\ 1&1 \end{pmatrix} = \begin{pmatrix} 2&1\\ 1&1 \end{pmatrix}

but

(1011)(1101)=(1112)\begin{pmatrix} 1&0\\ 1&1 \end{pmatrix}\begin{pmatrix} 1&1\\ 0&1 \end{pmatrix} = \begin{pmatrix} 1&1\\ 1&2 \end{pmatrix}

Different. So neither order is "right" in general — the order is part of the question, and you must multiply the way it is written. For an adjacency matrix, M2M^2 means M×MM \times M, which is unambiguous because it is the same matrix twice.

6. Explain why the number of walks of length 2 from a vertex back to itself is the degree of that vertex.

Hint

A walk of length 2 out and back uses one edge twice.

Next step

How many choices of edge do you have on the way out?

Full working

A walk of length 2 from vv back to vv must go v→u→vv \to u \to v for some neighbour uu, using the same edge twice. There is one such walk for each edge at vv, so the number of them is the degree of vv.

In the matrix this is the diagonal entry Mvv2=∑kMvkMkvM^2_{vv} = \sum_k M_{vk} M_{kv}, and since the network is undirected Mvk=MkvM_{vk} = M_{kv}, so this is ∑kMvk\sum_k M_{vk} — the row sum, which is the degree. So the check "diagonal of M2M^2 equals the degree" is not a coincidence; it is the same fact twice.

A question from Section 2.3

7. The adjacency matrix of a network is M=(010101010)M = \begin{pmatrix} 0&1&0\\ 1&0&1\\ 0&1&0 \end{pmatrix}. Write down the network, then find the number of walks of length 2 from vertex 1 to vertex 3.

Hint

Read the edges off the matrix first — it is quicker than guessing.

Next step

The 11s are at (1,2)(1,2), (2,1)(2,1), (2,3)(2,3), (3,2)(3,2): edges 1212 and 2323.

Full working

The network is a path 1−2−31 - 2 - 3: edges 1212 and 2323.

M2=(101020101)M^2 = \begin{pmatrix} 1&0&1\\ 0&2&0\\ 1&0&1 \end{pmatrix}

The entry in row 1, column 3 is 11, so there is exactly one walk of length 2 from 1 to 3: 1→2→31 \to 2 \to 3.

Notice that vertices 1 and 3 are not joined, yet there is a walk of length 2 between them. That is the point of the rule: it finds connections through intermediate vertices, which is what a route is.

8. A network has 4 vertices, and M2M^2 has every entry equal to 22. How many walks of length 2 are there in the whole network? What does this say about the network?

Hint

Add all the entries of M2M^2.

Next step

There are 4×4=164 \times 4 = 16 entries, each 22.

Full working

The total of all the entries is 16×2=3216 \times 2 = 32, so there are 32 walks of length 2 in the network.

Every off-diagonal entry being 22 means every pair of distinct vertices is joined by exactly two walks of length 2 — so every pair has a common neighbour, and in fact two of them. Every diagonal entry being 22 means every vertex has degree 22. A network in which every vertex has degree 22 and every pair has two length-2 walks is not possible on 4 vertices without multiple edges, which is worth noticing: the question describes a matrix, and the matrix may not describe a simple network. That is a reminder that a matrix can be written down whether or not it comes from a drawing.

Settings

Colour scheme

Light or dark pages. Your colour and layout stay the same.

Colour

The paper, ink and lettering. Your layout stays the same.

Quiet colours
Bold colours
Layout

How pages are arranged. Your colours stay the same.

Reading offline

Keep this book on this device and read it offline.