<img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=iA1Pi1a8Dy00ym" style="display:none" height="1" width="1" alt="" />

# Matrices to Represent Data

## Introduction to matrices and related vocabulary

Estimated6 minsto complete
%
Progress
Practice Matrices to Represent Data

MEMORY METER
This indicates how strong in your memory this concept is
Progress
Estimated6 minsto complete
%
Matrices to Represent Data

A matrix is a rectangular array of numbers representing data in a variety of forms.  Computers work very heavily with matrices because operations with matrices are efficient with memory.  Matrices can represent statistical data with numbers, but also graphical data with pictures.

How might you use a matrix to write the following image as something a computer could recognize and work with?

### Introduction to Matrices

A matrix is a means of storing information effectively and efficiently. The rows and columns each mean something very specific and the location of a number is just as important as its value.  The following are all examples of matrices:

\begin{align*}\begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{bmatrix}, \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}, \begin{bmatrix} 2 & 3 & 4 & 5\\ 0 & 4 & 5 & 0\\ 0 & 0 & 2 & -9\\ 0 & 0 & 0 & 10 \end{bmatrix}\end{align*}

The entries in a matrix can be written out using brackets like [ ], but they can also be described individually using a set of 2 subscript indices \begin{align*}i\end{align*} and \begin{align*}j\end{align*} that stand for the row number and the column number.  Alternatively, the matrix can be named with just a capital letter like \begin{align*}A\end{align*}.

\begin{align*}A=[a_{ij}]=\begin{bmatrix} a_{11} & a_{12}\\ a_{21} & a_{22} \end{bmatrix}\end{align*}

Square matrices have the same number of rows as columns.  The order of a matrix describes the number of rows and the number of columns in the matrix.  The following matrix is said to have order \begin{align*}2 \times 3\end{align*} because it has two rows and three columns.  A \begin{align*}1 \times 1\end{align*} matrix is just a regular number.

\begin{align*}\begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{bmatrix}\end{align*}

A symmetric matrix is a special type of square matrix that has reflection symmetry across the main diagonal. The identity matrix is an example of a symmetric matrix.

The identity matrix of order \begin{align*}n \times n\end{align*} has zeros everywhere except along the main diagonal where it has ones.  Just like the number 1 has an important property with numbers, the identity matrix of any order has special properties as well.

\begin{align*}[1], \begin{bmatrix} 1 & 0\\ 0 & 1 \end{bmatrix}, \begin{bmatrix} 1 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{bmatrix}\end{align*}

When you turn the rows of a matrix into the columns of a new matrix, the two matrices are transpositions of one another.  The superscript \begin{align*}T\end{align*} stands for transpose.  Sometimes using the transpose of a matrix is more useful than using the matrix itself.

\begin{align*}A &= \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{bmatrix}\\ A^T &= \begin{bmatrix} 1 & 4\\ 2 & 5\\ 3 & 6 \end{bmatrix}\end{align*}

A triangular matrix is not a matrix in the shape of a triangle.  Rather, a lower triangular matrix is a square matrix where every entry below the diagonal is zero.  An upper triangular matrix is a square matrix where every entry above the diagonal is zero.  The following is a lower triangular matrix.  When you work with solving matrices, look for triangular matrices because they are much easier to solve.

\begin{align*}\begin{bmatrix} 2 & 3 & 4 & 5\\ 0 & 4 & 5 & 0\\ 0 & 0 & 2 & -9\\ 0 & 0 & 0 & 10 \end{bmatrix}\end{align*}

A diagonal matrix is both upper and lower triangular which means all the entries except those along the diagonal are zero.  The identity matrix is a special case of a diagonal matrix.

### Examples

#### Example 1

Earlier, you were asked how you might use a matrix to write the following image as something a computer could recognize and work with.

By writing every hollow square as a 0 and a blank square as a 1 a computer could read the picture:

When you use computers to manipulate images, the computer just manipulates the numbers.  In this case, if you swap zeros and ones, you get the negative image.

Real photos and computer images have matrices that are much larger and include more numbers than just zero and one to account for more colors.

#### Example 2

Kate runs three bakeries and each bakery sells bagels and muffins.  The rows represent the bakeries and the columns represent bagels (left) and muffins (right) sold.  Answer the following questions about Kate’s sales.

\begin{align*}K=\begin{bmatrix} 144 & 192\\ 115 & 127\\ 27 & 34 \end{bmatrix}\end{align*}

1. What does 127 represent?
1. 127 represents the number of muffins that Kate sold in her second location. You know this because it is in the muffin column and the second row.
2. How many muffins did Kate sell in total?
1. The total muffins sold is equal to the sum of the right hand column. \begin{align*}192+127+34=353\end{align*}
3. How many bagels did Kate sell in her first location?
1. Kate sold 144 bagels at her first location.
4. Which location is doing poorly?
1. The third location is doing much worse than the other two locations.

#### Example 3

Identify the order of the following matrices

\begin{align*}A=\begin{bmatrix} 1 & 3 & 4 & 7 \end{bmatrix}, \quad B=\begin{bmatrix} 21 & 45 & 1\\ 34 & 1 & 5 \end{bmatrix}, \quad C=\begin{bmatrix} 25 & 235\\ 562 & 562\\ 4 & 413\\ 454 & 33\\ 1 & 141 \end{bmatrix}\end{align*}

\begin{align*}A\end{align*} is \begin{align*}1 \times 4\end{align*}, \begin{align*}B\end{align*} is \begin{align*}2 \times 3\end{align*}, \begin{align*}C\end{align*} is \begin{align*}5 \times 2\end{align*}.  Note that \begin{align*}4 \times 1, 3 \times 2, 2 \times 5\end{align*} are not the same orders and would be incorrect.

#### Example 4

Write out the \begin{align*}5 \times 4\end{align*} matrix whose entries are \begin{align*}a_{ij}=\frac{i+j}{j}\end{align*}.

\begin{align*}\begin{bmatrix} 2 & \frac{3}{2} & \frac{4}{3} & \frac{5}{4} & \frac{6}{5}\\ 3 & 2 & \frac{5}{3} & \frac{3}{2} & \frac{7}{5}\\ 4 & \frac{5}{2} & 2 & \frac{7}{4} & \frac{8}{5}\\ 5 & 3 & \frac{7}{3} & 2 & \frac{9}{5} \end{bmatrix}\end{align*}

#### Example 5

Create a \begin{align*}3 \times 3\end{align*} matrix for each of the following:

a. Diagonal Matrix

\begin{align*}\begin{bmatrix} 4 & 0 & 0\\ 0 & 3 & 0\\ 0 & 0 & 5 \end{bmatrix}\end{align*}

b. Lower Triangular

\begin{align*}\begin{bmatrix} 4 & 1 & 1\\ 0 & 3 & 14\\ 0 & 0 & 5 \end{bmatrix}\end{align*}

c. Symmetric

\begin{align*}\begin{bmatrix} 4 & 1 & 1\\ 1 & 3 & 14\\ 1 & 14 & 5 \end{bmatrix}\end{align*}

d. Identity:

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

Note that while the identity matrix does technically work for all the parts of this problem, it does not highlight the differences between each definition.

### Review

State the order of each of the following matrices:

1. \begin{align*}A=\begin{bmatrix} 4 & 2 & 4 & 7\\ 5 & 2 & 1 & 0 \end{bmatrix}\end{align*}

2. \begin{align*}B=\begin{bmatrix} 0 & 1\\ 34 & 1 \end{bmatrix}\end{align*}

3. \begin{align*}C=\begin{bmatrix} 2 & 62\\ 14 & 3\\ 4 & 3\\ 1 & 11 \end{bmatrix}\end{align*}

4. \begin{align*}D=\begin{bmatrix} 12 & 0 & 2\\ 0 & 3 & 3\\ 4 & 0 & 1\\ 1 & 4 & 0 \end{bmatrix}\end{align*}

5. \begin{align*}E=\begin{bmatrix} 1 & 11 \end{bmatrix}\end{align*}

6. Give an example of a \begin{align*}1 \times 1\end{align*} matrix.

7. Give an example of a \begin{align*}3 \times 2\end{align*} matrix.

8. If a symmetric matrix is also lower triangular, what type of matrix is it?

9. Write out the \begin{align*}2 \times 3\end{align*} matrix whose entries are \begin{align*}a_{ij}=i-j\end{align*}

Morgan worked for three weeks during the summer earning money on Mondays, Tuesdays, Wednesdays, Thursdays, and Fridays.  The following matrix represents his earnings.

\begin{align*}\begin{bmatrix} 24 & 22 & 32\\ 25 & 28 & 30\\ 30 & 28 & 32\\ 10 & 15 & 19\\ 35 & 32 & 30 \end{bmatrix}\end{align*}

10. What do the rows and columns represent?

11. How much money did Morgan make in the first week?

12. How much money did Morgan make on Tuesdays?

13. What day of the week was most profitable?

14. What day of the week was least profitable?

15. Is the following a matrix? Explain.

\begin{align*}\begin{bmatrix} dogs & 0\\ cats & 3\\ sheep & 0\\ ducks & 4 \end{bmatrix}\end{align*}

To see the Review answers, open this PDF file and look for section 8.3.

### Notes/Highlights Having trouble? Report an issue.

Color Highlighted Text Notes

### Vocabulary Language: English

TermDefinition
diagonal matrix A diagonal matrix is a matrix composed of zeroes in all positions aside from along the diagonal.
identity matrix An identity matrix is a matrix with zeros everywhere except along the diagonal where there are ones.
order The order of a matrix describes the number of rows and the number of columns in the matrix.
symmetric matrix A symmetric matrix is a square matrix with reflection symmetry across the main diagonal.
transpose of a matrix The transpose of a matrix is a new matrix whose columns and rows have been switched. This changes the order of the matrix from, for example, $3 \times 2$ to $2 \times 3$.
triangular matrix A triangular matrix is described as either upper or lower triangular . The opposite portion of the matrix is entirely zeros.