Lab 07
Lab 07
Lab 7
APPLIED LINEAR ALGEBRA FOR IT - 501032
1 Exercises
Exercise 1: Determine if w is a linear combination of the vectors below
(a) v1 = (1, 2, 3, 4), v2 = (−1, 0, 1, 3), v3 = (0, 5, −6, 8) and w = (3, −6, 17, 11)
(b) v1 = (1, 1, 2, 2), v2 = (2, 3, 5, 6), v3 = (2, −1, 3, 6) and w = (0, 5, 3, 0)
(c) v1 = (1, 1, 2, 2), v2 = (2, 3, 5, 6), v3 = (2, −1, 3, 6) and w = (−1, 6, 1, −4)
(d) v1 = (1, 2, 3, 4), v2 = (−1, 0, 1, 3), v3 = (0, 5, −6, 8), v4 = (1, 15, −12, 8) and w = (0, −6, 17, 11)
Exercise 2: Write program to verify
(a) Whether the vectors {(1, −2, 0)T , (0, −4, 1)T , (1, −1, 1)T } are linearly independent or not.
(b) Whether the vectors {(1, 0, 2)T ,(0, 1, 4)T ,(2, −2, −4)T } are linearly independent or not. Find (a, b, c)
that a(1, 0, 2)T + b(0, 1, 4)T + c(2, −2, −4)T = 0. Store the values of (a, b, c) in a vector x.
(c) Whether the vectors {(1, −2, 3, 4), (2, 4, 5, 0), (−2, 0, 0, 4), (3, 2, 1, −1)} are linearly independent or
not.
(d) Whether the vectors {(0, 0, 1, 2, 3), (0, 0, 2, 3, 1), (1, 2, 3, 4, 5), (2, 1, 0, 0, 0), (−1, −3, −5, 0, 0)} are lin-
early independent or not.
Exercise 3: Let the matrix
1 0 2 3
C= 4 −1 0 2
0 −1 −8 −10
(a) Find a basis for the col(C)
(b) Find a basis for the row(C)
Exercise 4: Let the matrix
1 0 2 3
A2 = 4 −1 0 2
0 −1 −8 −10
(a) Find a basis for the null-space of A2 and the stored answer as column vectors:
• v1 = the first vector in basis
• v2 = the second vector in basis
(b) Check to find if any linear combination of v1 and v2 is in null(A2). For example, A2LC = A2 *(a∗v1
- b ∗ v2 ), find a, b
Anh H. Vo - [email protected] 1
Ton Duc Thang University
Faculty of Information Technology
Exercise 5: Write the program to determine whether w is the column space of A, the null space of A, or
both, where
1 7 6 −4 1
1 −5 −1 0 −2
(a) w = −1 , A = 9 −11 7 −3
−3 19 −9 7 1
1 −8 5 −2 0
2 −5 2 1 −2
1 , A = 10 −8 6 −3
(b) w =
0 3 −2 1 0
Exercise 6: Let a1 , a2 , ...a5 donate the columns of the matrix A, where
5 1 2 2 0
3 3 2 −1 −12
B = [a1 a2 a4 ], A =
8 4 4 −5 12
2 1 1 0 −2
Exercise 7: What is the dimention of span {(1, 0, 2)T , (0, 1, 4)T , (2, −2, −4)T }. What is the basis for their
span?
Exercise 8: Find a basis for the null space of the given matrix A.
(a) A = Hilbert matrix with size 5
(b) A = Pascal matrix with size 5
(c) A = Magic matrix with size 5
Note:
• Hilbert matrix: A square with entries being the unit fractions
1
H(i, j) =
i+j−1
• Pascal matrix: A is a symmetric positive definite matrix with integer entries taken from Pascal’s
triangle. There are three ways to achieve this: as either an upper-triangular matrix, a lower-
triangular matrix, or a symmetric matrix.
n!
P (i, j) =
r!(n − r)!
• Magic matrix: A square with numbers so that the total of each row, each column and each
main diagonal are all the same.
Anh H. Vo - [email protected] 2
Ton Duc Thang University
Faculty of Information Technology
Hint: Consider each possible pairs of distinct vectors < ui uj >= 0 whenever i 6= j
−1
3 −1 2
For example u1 = 1 , u2 = 2 , u3 = 2
7
1 1
2
Exercise 10: Let y and u vector. Write a function to find the orthogonal projection of y on u.
<y·u> 7 4
Hint: proju y = u. For example, y = and u =
<u·u> 6 2
Exercise 11: Let a matrix m × n, write a function to check that has orthonormal columns.
Exercise 12: Use the Gram - Schmidt process to produce an orthogonal basis for column space of
−10 13 7 −11
2 1 −5 3
A= −6 3 13 −3
16 −16 −2 5
2 1 −5 −7
Anh H. Vo - [email protected] 3