Lesson 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 43

Mathematics for Computations

LESSON 1

MATRICES

Prepared by: Wan Nurul Huda Faculty of Business Finance and


2020@MAHSA University Information Technology
Mathematics for Computations

LEARNING OBJECTIVE

▪Understand the definition of matrices

▪Categorize the type of matrix

▪Understand the application of matrices


Mathematics for Computations

What is a matrix?
• A Matrix is just rectangular arrays of real number
• The numbers in the array are called the entries in the matrix
• The horizontal entries in a matrix are called rows and the vertical
are called column.
• written within a set of [ ] brackets, and arranged into a pattern of
rows and columns. For example:
 a11 a12 a13 ....a1n 
 a a a ....a 
 2 n  General Form of a Matrix of Size m x n with m Rows
A= 21 22 23

: :  and n Columns
 
 am1 am 2 am 3 ...amn 
Square Matrix
•If m = n, the matrix is said to be square. In this
case, the matrix could be designated as an m x m
matrix.

Am,m
Matrices find many application in scientific fields and apply to practical
real life problems as well , thus making an indispensable concept for
solving many practical problems.

In computer based applications, matrices play a vital role in the


projection of three dimensional image into a two dimensional screen,
creating the realistic seeming motions.

Graphic software uses matrix mathematics to process linear


transformations to render images.
• One of the most important usages of matrices are encryption
of messages codes.
• A message is made as a sequence of numbers in a binary
format for communication and it follows code theory for
solving. Hence with the help of matrices, those equations are
solved.

• With the encryption only, internet function are working and


even banks could work with transmission of sensitive and
private data’s.
Mathematics for Computations

Sizing a matrix
• By convention matrices are “sized” using the number of rows (r) by
number of columns (c).
• Two numbers (rows x columns) describe the dimensions or size of the
matrix.

21 62 33 93 7 3 2  11 4


 
A = 44 95 66 13 3x3 
B = 8 4 1  14 7 D = 17
3x4 C = 1x1
77 38 79 33 6 5 9 4x2 16 8
22 
3

Faculty of Engineering and Information Technology


EXAMPLE 1:
• Determine the size of the matrix shown below:

 2 -3 5
A= 
-1 4 6 
•The matrix has 2 rows and 3 columns. Its size is 2 x 3.
Example 2:
Determine the size of the matrix shown below.

2 1 

B = 7 -4
3 1 
Example 3:
Determine the size of the matrix shown
below.
 2 -1 3

C = 4 6 
1
-5 2 1
Mathematics for Computations

Types of Matrices
1.Column matrix or Vector:
• The number of rows may be any integer but the number of columns is
always 1

18 16
5 3
3 2X1
3X1
Mathematics for Computations

Types of Matrices
2. Row matrix or vector
• Any number of columns but only one row

4 3
1X2
0 3 5 2
1X4
Mathematics for Computations

Types of Matrices
3. Rectangular matrix
• A matrix whose row and column are not equal

1 1 
3 7  1 1 1 0 0 
  2 0 3 3 0
7 −7  
7 6  2X5
 
4X2 rc
Mathematics for Computations

Types of Matrices
4. Square matrix
• The number of rows is equal to the number of columns
• mxn matrix in which r = c
5 2 2
2 1 1
3x3 1 1 2
Mathematics for Computations

Types of Matrices
5. Diagonal matrix
• A square matrix where all the elements are zero except those on the
main diagonal
3 0 0 0
1 0 0  0 3 0 0
0  
 2  0 0 0 5 0
0 0 1 0 9 
 0 0 
i.e. aij =0 for all i ≠ j
aij ≠ 0 for some or all i = j
Mathematics for Computations

Types of Matrices
6. Identity matrix - I
• A square diagonal matrix whose elements principal elements are
equal to 1 .
1 0 0 0
0 1 0  1 0
 0 aij 0
0 0 1 0 0 1  0 
   aij 
0 
1
 0 0
i.e. aij =0 for all i ≠ j
aij = 1 for some or all i = j
Mathematics for Computations

Types of Matrices
7. Null (zero) matrix - 0
• All elements in the matrix are zero

0  0 0 0 
0  0 0 0
   
0
0 0 0

aij =0 For all i,j


Mathematics for Computations

Types of Matrices
8. Scalar matrix
• A diagonal matrix whose main diagonal elements are equal to the
same
• A scalar is defined as a single number or constant

3 0 0
0 3 0 2 0
0 0 3 0 2
Mathematics for Computations

Transpose a Matrix
• Matrix Transpose: if A= 𝑎𝑖𝑗 is an rXc matrix, then the transpose of
𝑇 𝑇
A, 𝐴𝑇 = 𝑎𝑗𝑖 is the rXc matrix defined by 𝑎𝑖𝑗 = 𝑎𝑗𝑖


Mathematics for Computations

Matrices Operations
MATRIX OPERATION
• Matrix algebra has operation called
▪ Addition
▪ Substration
▪ Multiplication
No division in matrix algebra , instead there is matrix
inversion.
Matrix Equality

• The simplest relationship between two matrices is equality

• Two matrices should be equal if their corresponding


elements are equal.

• This the case provided that the two matrices are the same
order (size)
Matrix Equality (cont)
• If 𝐴 = 𝑎𝑖𝑗 and B= 𝑏𝑖𝑗 are equal if they have the same
𝑟𝑋𝑐 𝑟𝑋𝑐
order and if 𝑎𝑖𝑗 =𝑎𝑖𝑗 for all i and j.
• Thus the equality
5𝑥 + 2𝑦 7
• =
𝑥 − 3𝑦 1

• Implies that
5𝑥 + 2𝑦 = 7 𝑎𝑛𝑑 𝑥 − 3𝑦 = 1
Mathematics for Computations

Matrix Addition & Substraction of matrices


• To add or subtract matrices, they must be of the same order, rXc.
To add matrices of the same order, add their corresponding
entries. To subtract matrices of the same order, subtract their
corresponding entries. The general rule is as follows using
mathematical notation:

A + B =  aij + bij 
A − B =  aij − bij 
Additional Matrices

EXAMPLE:

• 1. Add the matrices • Solution: Adding


corresponding entries we have
 4 −3 1   −1 2 3 4 + (−1) −3 + 2 1+3
 0 5 −2  +  6 −7 9  0+6 5 + (−7) −2 + 9
   
 5 −6 0   0 −4 8  5+0 −6 + (−4) 0 + 8
• First, note that each  3 −1 4 
matrix has dimensions of 6 −2 7 
3X3, so we are able to
perform the addition. The
 
result is shown at right: 5 −10 8 
Subtraction of matrices
Example:
• Now, we will subtract • Subtract corresponding entries as
the same two matrices follows:

 4 −3 1   −1 2 3  4 − (−1) −3 − 2 1− 3 
 0−6 
 0 5 −2  −  6 −7 9   5 − ( −7) −2 − 9 
     5 − 0 −6 − (−4) 0 − 8 
 5 −6 0   0 −4 8 

 5 −5 −2 
 −6 12 −11
 
 5 −2 −8 
Mathematics for Computations

Exercise 1:
Given A and B ,

5 1 −6 3
A= 7 3 B= 2 −1
−2 −1 4 1

Find the :
1) A+B
2) B-A
Exercise 2:
Given Matrix A and B
2 4 6 0 2 3
A= 1 3 5 𝐵 = −7 8 −4
9 10 11 2 1 −11

Find the :
1) B+ A
2) A-B
Critical thinking:

2 7 −12 5 1
A= 1 −3 5 B= 7 3
8 10 10 −2 −1

Can we add and subtract this matrices? Give the reason


Commutative and Associative Laws

• If A, B and C represent matrices of the same order, then

• 1) A + B = B + A

• 2) A + ( B + C ) = ( A + B ) + C

• 3) A + 0 = A
Commutative Law
• Matrix addition is not directional (commutative ) that is

• A+B=B+A

• Matrix substraction is directional (noncommutative), that is

•𝐴−𝐵 ≠𝐵−𝐴
Mathematics for Computations

Matrix Multiplication

• Two matrices are not multiplied together elementwise

• It is not possible to multiply matrices of the same


order while it is possible to multiply certain matrices
of different orders.

• If A and B are two matrices for which multiplication is


defined, it is generally not the case that AB=BA
• General Rules :

Using A ,B and C to denote three matrices for the matrix


product C= AB, the following are the rules for matrix
multiplication:
1. The number of column in the first matrix A must equal the
number of rows in the second matrix B
2. The number of rows in the product Matrix C equals the
number of rows in the first Matrix A
3. The number of columns in the product matrix C equals the
number of column in the second matrix B
Mathematics for Computations

Matrix Multiplication

• The product of two matrices is another matrix


• Two matrices A and B must be conformable for
multiplication to be possible
• i.e. the number of columns of A must equal the number of
rows of B
• Example.
A x B= C
(1x3) (3x1) (1x1)
Mathematics for Computations

Matrix Multiplication
B x A = Not possible!
(2x1) (4x2)

A x B = Not possible!
(6x2) (6x3)

Example
A x B = C
(2x3) (3x2) (2x2)
Matrix Multiplication
Example,
3 2
6 1 0
A= and B= 3 −1
−1 2 1
−3 4
2X3 3X2

• So that (2X3) (3X2)

same order
• The matrix product C= AB is defined it will become AB is 2X2
Example (Cont)

3 1
3 2
A= B= 4 −4
3 −1
2 0
−3 4 3 6
3X2 4X2

So that (3X2) (4X2)

not same order


The matrix product C= AB is not defined
So, how we calculate
the multiplication for
matrices, see this
solution.
Mathematics for Computations

Exercise 3:
2
a) 3 × 6 4 3
4

1 2 5 6 7
b) ×
3 4 8 9 10
Mathematics for Computations

Exercise 3:

1 2 3 1 2 1
c) 4 5 6 × 2 4 6
7 8 9 7 2 5

4 9
3 1 1 4
6 8
d) 5 3 2 1 ×
9 7
6 2 9 5 7 6

You might also like