0% found this document useful (0 votes)
39 views

Week 2

The document provides solutions to 11 multiple choice questions about concepts in machine learning and calculus including: 1) Identifying which functions are continuous. 2) Determining which options are not equivalent representations of a d-dimensional vector. 3) Analyzing continuity and differentiability of a piecewise defined function. 4) Approximating values using Taylor series expansions. 5) Identifying perpendicular vectors. 6) Computing gradients and linear approximations.

Uploaded by

ng0934325
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Week 2

The document provides solutions to 11 multiple choice questions about concepts in machine learning and calculus including: 1) Identifying which functions are continuous. 2) Determining which options are not equivalent representations of a d-dimensional vector. 3) Analyzing continuity and differentiability of a piecewise defined function. 4) Approximating values using Taylor series expansions. 5) Identifying perpendicular vectors. 6) Computing gradients and linear approximations.

Uploaded by

ng0934325
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Course: Machine Learning - Foundations

Week 2 - Graded assignment

1. Which of the following functions is/are continuous?


1
A. x−1
x2 −1
B. x−1
C. sign(x − 2)
D. sin(x)

Answer: D
Explanation: Option A is not defined at x = 1 therefore, it’ll have a breakpoint there.
Hence, not continuous.
In option B, the function is again not continuous at x = 1. One may try to simplify the
option as follows:

x2 − 1 (x − 1)(x + 1)
=
x−1 x−1
Please note that you cannot cancel out (x − 1) here because you would be assuming that
x − 1 is not equal to 0. But, we get (x − 1) = 0 at x = 1. Here, limits exist but that
doesn’t necessarily mean that the function is continuous.
Option C is discontinuous at x = 2.
Option D is continuous at all points.

2. Regarding a d-dimensional vector x, which of the following four options is not equivalent
to the rest three options?
A. xT x
B. ||x||2
Pd 2
C. i=1 xi
D. xxT

Answer: D
Explanation:
d
X
T
x·x=x x= x2i
i=1

q
||x|| = x21 + x22 + ... + x2d
Course: Machine Learning - Foundations Page 2 of 8

d
X
2
=⇒ ||x|| = x21 + x22 + ... + x2d = x2i
i=1

xT x ̸= xxT

Therefore, options A, B, and C are equivalent but option D is different.

3. Consider the following function:


(
3x + 3, if x ≥ 3
f (x) =
2x + 8, if x<3

Which of the following is/are true?


A. f (x) is continuous at x = 3.
B. f (x) is not continuous at x = 3.
C. f (x) is differentiable at x = 3.
D. f (x) is not differentiable at x = 3.

Answer: B, D
Explanation:
f (x) is continuous at x = 3 if limx→3− f (x) = limx→3+ f (x) = f (3)

lim (2x + 8) = 2(3) + 8 = 14


x→3−

lim (3x + 3) = 3(3) + 3 = 12


x→3+

LHL ̸= RHL
Therefore, the function is not continuous at x = 3

For a function to be differentiable, the minimum requirement for it is to be continu-


ous at that point. As our function is not continuous, it cannot be differentiable.
Hence, options B and D are the correct options.

4. Approximate the value of e0.011 by linearizing ex around x=0.

Answer: 1.011
Explanation: To approximate the value of e0.011 by linearizing ex around x = 0, we can
use the first-order Taylor expansion of ex around the limit x = a, which is given by:
Course: Machine Learning - Foundations Page 3 of 8

ex ≈ ea + ea (x − a)

where a is the point around which we are linearizing (in this case, a = 0).
Using this approximation, we have:

e0.011 ≈ e0 + e0 (0.011 − 0) = 1 + 1(0.011) = 1.011

Therefore, the approximate value of e0.011 obtained by linearizing ex around x = 0 is


approximately 1.011.

√ √
5. Approximate 3.9 by linearizing x around x = 4.

Answer: 1.975
√ √
Explanation: To approximate the value of√ 3.9 by linearizing x around x = 4, we
can use the first-order Taylor expansion of x around the limit x = 0, which is given
by:

√ √ 1
x ≈ a + √ (x − a)
2 a
Using this approximation, we have:

√ √ 1 1
3.9 ≈ 4 + √ (3.9 − 4) = 2 + (−0.1) = 2 − 0.025 = 1.975
2 4 4
√ √
Therefore, the approximate value of 3.9 obtained by linearizing x around x = 4 is
approximately 1.975.

6. Which of the following pairs of vectors are perpendicular to each other?


A. [2, 3, 5] and [-2, 3, -1]
B. [1, 0, 1] and [0, 1, 1]
C. [1, 2, 0] and [0, 1, 2]
D. [0, 1, 0] and [0, 0, 1]
E. [2, -3, 5] and [-2, 3, -5]
F. [1, 0, 0] and [0, 1, 0]

Answer: A, D, E, F
Explanation: If 2 vectors are perpendicular to each other, the 2 vectors must have the
dot product equal to 0.
Course: Machine Learning - Foundations Page 4 of 8

Only options A, D, E, and F result in a dot product = 0.

7. What is the linear approximation of f (x, y) = x3 + y 3 around (2, 2)?


A. 4x + 4y − 8
B. 12x + 12y − 32
C. 12x + 4y − 8
D. 12x + 12y + 32

Answer: B
Explanation:
 
3x2
∇f (x, y) =
3y 2
 
12
=⇒ ∇f (2, 2) =
12

x − x∗
 
∗ ∗ T
Lx∗,y∗ [f ](x, y) =f (x, y) + ∇f (x , y ) ·
y − y∗
 
  x−2
=16 + 12 12
y−2
=16 + 12x − 24 + 12y − 24
=12x + 12y − 32

8. What is the gradient of f (x, y) = x3 y 2 at (1, 2)?


A. [12, 4]
B. [4, 12]
C. [1, 4]
D. [4, 1]

Answer: A
Explanation:
 2 2    
3x y 3(1)2 (2)2 12
∇f (x, y) = =⇒ ∇f (1, 2) = =
2x3 y 2(1)3 (2) 4

9. The gradient of f = x3 + y 2 + z 3 at x = 0, y = 1 and z = 1 is given by,


Course: Machine Learning - Foundations Page 5 of 8

A. [1, 2, 3]
B. [-1, 2, 3]
C. [0, 2, 3]
D. [2, 0, 3]

Answer: C
Explanation: The gradient of f = x3 + y 2 + z 3 is given by:
 
∂f ∂f ∂f
∇f = , ,
∂x ∂y ∂z

Taking the partial derivatives:


∂f ∂f ∂f
= 3x2 , = 2y, = 3z 2
∂x ∂y ∂z
Evaluating these partial derivatives at x = 0, y = 1, and z = 1:
∂f
(0, 1, 1) = 3(0)2 = 0
∂x
∂f
(0, 1, 1) = 2(1) = 2
∂y
∂f
(0, 1, 1) = 3(1)2 = 3
∂z
Therefore, the gradient ∇f (0, 1, 1) = [0, 2, 3].

10. For two vectors a and b, which of the following is true as per Cauchy-Schwarz inequality?
(i) aT b ≤ ||a|| ∗ ||b||
(ii) aT b ≥ −||a|| ∗ ||b||
(iii) aT b ≥ ||a|| ∗ ||b||
(iv) aT b ≤ −||a|| ∗ ||b||

A. (i) only
B. (ii) only
C. (iii) only
D. (iv) only
E. (i) and (ii)
F. (iii) and (iv)

Answer: E ((i) and (ii))


Course: Machine Learning - Foundations Page 6 of 8

Explanation: According to Cauchy-Schwarz inequality:

−||a|| · ||b|| ≤ aT b ≤ ||a|| · ||b||

11. The directional derivative of f (x, y, z) = x3 + y 2 + z 3 at (1, 1, 1) in the direction of unit


vector along v = [1, −2, 1] is .

Answer: 0.816
Explanation: directional derivative is given by the dot product of gradient at a point
with a unit vector along which the directional derivative is needed.

 2
3x
∇f (x, y, z) =  2y 
3z 2
 
3
=⇒ ∇f (1, 1, 1) = 2
3

Next, let’s find the unit vector along [1, −2, 1]. To do that, we divide the vector by its
[1, −2, 1]
magnitude: u =
∥[1, −2, 1]∥
p √
Calculating the magnitude: ∥[1, −2, 1]∥ = 12 + (−2)2 + 12 = 6

√ 

1/ √6
=⇒ u = −2/√ 6
1/ 6
√ 
  1/ √6
Du [f ](v) = ∇f (1, 1, 1) · u = 3 2 3 −2/√ 6

1/ 6

Therefore, the directional derivative of f (x, y, z) at (1, 1, 1) in the direction of the unit
2
vector along [1, −2, 1] is √ .
6

12. The direction of steepest ascent for the function 2x + y 3 + 4z at the point (1, 0, 1) is
h i
A. √220 , 0 √420 ,
h i
B. √129 , 0 √129 ,
Course: Machine Learning - Foundations Page 7 of 8
h i
−2 √4 ,
C. √
29
, 0 29
h i
√2 , −4
D. 20
0 √
20
,

Answer: A
Explanation:
Let f (x, y, z) = 2x + y 3 + 4z
 
2
∇f (x, y, z) = 3y 2 
4
 
2
=⇒ ∇f (1, 0, 1) = 0
4

To obtain the direction of steepest ascent, we need to normalize the gradient vector.
The magnitude of the gradient vector is:
√ √ √
∥∇f (1, 0, 1)∥ = 22 + 02 + 42 = 20 = 2 5

Therefore, the direction of steepest ascent for the function 2x + y 3 + 4z at the point
2 4
(1, 0, 1) is √ , 0 √ ,
20 20

13. The directional derivative of f (x, y, z) = x + y + z at (−1, 1, 0) in the direction of unit


vector along [1, -1, 1] is .

Answer: 0.577
Explanation: To find the directional derivative of f (x, y, z) = x + y + z at (−1, 1, 0) in
the direction of the unit vector along [1, −1, 1], we need to calculate the dot product of
the gradient of f at that point with the unit vector.

 
1
∇f (x, y, z) = 1

1
 
1
=⇒ ∇f (−1, 1, 1) = 1

1

Next, let’s find the unit vector along [1, −1, 1]. To do that, we divide the vector by its
[1, −1, 1]
magnitude: u =
∥[1, −1, 1]∥
Course: Machine Learning - Foundations Page 8 of 8
p √
Calculating the magnitude: ∥[1, −1, 1]∥ = 12 + (−1)2 + 12 = 3
Therefore,
 
1 1 1 1
u = √ [1, −1, 1] = √ , − √ , √
3 3 3 3

 
1 1 1
Du [f ](v) = ∇f (−1, 1, 0) · u = (1, 1, 1) · √ , − √ , √
3 3 3
Therefore, the directional derivative of f (x, y, z) = x + y + z at (−1, 1, 0) in the direction
1
of the unit vector along [1, −1, 1] is √ ≈ 0.577.
3

14. Which of the following is the equation of the line passing through (7, 8, 6) in the direction
of vector [1, 2, 3]
A. [1, 2, 3] + α[−6, −6, 3]
B. [7, 8, 9] + α[−6, −6, 3]
C. [1, 2, 3] + α[6, 6, 3]
D. [7, 8, 6] + α[6, 6, 3]
E. [7, 8, 6] + α[1, 2, 3]
F. [1, 2, 3] + α[7, 8, 6]

Answer: E
Explanation: A line through the point u ∈ Rd along a vector v ∈ Rd is given by the
equation
x = u + αv
=⇒ x = [7, 8, 6] + α[1, 2, 3]
So, option E is the answer.

You might also like