You are on page 1of 8

Course: Machine Learning - Foundations

Week 3: Practice questions

 
1
1. (1 point) What is the length of the vector  1 ?
−1
A. 1.73
B. 1.71
C. 1.72
D. 1.74

Answer: A
Solution:
Using the definition of length of a vector,
 
1 p √
1 = 12 + 12 + (−1)2 = 3 ≈ 1.732
−1

∴ Option A is correct.

   
1 −1
2. (1 point) The inner product of 0 and  2  is
3 4
A. 11
B. 12
C. 31
D. 20

Answer: A
Solution:
Using the definition of the standard inner product,
   
1 −1
< 0 ,  2  > = (1)(−1) + (0)(2) + (3)(4) = 11
3 4

∴ Option A is correct.
Course: Machine Learning - Foundations Page 2 of 8
 
0 1 2
3. (1 point) The rank of the matrix, A = 1 2 1 is
2 7 8
A. 0
B. 1
C. 2
D. 3

Answer: C
Solution:
To solve this question, we can first find the row echelon form of A. Then the rank of the
matrix is the number of pivots (or free variables) in R.
       
0 1 2 1 2 1 1 2 1 1 2 1
R1 ⇆R2 R3 →R3 −2R1 R3 →R3 −3R2
A = 1 2 1 −−−−→ 0 1 2 −− −−−−−→ 0 1 2 −− −−−−−→  0 1 2 = R
2 7 8 2 7 8 0 3 6 0 0 0
We can see that R has 2 pivots, so A has a rank of 2.

∴ Option C is correct.

 
1 0 2
4. (1 point) The rank of the matrix, A = 2 1 0 is
3 2 1
A. 0
B. 1
C. 2
D. 3

Answer: D
Solution:
We can take the determinant of A

1 0 2
det(A) = 2 1 0
3 2 1
Expanding determinant along R1 ,
1 0 2
2 1 0 = (1)[(1)(1) − (0)(2)] − 0 + (2)[(2)(2) − (1)(3)]
3 2 1
= 3 ̸= 0
Course: Machine Learning - Foundations Page 3 of 8

We can see that the determinant of this 3×3 matrix is non-zero. This implies the matrix
is full rank. That is, rank(A)= 3.

∴ Option D is correct.

5. (1 point) Can we span the entire 4-d space using the four column vectors given in the
following matrix?

 
1 2 3 4
0 2 2 0
 
1 0 3 0
0 1 0 4
A. Yes
B. No

Answer: A
Solution:
Here, we wish to find out if the column space of a 4 × 4 matrix spans all of 4-d space.
This can only happen if and only if the determinant of the matrix is non-zero. So, we have

1 2 3 4
0 2 2 0
det =
1 0 3 0
0 1 0 4
Expanding along C4 ,
0 2 2 1 2 3
det = −(4) 1 0 3 + 0 − 0 + (4) 0 2 2
0 1 0 1 0 3

Expanding both sub-determinants along C1 ,


h i h i
det = (−4)(−1) (2)(0) − (2)(1) + (4) (1)[(2)(3) − (2)(0)] + (1)[(2)(2) − (2)(3)]
= (4)(−2) + (4)(6 − 2) = 8 ̸= 0
We can see that the determinant is non-zero. This implies the matrix is full rank. That
is, the column space = R4 .

∴ Option A is correct.
Course: Machine Learning - Foundations Page 4 of 8

6. (1 point) What is the rank of the following matrix?

 
2 6 8
3 7 10
 
4 8 12
5 9 14
A. 0
B. 1
C. 2
D. 3

Answer: C
Solution:
Let the above matrix be A. Now, to solve this question, we can first find the row echelon
form of A. Then, the rank of the matrix is the number of pivots (or basic variables) in R.

   
2 6 8 1 3 4
3 7 10 R1 → 21 R1 3 7 10
A= − −−−−→  
4 8 12 4 8 12
5 9 14 5 9 14
 
1 3 4
R2 →R2 −3R1  0 −2 −2
−− −−−−−→  
R3 →R3 −4R1  0 −4 −4
5 9 14
 
1 3 4
R2 → −1 R2 0 1 1
−−−−−2−−→  
R4 →R4 −5R1 0 −4 −4
0 −6 −6
 
1 3 4
R3 →R3 +4R2  0 1 1
−−−−−−−→  =R
R4 →R4 +6R2  0 0 0
0 0 0
We can see that R has 2 pivots, so A has a rank of 2.

∴ Option C is correct.

 
1 2 3
7. (1 point) The rank of matrix 2 3 6 is
4 5 9
Course: Machine Learning - Foundations Page 5 of 8

A. 1
B. 2
C. 3
D. 4

Answer: C
Solution:
Let us find the determinant of the matrix.
1 2 3 h i h i h i
2 3 6 = 1 (3)(9) − (5)(6) − 2 (2)(9) − (4)(6) + 3 (2)(5) − (4)(3)
4 5 9
= −3 − 2(−6) + 3(−2) = 3 ̸= 0

We can see that the determinant of this 3×3 matrix is non-zero. This implies the matrix
is full rank. That is, rank(A)= 3.

∴ Option C is correct.

8. (1 point) Rank of a 4 × 3 matrix is 2, what is the dimension of its null space?


A. 3
B. 1
C. 2
D. 4

Answer: B
Solution: To solve this question, we will make use of the rank nullity theorem which
states for any m × n matrix,

rank(A) + nullity(A) = n

Using the fact that here, n = 3 and rank(A) = 2, and substituting these values into the
above equation, we get nullity(A) = 1.

∴ Option B is correct.

 
2 4 6 8
9. (1 point) Which of the following represents the row space of the matrix 1 3 0 5?
1 1 6 3
(Note: span {S} denotes the set of linear combinations of the elements of S)
Course: Machine Learning - Foundations Page 6 of 8
   

 1 0 
   
0 ,  1 

A. Span 9 −3

 
2 1
 
   

 9 −2 
   
 , 1 
3

B. Span 1  0 

 
0 1
 
   

 1 0 
   
  , 1
0

C. Span −9 0

 
0 1
 
   

 0 3 
   
3 , −1

D. Span 1  0 

 
0 1
 

Answer: A
Solution:

To solve this question, we will make use of the fact that the row space of a matrix
does not change when applying row operations. Let the matrix given be A and it’s
reduced row echelon form be R. Then, rowspace(A) =rowspace(R).

   
2 4 6 8 R →1R 1 2 3 4
1 1
A = 1 3 0 5 −−−−2−→ 1 3 0 5
1 1 6 3 1 1 6 3
 
1 2 3 4
R →R −R1
−−2−−−2−−→ 0 1 −3 1 
R3 →R3 −R1
0 −1 3 −1
 
1 2 3 4
R →R +R2
−−3−−−3−−→ 0 1 −3 1
0 0 0 0
 
1 0 9 2
R1 →R1 −2R2
−− −−−−−→ 0 1 −3 1 = R
0 0 0 0
Since rowspace(A) = rowspace(R), then a basis for the row space of A can be the pivot
rows of R. That is,    

 1 0 
   
0  1 

rowspace(A) = span   ,  


 9 −3 
2 1
 
Course: Machine Learning - Foundations Page 7 of 8

∴ Option A is correct.

 
3
10. (1 point) Find the projection matrix for v= 3

3
1 1 1
3 3 3
A.  13 1
3
1
3
1 1 1
3 3 3
−1
1 1

3 3 3
B.  −1 1 −1 
3 3 3
1 −1 1
3 3 3
 −1 1 −1

3 3 3
1 −1 1 
C. 3 3 3
−1 1 −1
3 3 3
 −1 1 1

3 3 3
1 −1 1 
D. 3 3 3
1 1 −1
3 3 3

Answer: A
Solution:
The projection matrix P for a vector v is given by

vv T
P =
vT v
 
3
Here, v = 3, so the outer product is

3
   
3  9 9 9
vv T = 3 3 3 3 = 9 9 9


3 9 9 9

And the inner product is v T v = ||v||2 = 32 + 32 + 32 = 27.

Finally, P is given by  1 1 1
 
9 9 9
1  3 3 3
P = 9 9 9 =  13 1
3
1
3
27 1 1 1
9 9 9 3 3 3

∴ Option A is correct.

11. (1 point) Find the projection of [1, −4, 2] along [1, −2, −3]
Course: Machine Learning - Foundations Page 8 of 8

−6 −9
3 
A.
 14
3
14
6 9
14

B. 14 14 14
 −3 −6 −9

C.
 14
3 6
14
−9
14

D. 14 14 14

Answer: A
Solution:
The projection of a vector a along a vector b is given by
 aT b 
projb a = b
bT b
   
1 1
Here, a = −4 and b = −2. Substituting these values into the above expression,
2 −3
we get  
  1
(1)(1) + (−4)(−2) + (2)(−3)  
projb a = −2
12 + (−2)2 + (−3)2
−3
 
1
3  
= −2
14
−3
3
14

=  −6
 
14 
−9
14

∴ Option A is correct.

You might also like