topic badge
AustraliaVIC
VCE 12 General 2023

7.05 Binary and permutation matrices

Lesson

Binary and permutation matrices

A binary matrix contains elements that are either 0 or 1.

So for instance, this means that \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} , and \begin{bmatrix} 1 & 1 & 1 \\ 0 & 0 & 0 \end{bmatrix}are all binary matrices.

A permutation matrix of order n is an n \times n (square) binary matrix with every row and column containing exactly one 1, with all other elements 0.

In other words, a permutation matrix is either the identity matrix or else the identity matrix with one or more rows swapped around.

Here are some examples:

\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}, \begin{bmatrix} 0 & 0 & 1\\ 0 & 1 & 0\\ 1 & 0 & 0 \end{bmatrix}, \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 1 & 0 & 0 \end{bmatrix}

Note most importantly that, above and below, or to the left and to the right, of each occurrence of 1 are zeros. Each 1 has its own row and column.

Idea summary

A binary matrix contains elements that are either 0 or 1.

A permutation matrix is a square binary matrix with every row and column containing exactly one 1, with all other elements 0.

Rearrange things with permutation matrices

The word permutation refers to a specific order or arrangement and stems from the Latin word "mutare" meaning to change or mutate. This is exactly what happens when we apply a permutation matrix to a column matrix.

Look at this matrix product:

\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} a \\ b \\ c \end{bmatrix}= \begin{bmatrix} b \\ c \\ a \end{bmatrix}

Notice how the position of the 1's in the permutation matrix dictates the re-ordering of the elements in the column matrix.

We know that there are six possible orderings of the letters a,b, and c given as:

abcacbbacbcacabcba

Corresponding to these are the six order 3 permutation matrices given as:

P_1= \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}, P_2= \begin{bmatrix} 1 & 0 & 0\\ 0 & 0 & 1 \\ 0 & 1 & 0 \end{bmatrix}, P_3= \begin{bmatrix} 0 & 1 & 0\\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}

P_4= \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{bmatrix}, P_5= \begin{bmatrix} 0 & 0 & 1\\ 1 & 0 & 0 \\ 0 & 1 & 0 \end{bmatrix}, P_6= \begin{bmatrix} 0 & 0 & 1\\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{bmatrix}

Each of these matrices can be applied to the ordered triple abc (written as a column matrix) to produce one of the six arrangements of the letters.

Consider the product given as P_3 \begin{bmatrix} a \\ b \\ c \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0\\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} a \\ b \\ c \end{bmatrix} = \begin{bmatrix} b \\ a \\ c \end{bmatrix} .

The position of the 1's in P_3 mean that b is picked up first (only because the 1 is in the middle position in the top row), then a is picked up second (the 1 is in the first position of the second row) and then finally c is picked up third (the 1 is in the third position in the third row).

This insight of positioning simplifies the task of multiplication with permutation matrices. We'll see that this idea can be applied in other instances.

Examples

Example 1

The following questions relate to permutation matrices.

a

How many possible orderings are there of the letters a,b, and c?

Worked Solution
Create a strategy

Possible ordering means finding the permutation, n!, where n is the number of items.

Apply the idea
\displaystyle \text{Number of orderings}\displaystyle =\displaystyle 3!Substitute n=3
\displaystyle =\displaystyle 3 \times 2 \times 1Evaluate the factorial
\displaystyle =\displaystyle 6Evaluate
b

How many permutation matrices of order 3 are there?

Worked Solution
Create a strategy

The permutation matrices of order n is the number of orderings that can be used to arrange items.

Apply the idea

We found from part (a) that the number of orderings to arrange the 3 letters is 6.

So, the permutation matrices of order 3 is 6.

c

Four of the six permutation matrices of order 3 are shown below. Complete the remaining two permutation matrices:

\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 0 & 1 & 0\\ 1 & 0 & 0\\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 0 & 0 & 1\\ 0 & 1 & 0\\ 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0\\ 0 & 0 & 1\\ 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} 0 & 1 & 0\\ ⬚ & ⬚ & ⬚\\ ⬚ & ⬚ & ⬚ \end{bmatrix} \begin{bmatrix} ⬚ & ⬚ & ⬚\\ ⬚ & ⬚ & ⬚\\ ⬚ & ⬚ & ⬚ \end{bmatrix}

Worked Solution
Create a strategy

Look for the matrix that has the same first row to make different arrangements for the next rows and columns.

Apply the idea

Since the fifth matrix has the same first row as the second matrix, we need to change the locations of 1's to make it different.

Second row of second matrix has 1 in the first column, so we need to write it to the third column.

Third row of second matrix has 1 in the third column, so we need to write it to the first column.

\begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 1 & 0 & 0 \end{bmatrix}

Since the first and fourth matrices has the same first rows, we are going to copy the first row of the third matrix into the sixth matrix.

\begin{bmatrix} 0 & 0 & 1\\ ⬚ & ⬚ & ⬚\\ ⬚ & ⬚ & ⬚ \end{bmatrix}

Second row of third matrix has 1 in the second column, so we need to write it to the first column.

Third row of third matrix has 1 in the first column, so we need to write it to the second column.

\begin{bmatrix} 0 & 0 & 1\\ 1 & 0 & 0\\ 0 & 1 & 0 \end{bmatrix}

The six permutation matrices of order 3 are:

\begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 0 & 1 & 0\\ 1 & 0 & 0\\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} 0 & 0 & 1\\ 0 & 1 & 0\\ 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0\\ 0 & 0 & 1\\ 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1\\ 1 & 0 & 0 \end{bmatrix} \begin{bmatrix} 0 & 0 & 1\\ 1 & 0 & 0\\ 0 & 1 & 0 \end{bmatrix}

Idea summary

We can quickly find the possible order of matrices by using permutation, n!, where n is the number of items to be arranged.

We can rearrange the elements of possible matrices by changing the locations of 1's in each row and column.

Permutation matrix products

We could extend this idea by considering products of the permutation matrices amongst themselves.

For example, we notice that for any P_i for i=1 to 6, we have that P_1\times P_i=P_i, simply because P_1 is the identity matrix.

But what about other products? Products like P_2\times P_3 or P_4\times P_6.

For the product P_2\times P_3 we have:

\begin{bmatrix} 1 & 0 & 0\\ 0 & 0 & 1 \\ 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} 0 & 1 & 0\\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0\\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{bmatrix}

The multiplication is very easy once you understand what is happening. You may need to read the following logic a few times, but it is worth it, particularly when you have many products to calculate:

  • We start in the usual way with the first row of P_2 and the first column of P_3. We then notice that the two zeros in the first row of P_2 eliminate whatever numbers are in the second and third positions of the first column of P_3. In other words the (1,1)–element of P_3 is being selected for the (1,1)–element in the product.

    This image shows the matrices above highliting each one's first element.

    1 selects 0 to place in the (1,1)–element in the product.

  • Similarly, in row 2 of P_2, the 1 occurs at the end of the row. This means that the third element of column 1 of P_3 is being selected for the (2,1)–element of the product.

    This image shows the matrices above highlighting elements. Ask your teacher for more information.

    1 selects 0 to place in the (2,1)–element in the product.

  • Finally, in row 3 of P_2, the 1 occurs in the second position, and so the second row of column 1 of P_3 is being selected for the (3,1)–element of the product.

    This image shows the matrices above highlighting elements. Ask your teacher for more information.

    1 selects 1 to place in the (3,1)–element in the product.

Multiplying the six permutation matrices by themselves means we can generate a table of 36 products. There is not the space to show all 36 products in the table, but there is one thing to realise before we start.

If all we are doing through multiplication is swapping the position of the rows, then every single product we generate must also be a permutation matrix. Look back and see, for example, that P_2\times P_3=P_4.

This means that the table of products is a table of permutation matrices.

Examples

Example 2

Consider the matrix M and permutation matrix P given below.

M= \begin{bmatrix} 9 & -7 & 8 \\ 3 & -2 & 1\\ -5 & 6 & 4 \end{bmatrix} P= \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & 1\\ 0 & 1 & 0 \end{bmatrix}

a

Find the resulting matrix R=PM.

Worked Solution
Create a strategy

Use matrix multiplication, cancelling out the elements that will be multiplied by 0.

Apply the idea
\displaystyle R\displaystyle =\displaystyle \begin{bmatrix} 1 & 0 & 0 \\ 0 & 0 & 1\\ 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} 9 & -7 & 8 \\ 3 & -2 & 1 \\ -5 & 6 & 4 \end{bmatrix} Multiply matrix P by matrix M
\displaystyle =\displaystyle \begin{bmatrix} 1\times 9 & 1\times -7 & 1\times 8 \\ 1\times -5 & 1\times 6 & 1\times 4 \\ 1\times 3 & 1\times -2 & 1\times 1 \end{bmatrix} Multiply the elements corresponding to 1
\displaystyle =\displaystyle \begin{bmatrix} 9 & -7 & 8 \\ -5 & 6 & 4 \\ 3 & -2 & 1 \end{bmatrix} Evaluate each element
b

Is the resulting matrix R a column permutation or a row permutation?

Worked Solution
Create a strategy

It is a row permutation if the non-binary matrix swapped its rows in the product matrix, while it is a column permutation if the non-binary matrix swapped its column in the product matrix.

Apply the idea

We can see that the second and third rows of matrix M swapped in matrix R.

M= \begin{bmatrix} 9 & -7 & 8 \\ 3 & -2 & 1 \\ -5 & 6 & 4 \end{bmatrix} \to R= \begin{bmatrix} 9 & -7 & 8 \\ -5 & 6 & 4 \\ 3 & -2 & 1 \end{bmatrix}

So, matrix R is a row permutation.

Idea summary

We can generate quickly the product matrix of two permutation matrices by multiplying the elements and putting their product to the corresponding row of first matrix and column of second matrix.

A product matrix is a row permutation if its rows are resulting from swapping the rows of the non-binary matrix being multiplied.

A product matrix is a column permutation if its rows are resulting from swapping the column of the non-binary matrix being multiplied.

Outcomes

U4.AoS2.3

communication and dominance matrices and their application

What is Mathspace

About Mathspace