Binary and permutation matrices
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.
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\).
Binary matrix, and summing with a column or row of \(1\)s:
Permutation matrix \(P\) (square, binary, one \(1\) in each row and each column):
Inverse and powers:
Coding and decoding a row matrix \(W\):
Is it a permutation matrix?
- Is it square, with every element \(0\) or \(1\)?
- Does every row contain exactly one \(1\)?
- Does every column contain exactly one \(1\)? (Rows alone are not enough.)
Building \(P\) to put a list in order
- Write the required new order (for example highest to lowest).
- 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.
- Check: \(PT\) (with the column matrix \(T\) on the right) should list the items in the new order.
Reordering, coding and undoing
- \(P\) on the left moves rows; \(P\) on the right moves columns. Check one element by row times column.
- To code a row matrix \(W\), find \(C = WP\) and turn the numbers back into letters.
- To undo any reordering, use \(P^T\) on the same side: \(P^T(PA) = A\) and \((WP)P^T = W\).
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.
| \(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}\) |
(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.
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}\) |
(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\).
\(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}\) |
\(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\).
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}\) |
(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
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.