By the end of this chapter, you will be able to:
Mastering these skills will help you handle important calculations confidently and efficiently in your trade.
Compiled by: Elijah Kiprono
Matrices are fundamental in ICT, especially in areas such as computer graphics, network analysis, and data organization. Mastery of matrix operations enables ICT technicians to manipulate data structures efficiently and solve complex problems involving systems of equations. This chapter focuses on identifying various types of matrices and performing essential operations, including addition, subtraction, and multiplication, with practical examples relevant to ICT applications in Kenya.
A matrix arranges numbers in rows and columns, and that simple layout is why it appears wherever ICT handles tables of data: pixel positions on a screen, link measurements on a network, the training data of a learning program. Before any calculation can be done the technician must be able to read a matrix, state its size, find an element in it and name its type, because the type decides which methods apply. This topic defines the key terms, shows where matrices are used and describes thirteen types.
A matrix is a rectangular array of numbers arranged in rows and columns and enclosed in brackets. The numbers inside are its elements. The size of a matrix is given as m × n, where m is the number of rows and n is the number of columns. The general matrix A of size m × n is written with a double index on each element: aij is the element in row i and column j.
[ a11 a12 ... a1n ]
A = [ a21 a22 ... a2n ]
[ ... ... ... ... ]
[ am1 am2 ... amn ]
Capital letters name matrices (A, B, C) and the matching small letters name their elements (a23, b32).
A matrix is a rectangular table of numbers treated as one object. The rows run across and the columns run down, and every row has the same number of elements. Writing the numbers inside brackets shows that the table is a single quantity and not a loose list.
Example: a technician records the hours that two printers were in use on Monday, Tuesday and Wednesday. The printers are the rows and the days are the columns.
P = [ 6 7 5 ]
[ 4 0 8 ]
The second printer was in use for 8 hours on Wednesday and was not used on Tuesday, which is why that position holds 0.
The dimension of a matrix, also called its order, is the number of rows by the number of columns, always in that sequence. The matrix P above has 2 rows and 3 columns, so its dimension is 2 × 3. A 3 × 2 matrix is a different shape, because the first number counts rows.
Example: a technician draws up a table showing which of 3 routers is cabled to each of 4 switches. The table has 3 rows and 4 columns, so its dimension is 3 × 4.
Example: state the dimension of B.
[ 5 8 ]
B = [ 2 7 ]
[ 9 4 ]
B has 3 rows and 2 columns, so its dimension is 3 × 2.
Dimension matters because the operations in this chapter are allowed only for certain combinations of dimensions. Two matrices can be added only when they have the same dimension, for example.
The elements, or entries, are the individual numbers of a matrix. The element aij sits in row i and column j, so the row number is always written first. A matrix of dimension m × n holds m × n elements: the matrix P holds 2 × 3 = 6 elements.
Example: find the element in the second row and third column of C.
C = [ 1 0 2 ]
[ 4 5 6 ]
The element c23 is found in row 2 and column 3, so c23 = 6. In matrix B of the previous section, b32 = 4 because it sits in row 3 and column 2.
Any data that fits a grid can be held in a matrix, and matrices are used in ICT because computers can process them quickly and in bulk. Three areas that a technician meets are computer graphics, robotics and machine learning. In each of them the matrix product, which is taught in Product of two matrices, is the working tool: the examples below only state the result.
Every point on a screen has two coordinates (x, y), and a program stores the point as a column matrix. To enlarge, turn or move a picture, the program multiplies the coordinates of each point by a transformation matrix. A scaling matrix has the scale factors on its diagonal, and a rotation matrix turns points about the origin.
Example: the point (2, 3) is scaled by a factor of 2 along x and 3 along y.
[ 2 0 ] [ 2 ] = [ 4 ]
[ 0 3 ] [ 3 ] [ 9 ]
The new point is (4, 9). Rotating the point (2, 3) through 90 degrees anticlockwise about the origin uses the matrix with rows 0, −1 and 1, 0.
[ 0 −1 ] [ 2 ] = [ −3 ]
[ 1 0 ] [ 3 ] [ 2 ]
The new point is (−3, 2). A whole image is moved by treating all its points in this way. Moving a picture sideways, called translation, needs a larger matrix with an extra row and column, which graphics software adds automatically.
A robot arm is a chain of segments joined at turning points. A matrix describes the position and the direction of each segment relative to the one before it. Multiplying the matrices of the joints one after another gives the position of the tool at the end of the arm, and this is how a controller knows where the tool is.
Example: an arm segment 10 cm long lies along the x axis, so its tip is at (10, 0). The joint turns the segment through 90 degrees anticlockwise, using the same rotation matrix as above.
[ 0 −1 ] [ 10 ] = [ 0 ]
[ 1 0 ] [ 0 ] [ 10 ]
The tip moves to (0, 10), which is 10 cm up the y axis. Because a rotation does not change length, the tip stays 10 cm from the joint.
Machine learning programs learn from tables of data. The training data is stored as a matrix X in which each row is one example and each column is one measured feature. The program also holds a column matrix w of weights, one for each feature, and the predictions for all examples come from one matrix product, X multiplied by w.
Example: suppose a workshop wants to estimate the cost of a repair job in Ksh from two features, the hours of work and the number of parts. For three jobs the features are in X, and the weights are 300 per hour and 150 per part. The weights are made up for this illustration; a trained program would learn them from past jobs.
[ 2 1 ] [ 300 ] [ 750 ]
[ 3 2 ] [ 150 ] = [ 1200 ]
[ 1 4 ] [ 900 ]
The predicted costs are Ksh 750, Ksh 1,200 and Ksh 900 for the three jobs. For job 1 the working is 2 × 300 + 1 × 150 = 750.
Matrices are named by their shape and by the pattern of their elements. The name tells the technician at once which shortcuts are allowed: a diagonal matrix, for instance, is easy to multiply and a symmetric matrix needs only half its elements to be stored. The thirteen types below are the ones used in this unit.
A row matrix has only one row, so its dimension is 1 × n. It is often used to hold a single record, such as one set of readings.
R = [ 4 7 2 ]
R is a 1 × 3 row matrix: for example, the readings of one sensor at three different times.
A column matrix has only one column, so its dimension is m × 1. A point on a screen and a list of weights are stored as column matrices.
[ 3 ]
V = [ 5 ]
[ 8 ]
V is a 3 × 1 column matrix. Its transpose, which is the topic of the later section Transpose, is a row matrix.
A zero matrix has every element equal to 0, and it can have any dimension. It is written O. Adding a zero matrix to a matrix of the same dimension leaves that matrix unchanged, so it behaves like the number 0.
O = [ 0 0 0 ]
[ 0 0 0 ]
O is the 2 × 3 zero matrix. In a table of links between devices, a zero matrix means that no device is connected to any other.
A square matrix has as many rows as columns, so its dimension is n × n. The elements a11, a22, a33 and so on form the main diagonal, which runs from the top left corner to the bottom right corner. Determinants and inverses exist only for square matrices.
[ 2 7 1 ]
S = [ 0 3 9 ]
[ 6 4 5 ]
S is a 3 × 3 square matrix whose main diagonal holds 2, 3 and 5.
A diagonal matrix is a square matrix in which every element off the main diagonal is zero. The diagonal elements may be any numbers. Diagonal matrices are used in scaling operations, because each coordinate is multiplied only by its own factor.
[ 2 0 0 ]
D = [ 0 5 0 ]
[ 0 0 7 ]
D scales the first coordinate by 2, the second by 5 and the third by 7.
An upper triangular matrix is a square matrix in which all the elements below the main diagonal are zero. The elements on and above the diagonal may be any numbers. This shape is the aim of Gaussian elimination when a system of equations is solved.
[ 4 5 6 ]
F = [ 0 7 8 ]
[ 0 0 9 ]
Every element below the main diagonal of F is zero, so F is upper triangular.
A lower triangular matrix is a square matrix in which all the elements above the main diagonal are zero. It is the mirror image of the upper triangular matrix.
[ 2 0 0 ]
L = [ 3 5 0 ]
[ 1 4 6 ]
Every element above the main diagonal of L is zero, so L is lower triangular. A diagonal matrix is both upper and lower triangular.
A scalar matrix is a diagonal matrix whose diagonal elements are all equal to the same number k. Multiplying any 3 × 3 matrix by this matrix has the same effect as multiplying every element of that matrix by k.
[ 4 0 0 ]
4I = [ 0 4 0 ]
[ 0 0 4 ]
This scalar matrix, with k = 4, enlarges a figure to four times its size in all directions.
The identity matrix, written I, is the scalar matrix with k = 1: ones on the main diagonal and zeros everywhere else. It acts like the number 1, because multiplying a matrix by I of the right size leaves the matrix unchanged: AI = IA = A.
[ 1 0 0 ]
I = [ 0 1 0 ]
[ 0 0 1 ]
I is the 3 × 3 identity matrix, because its diagonal elements are all 1 and all others are 0. The check below shows the 2 × 2 case.
[ 4 1 ] [ 1 0 ] = [ 4 1 ]
[ 2 6 ] [ 0 1 ] [ 2 6 ]
The transposed matrix of A, written Aᵀ, is formed by turning the rows of A into columns, so that the first row becomes the first column, the second row the second column, and so on. A matrix of dimension m × n becomes one of dimension n × m. The methods are practised under Transpose.
[ 1 2 3 ] [ 1 4 ]
A = [ 4 5 6 ] gives Aᵀ = [ 2 5 ]
[ 3 6 ]
A is 2 × 3 and Aᵀ is 3 × 2.
A symmetric matrix is a square matrix that equals its own transpose, A = Aᵀ. The elements on either side of the main diagonal are mirror images: aij = aji. A symmetric matrix describes a two-way relationship, such as the cable links of a network where a link from device 1 to device 2 is also a link from device 2 to device 1.
E = [ 3 2 ]
[ 2 3 ]
Here E equals Eᵀ, so E is symmetric. The 3 × 3 matrix below is also symmetric, because the elements 7, 3 and −5 appear on both sides of the diagonal.
[ 1 7 3 ]
[ 7 4 −5 ]
[ 3 −5 6 ]
A skew-symmetric matrix is a square matrix whose transpose is its negative, Aᵀ = −A, which means aji = −aij. Two facts follow: every element on the main diagonal must be zero, because a number that equals its own negative is zero, and the elements on either side of the diagonal have opposite signs.
[ 0 2 −1 ] [ 0 −2 1 ]
K = [ −2 0 4 ] and Kᵀ = [ 2 0 −4 ]
[ 1 −4 0 ] [ −1 4 0 ]
Comparing the two matrices shows that every element of Kᵀ is the negative of the matching element of K, so K is skew-symmetric.
An orthogonal matrix is a square matrix whose product with its transpose is the identity matrix, A × Aᵀ = I. Its rows are at right angles to each other and have length 1. Rotation matrices are orthogonal, which is why a rotation turns a picture or a robot arm without changing its size.
Example: show that Q is orthogonal, where the first row of Q is 0.6, −0.8 and the second row is 0.8, 0.6.
[ 0.6 −0.8 ] × [ 0.6 0.8 ] = [ 1 0 ]
[ 0.8 0.6 ] [ −0.8 0.6 ] [ 0 1 ]
The element in the first row and first column is 0.6 × 0.6 + (−0.8) × (−0.8) = 0.36 + 0.64 = 1. The element in the first row and second column is 0.6 × 0.8 + (−0.8) × 0.6 = 0.48 − 0.48 = 0. The other two elements work out in the same way, so the product is I and Q is orthogonal.
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountThis chapter introduced the concept of matrices by defining key terms and exploring various types of matrices. It then covered essential matrix operations including addition, subtraction, and the product of two matrices, emphasizing the procedural steps involved. The chapter also explained how to calculate the determinant of matrices, focusing on 2x2 and 3x3 matrices, and demonstrated how determinants are applied to solve simultaneous equations using matrix methods. Following this, the inverse of a matrix was discussed, with detailed methods for finding the inverse of 2x2 and 3x3 matrices. The chapter further introduced the transpose of a matrix and the co-factor method as important tools in matrix manipulation. Together, these topics provide a comprehensive foundation for performing matrix operations in discrete mathematics.
Given matrices
\( A = \begin{bmatrix} 2 & 3 \\ 4 & 1 \end{bmatrix} \) and
\( B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix} \),
find the sum \( A + B \). (2 marks)
For matrices
\( C = \begin{bmatrix} 9 & 4 \\ 2 & 5 \end{bmatrix} \) and
\( D = \begin{bmatrix} 3 & 1 \\ 7 & 6 \end{bmatrix} \),
calculate the difference \( C - D \). (2 marks)
At the start of this chapter we promised you would be able to:
Tick each one you can genuinely do.
So, are you there yet?
You're competent when you can confidently do 50% or more of what this chapter promised.
Sign in to record how you're doing.