topic badge

10.01 Using matrices to represent data

Lesson

Matrix notation

Often we represent mathematical information in a rectangular grouping array.  

Take this table of information for example, 

Favorite Color From Choice of Three Female Male
Black 13 6
Lime 3 10
Purple 8 9

 

This table of information can also be represented as a matrix.

In mathematics however, a matrix is a particular method of displaying information.  It is an array of numbers, arranged in rows and columns. So the table above would be represented like this

$A=$A=

As a standard, CAPITAL LETTERS are used to represent a matrix.  

We refer to the size of a matrix as a reference to the number of rows and number of columns. 

So an $m\times n$m×n matrix has $m$m rows and $n$n columns. 

 is a $3\times4$3×4 matrix. 

We also call this the dimension, (or order) of the matrix.  

Elements are the individual entries.  An element can be identified by its position (that is, its row and column) in the matrix.  

For the matrix $B$B, the element in the second row, third column would be written as $b_{23}=7$b23=7 (note the lower case $b$b to denote the element).

Matrices must have elements in all positions - there cannot be any gaps - although elements can take a value of zero.

When we put all this notation together, we get the formal definition of the matrix.

Types of matrices

Mathematicians, the creative mob that they are, have some special names for some special matrices.

Row matrix

A row matrix has just a single row

$T$T is a $1\times3$1×3 row matrix

Column matrix

A column matrix has just (you guessed it) a single column.

$M$M is a $4\times1$4×1 column matrix
 

Square matrix

A square matrix has an equal number of rows and columns
$G$G is a $2\times2$2×2 square matrix
 
$J$J is a $3\times3$3×3 square matrix
 

Diagonal matrix

A diagonal matrix is a square matrix with zero elements off of the main diagonal. 
$C$C is a $3\times3$3×3 diagonal matrix
 

Zero matrix

A zero matrix is a matrix of any dimension where all of the elements are zero.

Incidentally did you notice that in matrices $J$J and $C$C that some of the elements were negative, decimals, fractions or even radicals?  Well the elements of a matrix can be any type of number; rational, irrational, real, integers... So when we move on to undertaking operations with matrices, we would just follow all the laws of arithmetic regarding the types of numbers that we are working with. 

Equal matrices

Matrices can only be equal if each corresponding element is equal.

That is, that $a_{11}=b_{11,}a_{12}=b_{12}...$a11=b11,a12=b12... etc

So in this case, if $A=B$A=B, then $m=3$m=3 and $n=7$n=7

Representing data with matrices

Distances between towns
  A B C
A 0 23 17
B 23 0 43
C 17 43 0

When simply being used to store data we do not need to use the labeling conventions, we simply create the matrix.  Hence the above situation is converted like this: 

However, when undertaking mathematical processes using the data stored in matrices, then the defining of rows and columns must follow normal conventions.  

 

Two way frequency tables

Two way frequency tables follow the convention of independent variable headings in the columns and dependent variables on the rows.  

A survey was completed at a school that has both secondary and primary school students.  They were asked if the playground should have fewer, same or more seating options. The results are displayed in the table below. 

Attitude Primary Secondary
Fewer 5 2
Same 29 9
More 33 36
Total 67 47

 We can write this as a matrix.  The result would be:

 

Systems of equations

Simultaneous Equations follow the convention of organizing the variables into columns and the coefficients into rows. 

$x+2y=7$x+2y=7

$2x-5y=-4$2x5y=4

This system can be written like this using matrices. 

 

Worked examples

Question 1

Here is a network showing roads between towns.  Put the information into a matrix.

We will need to set up a $5\times5$5×5 matrix as there are $5$5 towns. 

The next step is to fill in the numbers of roads between them.

Question 2

Generate a matrix to represent the following two way frequency table for party preference for the over 30's and under 30's. 

Party Preference Under 30's Over 30's
Independent $16$16 $22$22
Green $10$10 $19$19
Total $26$26 $41$41

 

 
Question 3

A survey of $100$100 women, and twice as many men were asked about whether they approved or disapproved of a new road that would mean the removal of a recreation area.  Half the women and $146$146 men approved.

Generate a matrix that contains only the relevant information on the number men and women that approved and disapproved the new road. In other words, we want to exclude the total.

Firstly, set up the two way table, and solve for the figures required. 

(this is what we were told in the question)

  Women Men
Approved $50$50 $146$146
Disapproved    
Total $100$100 $200$200

(then we can calculate the disapproval numbers)

  Women Men
Approved $50$50 $146$146
Disapproved

$100-50=50$10050=50

$200-146=54$200146=54
Total $100$100 $200$200

Resulting in this final table

  Women Men
Approved $50$50 $146$146
Disapproved $50$50 $54$54
Total $100$100 $200$200

and as a matrix this is, (remembering the question says without totals in the matrix)

 

Practice questions

QUESTION 4

Determine the dimensions of the matrix     $-1$1 $-4$4     .
    $-9$9 $9$9    
  1. $\editable{}$$\times$×$\editable{}$

QUESTION 5

What is the entry at $a_{23}$a23 in $A$A$=$=
    $-1$1 $6$6 $5$5    
    $8$8 $-7$7 $-9$9    
    $4$4 $-2$2 $3$3    
?

QUESTION 6

Identify the square matrix.

  1.     $1$1 $-2$2 $-1$1    
        $3$3 $-3$3 $4$4    
    A
        $5$5 $2$2 $0$0    
        $-2$2 $-3$3 $-4$4    
        $4$4 $3$3 $1$1    
    B
        $1$1 $2$2 $-5$5 $-3$3    
    C
        $-3$3    
        $-4$4    
        $0$0    
    D

What is Mathspace

About Mathspace