Resources For Teachers For Tutors For Students & Parents AI New Books Pricing
Year 12 Maths - General (Unit 3 & Unit 4) Matrices and their applications

Binary and permutation matrices

20 practice questions 0 video lessons Theory + worked examples

Explore matrices made of \(0\)s and \(1\)s in Year 12 VCE General Mathematics. A binary matrix answers yes or no questions, such as which Gippsland campgrounds have showers or allow dogs. A permutation matrix goes further: it shuffles rows or columns into a new order, which is how a matrix can rank surfers by score or scramble a secret word.

You will practise writing binary matrices from descriptions and totalling them with summing matrices. You will test whether a matrix is a permutation matrix, find \(PA\) and \(AP\), build \(P\) to sort a list, undo it with \(P^T\), and code and decode messages, ready for communication and dominance matrices next.

Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

Matrices made only of zeros and ones have special uses. This Year 12 General Mathematics guide for students in Victoria shows how to write and total binary matrices, recognise permutation matrices, use them to reorder rows and columns or rank a list, undo a reordering with the transpose, and code a message.

A binary matrix has every element equal to \(0\) or \(1\). It records yes/no information: which shops stock which items, which staff are free on which days, or which places are connected. Multiplying a binary matrix by a column of \(1\)s adds along each row (how many "yes" answers each row has); a row of \(1\)s in front adds down each column. These are called summing matrices.

A permutation matrix is a square binary matrix with exactly one \(1\) in each row and exactly one \(1\) in each column. It is the identity matrix with its rows in a different order (the identity itself counts too). An \(n \times n\) permutation matrix has exactly \(n\) ones.

Permutation matrices reorder things. Multiplying on the left, \(PA\), reorders the rows of \(A\): if row \(i\) of \(P\) has its \(1\) in column \(j\), then row \(i\) of \(PA\) is row \(j\) of \(A\). Multiplying on the right, \(AP\), reorders the columns. The inverse of a permutation matrix is its transpose, \(P^{-1} = P^T\), which puts everything back. Applying the same reordering again and again eventually returns to the start, so some power of \(P\) equals \(I\).

Key idea. Permutation matrix: square, binary, one \(1\) in every row and every column. On the left it shuffles rows, on the right it shuffles columns, and \(P^T\) undoes the shuffle.
Which binary matrices are permutation matricesThree square binary matrices. The first has exactly one 1 in every row and column, so it is a permutation matrix. The second has two 1s in column 2; the third has two 1s in row 3. 0 1 0 0 0 1 1 0 0 yes: permutation 0 1 0 0 1 0 1 0 0 no: two 1s in column 2 1 0 0 0 0 1 0 1 1 no: two 1s in row 3
Only the first matrix is a permutation matrix. Check the rows and the columns.
Multiplying on the left by a permutation matrixP times A. Row 1 of P has its 1 in column 3, so row 1 of PA is row 3 of A; row 2 of PA is row 1 of A; row 3 of PA is row 2 of A. The coloured rows show the new order. 0 0 1 1 0 0 0 1 0 4 7 2 9 6 1 = 6 1 4 7 2 9 the 1 in row i, column j of P puts row j of A into row i
\(PA\): the \(1\) in row 1, column 3 of \(P\) moves row 3 of \(A\) to the top. The other rows follow the same way.

Binary matrix, and summing with a column or row of \(1\)s:

\[b_{ij} \in \{0, 1\}, \qquad B\begin{bmatrix}1\\ \vdots\\ 1\end{bmatrix} = \text{row totals}, \qquad \begin{bmatrix}1 & \cdots & 1\end{bmatrix}B = \text{column totals}\]
BU=row totals

Permutation matrix \(P\) (square, binary, one \(1\) in each row and each column):

\[p_{ij} = 1 \;\Rightarrow\; \text{row } i \text{ of } PA = \text{row } j \text{ of } A, \qquad \text{column } j \text{ of } AP = \text{column } i \text{ of } A\]
PA reorders rows, AP reorders columns

Inverse and powers:

\[P^{-1} = P^T, \qquad PP^T = P^TP = I, \qquad P^k = I \text{ for some power } k\]
P-1=PT

Coding and decoding a row matrix \(W\):

\[C = WP, \qquad W = CP^T\]
C=WP,W=CPT

Is it a permutation matrix?

  1. Is it square, with every element \(0\) or \(1\)?
  2. Does every row contain exactly one \(1\)?
  3. Does every column contain exactly one \(1\)? (Rows alone are not enough.)

Building \(P\) to put a list in order

  1. Write the required new order (for example highest to lowest).
  2. For place \(i\), find the original position \(j\) of the item that goes there. Put a \(1\) in row \(i\), column \(j\) of \(P\), and \(0\)s elsewhere in that row.
  3. Check: \(PT\) (with the column matrix \(T\) on the right) should list the items in the new order.

Reordering, coding and undoing

  1. \(P\) on the left moves rows; \(P\) on the right moves columns. Check one element by row times column.
  2. To code a row matrix \(W\), find \(C = WP\) and turn the numbers back into letters.
  3. To undo any reordering, use \(P^T\) on the same side: \(P^T(PA) = A\) and \((WP)P^T = W\).
Example 1 β€” A binary matrix
Three Gippsland campgrounds list their facilities. Walhalla has showers and campfires. Tidal River has powered sites and showers. Lakes Entrance has powered sites, showers and allows dogs. (i) Write a binary matrix \(B\) with the campgrounds as rows and the columns in the order powered sites, showers, campfires, dogs. (ii) Find \(BU\), where \(U\) is a \(4 \times 1\) column of \(1\)s, and explain it. (iii) Find \(\begin{bmatrix}1 & 1 & 1\end{bmatrix}B\).
Solution

Use \(1\) for yes and \(0\) for no. Multiplying by a column of \(1\)s adds along each row; a row of \(1\)s in front adds down each column.

Binary matrix of campground facilitiesRows Walhalla, Tidal River and Lakes Entrance; columns powered sites, showers, campfires and dogs. Row totals 2, 2, 3; column totals 2, 3, 1, 1. 0 1 1 0 1 1 0 0 1 1 0 1 Walhalla Tidal River Lakes Entrance power shower fire dogs total 2 2 3 total 2 3 1 1
\(B\)\(=\)\(\begin{bmatrix}0 & 1 & 1 & 0\\ 1 & 1 & 0 & 0\\ 1 & 1 & 0 & 1\end{bmatrix}\)
\(BU\)\(=\)\(\begin{bmatrix}0 & 1 & 1 & 0\\ 1 & 1 & 0 & 0\\ 1 & 1 & 0 & 1\end{bmatrix}\begin{bmatrix}1\\ 1\\ 1\\ 1\end{bmatrix}\)
\(\)\(=\)\(\begin{bmatrix}2\\ 2\\ 3\end{bmatrix}\)
\(\begin{bmatrix}1 & 1 & 1\end{bmatrix}B\)\(=\)\(\begin{bmatrix}2 & 3 & 1 & 1\end{bmatrix}\)
BU

(ii) \(BU = \begin{bmatrix}2\\ 2\\ 3\end{bmatrix}\): the number of facilities at each campground (Lakes Entrance has the most, \(3\)). (iii) \(\begin{bmatrix}2 & 3 & 1 & 1\end{bmatrix}\): the number of campgrounds with each facility. All three have showers.

Example 2 β€” Building a permutation matrix
In a Torquay junior surf contest, the scores of Ari, Bec, Cam and Dee are \(S = \begin{bmatrix}16\\ 11\\ 18\\ 14\end{bmatrix}\) (in that order). (i) Find the permutation matrix \(P\) so that \(PS\) lists the scores from highest to lowest. (ii) Find \(PS\). (iii) Which matrix turns \(PS\) back into \(S\)?
Solution

Highest to lowest is Cam (18), Ari (16), Dee (14), Bec (11). Row \(i\) of \(P\) has its \(1\) in the column of the surfer who goes into place \(i\).

\(\text{row 1}\)\(:\)\(\text{Cam is surfer 3} \;\to\; 1 \text{ in column 3}\)
\(\text{row 2}\)\(:\)\(\text{Ari is surfer 1} \;\to\; 1 \text{ in column 1}\)
\(\text{row 3}\)\(:\)\(\text{Dee is surfer 4} \;\to\; 1 \text{ in column 4}\)
\(\text{row 4}\)\(:\)\(\text{Bec is surfer 2} \;\to\; 1 \text{ in column 2}\)
\(P\)\(=\)\(\begin{bmatrix}0 & 0 & 1 & 0\\ 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 1 & 0 & 0\end{bmatrix}\)
\(PS\)\(=\)\(\begin{bmatrix}18\\ 16\\ 14\\ 11\end{bmatrix}\)
\(P^{-1}\)\(=\)\(P^T = \begin{bmatrix}0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 0\end{bmatrix}\)
P-1=PT

(i) \(P\) is shown above; it has exactly one \(1\) in each row and column. (ii) \(PS = \begin{bmatrix}18\\ 16\\ 14\\ 11\end{bmatrix}\). (iii) \(P^T\), because \(P^TP = I\): \(P^T(PS) = S\).

Example 3 β€” Rows or columns?
Let \(P = \begin{bmatrix}0 & 1 & 0\\ 1 & 0 & 0\\ 0 & 0 & 1\end{bmatrix}\) and \(A = \begin{bmatrix}6 & 1 & 8\\ 7 & 5 & 3\\ 2 & 9 & 4\end{bmatrix}\). Find \(PA\) and \(AP\), and describe what each does to \(A\).
Solution

\(P\) is the identity with rows 1 and 2 swapped. On the left it moves rows; on the right it moves columns.

\(PA\)\(=\)\(\begin{bmatrix}7 & 5 & 3\\ 6 & 1 & 8\\ 2 & 9 & 4\end{bmatrix}\)
\(\)\(\)\(\text{rows 1 and 2 of } A \text{ swapped}\)
\(AP\)\(=\)\(\begin{bmatrix}1 & 6 & 8\\ 5 & 7 & 3\\ 9 & 2 & 4\end{bmatrix}\)
\(\)\(\)\(\text{columns 1 and 2 of } A \text{ swapped}\)
Multiplying on the right by a permutation matrixA times P swaps columns 1 and 2 of A. Column 3 is unchanged. 6 1 8 7 5 3 2 9 4 0 1 0 1 0 0 0 0 1 = 1 6 8 5 7 3 9 2 4
PA≠AP

\(PA = \begin{bmatrix}7 & 5 & 3\\ 6 & 1 & 8\\ 2 & 9 & 4\end{bmatrix}\) swaps rows 1 and 2. \(AP = \begin{bmatrix}1 & 6 & 8\\ 5 & 7 & 3\\ 9 & 2 & 4\end{bmatrix}\) swaps columns 1 and 2. Check one element by row times column: row 1 of \(P\) times column 1 of \(A\) is \(0 \times 6 + 1 \times 7 + 0 \times 2 = 7\).

Example 4 β€” Coding a message
Each letter is replaced by its position in the alphabet (\(A = 1, B = 2, \ldots, Z = 26\)). The word SURF is written as a row matrix \(W\) and coded as \(C = WP\), where \(P = \begin{bmatrix}0 & 0 & 1 & 0\\ 0 & 0 & 0 & 1\\ 0 & 1 & 0 & 0\\ 1 & 0 & 0 & 0\end{bmatrix}\). (i) Find \(C\) and the coded word. (ii) Show how the receiver decodes \(C\).
Solution

Each column of \(P\) picks one letter of \(W\). To undo the coding, multiply on the right by \(P^{-1} = P^T\).

\(W\)\(=\)\(\begin{bmatrix}19 & 21 & 18 & 6\end{bmatrix}\)
\(C = WP\)\(=\)\(\begin{bmatrix}6 & 18 & 19 & 21\end{bmatrix}\)
\(\)\(\)\(6, 18, 19, 21 \;\to\; \text{F, R, S, U}\)
\(CP^T\)\(=\)\(WPP^T = W\)
\(\)\(=\)\(\begin{bmatrix}19 & 21 & 18 & 6\end{bmatrix}\)
CPT=W

(i) \(C = \begin{bmatrix}6 & 18 & 19 & 21\end{bmatrix}\), so the coded word is FRSU. (ii) The receiver finds \(CP^T\), because \(PP^T = I\). This gives back \(\begin{bmatrix}19 & 21 & 18 & 6\end{bmatrix}\), which is SURF.

Common pitfalls

Checking only the rows. A binary matrix can have one \(1\) in every row but two \(1\)s in a column. Then it is not a permutation matrix. Check the columns as well.
Left versus right. \(PA\) reorders rows; \(AP\) reorders columns. Watch out for putting \(P\) on the wrong side, and check the product is defined: a \(3 \times 3\) \(P\) cannot multiply a \(2 \times 3\) matrix on the left.
Using \(P\) to decode. Applying \(P\) again scrambles the message further. Undo the coding with \(P^{-1} = P^T\).

Frequently asked questions

What is a binary matrix?

A matrix whose elements are all 0 or 1. It records yes or no information, such as which shops stock which items.

What is a permutation matrix?

A square binary matrix with exactly one 1 in each row and exactly one 1 in each column. It is the identity matrix with its rows rearranged.

What does multiplying by a permutation matrix do?

Multiplying on the left, PA, rearranges the rows of A. Multiplying on the right, AP, rearranges the columns of A. The numbers themselves do not change.

What is the inverse of a permutation matrix?

Its transpose. A permutation matrix times its transpose gives the identity matrix, so the transpose undoes the rearrangement.

How do you add up the rows of a binary matrix with matrices?

Multiply it on the right by a column of 1s. Each element of the answer is the sum of one row. A row of 1s on the left gives the column sums instead.

How are permutation matrices used to code messages?

Write the message as numbers (A = 1 to Z = 26) in a row matrix W and multiply by a permutation matrix to scramble the order: C = WP. The receiver multiplies by the transpose of P to recover W.