Using Matrices with Data

Matrices organize two-way data into rows and columns. Read entry addresses, add or subtract corresponding entries when dimensions match, and multiply every entry by a scalar. Combining these operations lets you calculate percentage price increases while keeping each value in its original position.

Course cover for Using Matrices with Data

Tickets, Tables, and One Big Move

City Tickets has a price for each event and seat tier. Its price board can be organized as a two-way table, with events as rows and seat tiers as columns. Each price is in dollars

EventStandard price ($)VIP price ($)
Soccer60100
Concert80120

The order is to raise every price by 25%. How do you change every price in one move? Rather than treating the prices as unrelated numbers, a matrix packages the rectangular block of values as one mathematical object. The row and column positions keep track of which event and seat tier each price belongs to

What Is a Matrix?

From a table to a matrix

A matrix is a rectangular array of numbers inside brackets. Removing the headers from the ticket-price table, while keeping every value in the same position, gives $$T = \begin{bmatrix} 60 & 100 \\ 80 & 120 \end{bmatrix}$$. The soccer prices form the top row, and the concert prices form the bottom row. Standard prices remain in the first column, and VIP prices remain in the second

Dimensions: rows by columns

Consider the weekend ticket-sales matrix $$P = \begin{bmatrix} 14 & 52 & 31 \\ 27 & 48 & 19 \end{bmatrix}$$. The rows represent Saturday and Sunday, in that order; the columns represent lawn, floor, and balcony tickets. Rows run across and are counted from top to bottom. Columns run down and are counted from left to right

Dimensions are stated as rows × columns. Matrix P has two rows and three columns, so its dimensions are 2 × 3. Calling it 3 × 2 would be incorrect: that would mean three rows and two columns

Entry addresses

Each number in a matrix is an entry. In the address $$a_{ij}$$, the first subscript, i, gives the row, and the second, j, gives the column. For matrix P, find the value of $$p_{13}$$ and the address of the entry 27

The address $$p_{13}$$ means row 1, column 3. The top row is 14, 52, 31, so $$p_{13} = 31$$. Going the other way, 27 is in row 2, column 1, so its address is $$p_{21}$$

For the following practice question, the weekend ticket-count matrix is $$Q = \begin{bmatrix} 8 & 15 \\ 22 & 4 \\ 9 & 17 \end{bmatrix}$$, with dimensions 3 × 2

Tap the entry $$q_{32}$$ in matrix Q

A

17

B

9

C

4

D

15

E

8

F

22

Adding and Subtracting Matrices

To combine entries by position, each entry needs a partner at the same row-and-column address. Compare $$\begin{bmatrix} 5 & 1 \\ 2 & 8 \end{bmatrix}$$, which is 2 × 2, with $$\begin{bmatrix} 3 & 6 & 4 \\ 7 & 0 & 2 \end{bmatrix}$$, which is 2 × 3

If we pair entries by position, could every entry of these two matrices find a partner?

A

Yes - both have two rows, so everything pairs up

B

No - the extra column on the right has no partners

C

Yes, as long as we skip the leftover column

Adding weekly ticket sales

City Tickets recorded week 1 sales in $$E = \begin{bmatrix} 12 & 7 \\ 5 & 9 \end{bmatrix}$$ and week 2 sales in $$F = \begin{bmatrix} 3 & 8 \\ 6 & 4 \end{bmatrix}$$. Rows are Soccer and Concert; columns are Standard and VIP. Find the total sales matrix E + F

Both matrices are 2 × 2, so addition is allowed. In row 1, 12 + 3 = 15 and 7 + 8 = 15. In row 2, 5 + 6 = 11 and 9 + 4 = 13. Therefore, $$E + F = \begin{bmatrix} 15 & 15 \\ 11 & 13 \end{bmatrix}$$, a 2 × 2 matrix of total sales

Subtracting: watch the negatives

Given $$G = \begin{bmatrix} 9 & 2 & 6 \\ 1 & -4 & 10 \end{bmatrix}$$ and $$H = \begin{bmatrix} 4 & 0 & -3 \\ 2 & 1 & 5 \end{bmatrix}$$, find G − H. Both are 2 × 3, so subtract corresponding entries

Across row 1, 9 − 4 = 5, 2 − 0 = 2, and 6 − (−3) = 6 + 3 = 9, not 3. Across row 2, 1 − 2 = −1, −4 − 1 = −5, and 10 − 5 = 5. Thus $$G - H = \begin{bmatrix} 5 & 2 & 9 \\ -1 & -5 & 5 \end{bmatrix}$$. The result remains 2 × 3

Practice: possible or impossible?

Which of these operations are possible: a 3 × 2 matrix + a 3 × 2 matrix; a 2 × 3 matrix − a 3 × 2 matrix; and a 2 × 2 matrix + a 2 × 3 matrix? The first is possible because both dimensions match in order. The second is impossible because 2 × 3 and 3 × 2 are different dimensions. The third is impossible because the column counts differ, even though both matrices have two rows

Practice: complete a difference

Compute K − L for $$K = \begin{bmatrix} 5 & -1 \\ 8 & 3 \end{bmatrix}$$ and $$L = \begin{bmatrix} 2 & -4 \\ -6 & 1 \end{bmatrix}$$. Both are 2 × 2. The result has 3 at row 1, column 1 and 2 at row 2, column 2. Find the two missing entries using the original choices 3, −5, 14, and 2

At row 1, column 2, −1 − (−4) = −1 + 4 = 3. At row 2, column 1, 8 − (−6) = 8 + 6 = 14. The completed difference is $$K - L = \begin{bmatrix} 3 & 3 \\ 14 & 2 \end{bmatrix}$$. The choices −5 and 2 for the missing entries would ignore the effect of subtracting a negative

Scalar Multiplication

A scalar is a single number that multiplies a matrix. To compute a scalar product, multiply every entry by that number. The result has the same dimensions as the original matrix. Unlike matrix addition or subtraction, scalar multiplication does not require a second matrix with matching dimensions: it works for any scalar and any matrix

Compute $$4\begin{bmatrix} 2 & -3 \\ 0 & 5 \end{bmatrix}$$. The four products are 4 × 2 = 8, 4 × (−3) = −12, 4 × 0 = 0, and 4 × 5 = 20. Therefore, $$4\begin{bmatrix} 2 & -3 \\ 0 & 5 \end{bmatrix} = \begin{bmatrix} 8 & -12 \\ 0 & 20 \end{bmatrix}$$. Both the original and result are 2 × 2

Which matrix equals $$5\begin{bmatrix} 1 & -2 \\ 4 & 0 \end{bmatrix}$$?

A

$$\begin{bmatrix} 5 & -10 \\ 20 & 0 \end{bmatrix}$$

B

$$\begin{bmatrix} 5 & -2 \\ 4 & 0 \end{bmatrix}$$

C

$$\begin{bmatrix} 5 & 10 \\ 20 & 0 \end{bmatrix}$$

Combining the Moves

For an expression combining scalar multiplication with addition or subtraction, finish the scalar product first. Then check the matrix dimensions before combining corresponding entries

Evaluate R − 2S

Given $$R = \begin{bmatrix} 3 & 9 \\ -2 & 4 \end{bmatrix}$$ and $$S = \begin{bmatrix} 1 & -5 \\ 4 & 0 \end{bmatrix}$$, both 2 × 2, find R − 2S

  1. Double every entry of S to obtain $$2S = \begin{bmatrix} 2 & -10 \\ 8 & 0 \end{bmatrix}$$
  2. R and 2S are both 2 × 2, so subtraction is allowed

Subtract corresponding entries. The calculations are 3 − 2 = 1, 9 − (−10) = 9 + 10 = 19, −2 − 8 = −10, and 4 − 0 = 4. Thus $$R - 2S = \begin{bmatrix} 1 & 19 \\ -10 & 4 \end{bmatrix}$$

Scaling never fixes a size mismatch

Now consider 2S + W, using the same $$S = \begin{bmatrix} 1 & -5 \\ 4 & 0 \end{bmatrix}$$ and $$W = \begin{bmatrix} 6 & 1 \\ 0 & 7 \\ 3 & 2 \end{bmatrix}$$. Matrix 2S is still 2 × 2, while W is 3 × 2. The dimensions do not match, so 2S + W cannot be evaluated: there is no result matrix

U is 2 x 3 and V is 3 x 2. Can 4U + V be evaluated?

A

No - 4U is still 2 x 3, which does not match 3 x 2

B

Yes - multiplying by 4 reshapes U to match V

C

Yes - both matrices have six entries, so they pair up

One Move, Every Price

Set up the 25% increase

Return to the original ticket prices, now named $$M = \begin{bmatrix} 60 & 100 \\ 80 & 120 \end{bmatrix}$$. Rows are Soccer and Concert; columns are Standard and VIP. Every entry is a price in dollars, and M has dimensions 2 × 2. The task is to raise every price by 25%

A 25% increase does not mean adding $25 to every price. Each new price equals the old price plus 0.25 times that old price. The new-price matrix is therefore M + 0.25M: first compute the scalar product, then add it to M

Compute the increase, then the new prices

Multiply every entry by 0.25. The calculations are 0.25 × 60 = 15, 0.25 × 100 = 25, 0.25 × 80 = 20, and 0.25 × 120 = 30. Thus $$0.25M = \begin{bmatrix} 15 & 25 \\ 20 & 30 \end{bmatrix}$$. This matrix gives the dollar increase for each ticket, not the new prices

Both M and 0.25M are 2 × 2. Add corresponding entries: 60 + 15 = 75, 100 + 25 = 125, 80 + 20 = 100, and 120 + 30 = 150. Therefore, $$M + 0.25M = \begin{bmatrix} 75 & 125 \\ 100 & 150 \end{bmatrix}$$

EventNew Standard price ($)New VIP price ($)
Soccer75125
Concert100150

The row and column meanings are unchanged. The equivalent shortcut is $$M + 0.25M = 1.25M$$. For example, 1.25 × 60 = 75 agrees with the new Soccer Standard price

Practice: a 50% price increase

A snack stand raises every price by 50%. Its original price matrix in dollars is $$S = \begin{bmatrix} 4 & 6 \\ 2 & 8 \end{bmatrix}$$, with rows Popcorn and Nachos and columns Small and Large. The increase has already been computed: $$0.5S = \begin{bmatrix} 2 & 3 \\ 1 & 4 \end{bmatrix}$$

Every price rises 50%. Which matrix shows the new prices?

A

$$\begin{bmatrix} 6 & 9 \\ 3 & 12 \end{bmatrix}$$

B

$$\begin{bmatrix} 2 & 3 \\ 1 & 4 \end{bmatrix}$$

C

$$\begin{bmatrix} 4.50 & 6.50 \\ 2.50 & 8.50 \end{bmatrix}$$

Summary

Dimensions are rows × columns, with rows first. A 2 × 3 matrix has two rows and three columns

An entry address $$a_{ij}$$ means row i, column j. The first subscript gives the row; the second gives the column. For example, $$a_{21}$$ is in row 2, column 1

Addition and subtraction combine corresponding entries only when dimensions match exactly. Mismatched dimensions mean there is no answer matrix

A scalar multiplies every entry and leaves dimensions unchanged. In mixed expressions, finish the scalar product first, then check dimensions before adding or subtracting

For a price matrix S, a 50% increase has increase amount 0.5S and final new-price matrix $$S + 0.5S = 1.5S$$. The increase alone is not the final price, and a 50% increase is not an instruction to add $50

Quiz

1. Read an entry address

Matrix J lists tickets sold for four tour dates as rows and two seat tiers as columns: $$J = \begin{bmatrix} 6 & 21 \\ 13 & 9 \\ 4 & 30 \\ 2 & 5 \end{bmatrix}$$. Its dimensions are 4 × 2

What is the value of $$j_{31}$$?

A

4

B

30

C

13

2. Complete a scalar product and a difference

For this problem, $$P = \begin{bmatrix} 7 & -3 & 2 \\ 0 & 5 & -1 \end{bmatrix}$$ and $$Q = \begin{bmatrix} 2 & -4 & 1 \\ 3 & 1 & 0 \end{bmatrix}$$, both 2 × 3. Complete the scalar product 2Q, then the difference P − 2Q. The missing entries are row 1, column 2 of 2Q and row 2, column 1 of P − 2Q. The original choices are −8, −4, −6, and 6

First, double every entry of Q: $$2Q = \begin{bmatrix} 4 & -8 & 2 \\ 6 & 2 & 0 \end{bmatrix}$$. The first missing entry is 2 × (−4) = −8, not the unchanged value −4. Both P and 2Q are 2 × 3, so subtraction is allowed

Subtracting gives row 1 entries 7 − 4 = 3, −3 − (−8) = 5, and 2 − 2 = 0, and row 2 entries 0 − 6 = −6, 5 − 2 = 3, and −1 − 0 = −1. Thus $$P - 2Q = \begin{bmatrix} 3 & 5 & 0 \\ -6 & 3 & -1 \end{bmatrix}$$. The second missing entry is −6, not 6

3. Apply a percentage increase

A gym raises every monthly fee by 50%. Its fees in dollars are $$F = \begin{bmatrix} 30 & 50 \\ 20 & 40 \end{bmatrix}$$, with rows Student and Adult and columns Basic and Premium

After a 50% increase, what is the new Adult Basic fee?

A

$30

B

$10

C

$70

Continue with the interactive lesson