Lab 3 Applied Linear Algebra For It - 501032: 1 Exercises
Lab 3 Applied Linear Algebra For It - 501032: 1 Exercises
Lab 3
APPLIED LINEAR ALGEBRA FOR IT - 501032
1 Exercises
Exercise 1: Using a command
to create the new matrices
from vectors
x= 1 2 3 4 5 , b= 1 2 3 4 5 6 , c=1:1:30 and d=1:1:25.
1 1 1 1 1 1 6 11 16 21 26
2 2 2 2 2 2 7 12 17 22 27
3
(a) A = 3 3 3 3 (c) C = 3 8 13 18 23 28
4 4 4 4 4 4 9 14 19 24 29
5 5 5 5 5 5 10 15 20 25 30
1 2 3 4 5 6
1 2 3 4 5 6 1 2 3 4 5
1 2 3 4 5 6 6 7 8 9 10
(b) B =
1
2 3 4 5 6 (d) D = 11 12 13 14 15
1 2 3 4 5 6 16 17 18 19 20
1 2 3 4 5 6 21 22 23 24 25
Exercise 2: Write a command that will create a 5×6 matrix with random integer entries with the elements
∈ [a, b], where a, b ∈ Z
1 2 3 3 2 1
Exercise 3: Write a command to flip the matrix A = 4 5 6 horizontally as follows B = 6 5 4
7 8 9 9 8 7
1 2 3 7 8 9
Exercise 4: Write a command to flip the matrix A = 4 5 6 vertically as follows B = 4 5 6
7 8 9 1 2 3
1 2 16 31 22
2 8 12 21 23
Exercise 5: Enter the matrix Y = 4 9 11 14 25 , provide a command to create vectors or
3 6 10 16 34
matrices as follows:
8 12 21
(a) x = 8 12 21 (c) A =
9 11 14
16 1 16 22
12 2 12 23
(b) y = 11
(d) B =
4 11 25
10 3 10 34
Anh H. Vo - [email protected] 1
Ton Duc Thang University
Faculty of Information Technology
2 12 21 23 (f) Create a D matrix from Y whose elements is
(e) C = 4 11 14 25 greater than 12
3 10 16 34
2 4 1
Exercise 6: Given the matrix A = 6 7 2 , provide commands to do the following:
3 5 9
Anh H. Vo - [email protected] 2
Ton Duc Thang University
Faculty of Information Technology
Exercise 12: Write a command to compute the determinant of the matrices below:
6 0 0 5 1 −2 5 2 3 5 −8 4
1 7 2 −5 0 0 3 0 0 −2 3 −7
A= , B = , C = ,
2 0 0 0 2 −6 −7 5 0 0 1 5
8 3 1 8 5 0 4 4 0 0 0 2
4 0 0 0 4 0 −7 3 −5 6 3 2 4 0
7 −1 0 0 0 0 2 0 0 9 0 −4 1 0
2
D= 6 3 , E = 7
0 3 −6 4 −8 , F =
8 −5 6 7 1
5 −8 3 0 5 0 5 2 −3 3 0 0 0 0
5 −8 4 −3 0 0 9 −1 2 4 2 3 2 0
Exercise 13: Is it true that det(A + B)=detA+detB? To find out, generate random 5 × 5 matrices A
and B, and compute det(A + B)−detA−detB. Repeat the calculations for three other pairs of n × n
matrices, for various values of n.
Exercise 14: Is it true that detAB=(detA)(detB)?. Repeat the calculation for four pairs of random ma-
trices.
2 4 25 1 −1 3
2 4
Exercise 15: Let A and B be the following 3 × 3 matrices −3
4 2 41 , B = 32 1
2 −2
1 1 1 1
4 2 2 4 1 2
Anh H. Vo - [email protected] 3