Exercise: reading and combining matrices

Goal

  • Read a matrix: count its rows and columns, and pick out a single entry.
  • Recognise special matrices: the zero matrix, the identity, and diagonal matrices.
  • Combine matrices by addition (same shape) and by scalar multiplication.

The rule

A matrix is a rectangular grid of numbers. We write matrices with a capital letter, like \(A\), and we put the numbers inside square brackets: \[ A = \begin{bmatrix} 2 & 5 \\ 1 & 7 \end{bmatrix}. \]

The size (or dimensions) of a matrix is written as rows × columns. The matrix \(A\) above has \(2\) rows and \(2\) columns, so it is a \(2 \times 2\) matrix. Always say the number of rows first.

A single number inside the matrix is called an entry. We name an entry by its position: \(a_{ij}\) means the entry in row \(i\), column \(j\) (row first, column second). For the matrix \(A\) above:

  • \(a_{11} = 2\) (row 1, column 1),
  • \(a_{12} = 5\) (row 1, column 2),
  • \(a_{21} = 1\) (row 2, column 1),
  • \(a_{22} = 7\) (row 2, column 2).

A matrix with a single row is a row vector, and a matrix with a single column is a column vector. We write vectors with a bold lowercase letter, like \(\mathbf{x}\): \[ \mathbf{x} = \begin{bmatrix} 3 \\ 8 \end{bmatrix} \quad (\text{a column vector, } 2 \times 1), \qquad \mathbf{y} = \begin{bmatrix} 4 & 6 & 9 \end{bmatrix} \quad (\text{a row vector, } 1 \times 3). \]

Some special matrices to recognise:

  • The zero matrix has every entry equal to \(0\).
  • A diagonal matrix has zeros everywhere except possibly on the diagonal (the entries \(a_{11}, a_{22}, a_{33}, \dots\) running top-left to bottom-right).
  • The identity matrix \(I\) is a diagonal matrix whose diagonal entries are all \(1\): \[ I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}. \]

Addition. You can only add two matrices if they have the same size. Just add the numbers in matching positions: \[ \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} + \begin{bmatrix} 5 & 0 \\ 1 & 2 \end{bmatrix} = \begin{bmatrix} 1+5 & 2+0 \\ 3+1 & 4+2 \end{bmatrix} = \begin{bmatrix} 6 & 2 \\ 4 & 6 \end{bmatrix}. \]

Scalar multiplication. A plain number multiplying a matrix is called a scalar. Multiply every entry by that number: \[ 3 \cdot \begin{bmatrix} 1 & 2 \\ 4 & 0 \end{bmatrix} = \begin{bmatrix} 3\cdot 1 & 3\cdot 2 \\ 3\cdot 4 & 3\cdot 0 \end{bmatrix} = \begin{bmatrix} 3 & 6 \\ 12 & 0 \end{bmatrix}. \]

Problems

Reading dimensions and entries.

1. What are the dimensions (rows × columns) of \(\begin{bmatrix} 4 & 1 \\ 0 & 2 \end{bmatrix}\)?

2. What are the dimensions of \(\begin{bmatrix} 7 & 3 & 5 \end{bmatrix}\)?

3. What are the dimensions of \(\begin{bmatrix} 2 \\ 9 \\ 1 \end{bmatrix}\)?

4. What are the dimensions of \(\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix}\)?

5. Is \(\begin{bmatrix} 8 & 8 & 8 \end{bmatrix}\) a row vector or a column vector?

6. Is \(\begin{bmatrix} 5 \\ 6 \end{bmatrix}\) a row vector or a column vector?

For problems 7–9 use \(A = \begin{bmatrix} 3 & 6 \\ 9 & 2 \end{bmatrix}\).

7. What is the entry \(a_{11}\)?

8. What is the entry \(a_{21}\)?

9. What is the entry \(a_{12}\)?

For problem 10 use \(B = \begin{bmatrix} 1 & 4 & 7 \\ 2 & 5 & 8 \\ 3 & 6 & 9 \end{bmatrix}\).

10. What is the entry \(b_{23}\) (row 2, column 3)?

Recognising special matrices.

11. Is \(\begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}\) the zero matrix, the identity matrix, or neither?

12. Is \(\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}\) the zero matrix, the identity matrix, or neither?

13. Is \(\begin{bmatrix} 5 & 0 \\ 0 & 2 \end{bmatrix}\) a diagonal matrix?

Addition.

14. Compute \(\begin{bmatrix} 1 & 0 \\ 2 & 3 \end{bmatrix} + \begin{bmatrix} 4 & 5 \\ 1 & 1 \end{bmatrix}\).

15. Compute \(\begin{bmatrix} 2 & 7 \\ 0 & 6 \end{bmatrix} + \begin{bmatrix} 3 & 1 \\ 5 & 2 \end{bmatrix}\).

16. Compute \(\begin{bmatrix} 1 & 2 & 3 \end{bmatrix} + \begin{bmatrix} 4 & 0 & 6 \end{bmatrix}\).

Scalar multiplication.

17. Compute \(2 \cdot \begin{bmatrix} 1 & 3 \\ 0 & 4 \end{bmatrix}\).

18. Compute \(5 \cdot \begin{bmatrix} 2 & 0 \\ 1 & 3 \end{bmatrix}\), then add the result to \(\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}\).

Hints

Dimensions are always written rows × columns. Count the horizontal layers (rows) first, then how many numbers sit in one row (columns).

In \(a_{ij}\) the first number is the row and the second is the column. So \(a_{21}\) means “go to row 2, then column 1”. Point with two fingers if it helps.

Zero matrix: every entry is \(0\). Identity: \(1\) on the diagonal, \(0\) everywhere else. Diagonal: \(0\) everywhere off the diagonal, but the diagonal numbers can be anything.

Only add matrices of the same size. Then add position-by-position: top-left to top-left, and so on.

A scalar multiplies every single entry, with no exceptions.

Step-by-step solutions

1. The matrix has 2 rows and 2 columns, so it is \(2 \times 2\).

2. One row, three numbers in it, so \(1 \times 3\).

3. Three numbers stacked in a single column, so \(3 \times 1\).

4. Two rows, three columns, so \(2 \times 3\).

5. It has one row, so it is a row vector.

6. It has one column, so it is a column vector.

7. \(a_{11}\) is row 1, column 1, which is \(3\).

8. \(a_{21}\) is row 2, column 1, which is \(9\).

9. \(a_{12}\) is row 1, column 2, which is \(6\).

10. \(b_{23}\) is row 2, column 3. Row 2 is \(\begin{bmatrix} 2 & 5 & 8 \end{bmatrix}\), and its third number is \(8\). So \(b_{23} = 8\).

11. Every entry is \(0\), so it is the zero matrix.

12. It has \(1\) on the diagonal and \(0\) elsewhere, so it is the identity matrix.

13. The only nonzero entries (\(5\) and \(2\)) sit on the diagonal, and the off-diagonal entries are \(0\). Yes, it is a diagonal matrix.

14. Add matching positions: \(\begin{bmatrix} 1+4 & 0+5 \\ 2+1 & 3+1 \end{bmatrix} = \begin{bmatrix} 5 & 5 \\ 3 & 4 \end{bmatrix}.\)

15. Add matching positions: \(\begin{bmatrix} 2+3 & 7+1 \\ 0+5 & 6+2 \end{bmatrix} = \begin{bmatrix} 5 & 8 \\ 5 & 8 \end{bmatrix}.\)

16. Both are \(1 \times 3\), so add entry by entry: \[ \begin{bmatrix} 1+4 & 2+0 & 3+6 \end{bmatrix} = \begin{bmatrix} 5 & 2 & 9 \end{bmatrix}. \]

17. Multiply every entry by \(2\): \[ \begin{bmatrix} 2\cdot 1 & 2\cdot 3 \\ 2\cdot 0 & 2\cdot 4 \end{bmatrix} = \begin{bmatrix} 2 & 6 \\ 0 & 8 \end{bmatrix}. \]

18. First the scalar multiplication: \(5 \cdot \begin{bmatrix} 2 & 0 \\ 1 & 3 \end{bmatrix} = \begin{bmatrix} 10 & 0 \\ 5 & 15 \end{bmatrix}.\) Then add \(\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}\): \[ \begin{bmatrix} 10+1 & 0+1 \\ 5+1 & 15+1 \end{bmatrix} = \begin{bmatrix} 11 & 1 \\ 6 & 16 \end{bmatrix}. \]