Week 2
Week 2
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
Answer: B, D
Explanation:
f (x) is continuous at x = 3 if limx→3− f (x) = limx→3+ f (x) = f (3)
LHL ̸= RHL
Therefore, the function is not continuous at x = 3
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:
√ √
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.
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
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
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
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
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: 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
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.