AIX7038-HW1
Minhah Saleem ID:2023120344
Basic Calculus
𝟏
Q1: If 𝒇(𝒙) = , find 𝒇′(𝒙) .
𝒙𝟐 +𝟏
Solution:
1
𝑓(𝑥) =
𝑥2 + 1
𝑓 ′ (𝑥) = −(𝑥 2 + 1)−2 . 2𝑥
−𝟐𝒙
𝒇′ (𝒙) = 𝟐
(𝒙 + 𝟏)𝟐
Q2: If f(x) = e2x, g(x) = 3x2 + 1, find h′(x) where h(x) = f(g(x)).
Solution:
𝑓(𝑥) = 𝑒 2𝑥
𝑔(𝑥) = 3𝑥 2 + 1
2
ℎ(𝑥) = 𝑓(𝑔(𝑥)) = 𝑓(3𝑥 2 + 1) = 𝑒 2(3𝑥 +1)
2
ℎ(𝑥) = 𝑒 (6𝑥 +2)
2
ℎ′ (𝑥) = 𝑒 (6𝑥 +2) . 6(2𝑥)
𝟐
𝒉′ (𝒙) = 𝟏𝟐𝒙𝒆(𝟔𝒙 +𝟐)
𝜹𝒇(𝒙,𝒚)
Q3: If f(x, y) = y log(1 − x) + (1 − y) log(x) for x ∈ (0, 1), evaluate 𝜹𝒙
at the point (0.5, 0.5).
Solution:
𝑓(𝑥, 𝑦) = 𝑦 log(1 − 𝑥) + (1 − 𝑦) log(𝑥)
𝛿𝑓(𝑥, 𝑦) 𝛿[𝑦 𝑙𝑜𝑔(1 − 𝑥)] 𝛿[(1 − 𝑦) log(𝑥)]
= +
𝛿𝑥 𝛿𝑥 𝛿𝑥
𝛿𝑓(𝑥, 𝑦) 1 𝛿𝑦 1 𝛿(1 − 𝑦)
= [𝑦. . (−1) + log(1 − 𝑥) . ] + [(1 − 𝑦). + log 𝑥 . ]
𝛿𝑥 (1 − 𝑥) ln 10 𝛿𝑥 𝑥𝑙𝑛 10 𝛿𝑥
𝛿𝑓(𝑥, 𝑦) −𝑦 1−𝑦
= +
𝛿𝑥 (1 − 𝑥) ln 10 𝑥 ln 10
𝛿𝑓(0.5,0.5) −0.5 1 − 0.5 −0.5 0.5 −1 1
= + = + = +
𝛿𝑥 (1 − 0.5)𝑙𝑛10 0.5 𝑙𝑛10 (0.5)𝑙𝑛10 0.5 𝑙𝑛10 𝑙𝑛10 𝑙𝑛10
𝜹𝒇(𝟎. 𝟓, 𝟎. 𝟓)
= 𝟎
𝜹𝒙
Probability and Statistics
• Consider random variables A, B that can take on different values, e.g., A = {a1, a2} and B = {b1,
b2}. Below are some notations to keep in mind:
o P (A = a1, B = b1) = P (A = a1 ∩ B = b1) = P(a1, b1)
𝑃(𝑎1,𝑏1)
o P(a1∣b1) = 𝑃(𝑏1)
o p(a1) = ∑𝑏∈𝐵 𝑝(𝑎1, 𝑏)
• Consider random variables X,Y that can take on values on set X,Y respectively
Below are some notations to keep in mind.
Q1: Assume we have two random variables A and B which are independent, each can take on two
values A = {a1, a2} and B = {b1, b2}. We have p(a1) = 0.5, p(b2) = 0.5.
Part 1: What is p(a1, b2)?
p(a1, b2) = p(A = a1 ∩ B = b2) = p(A = a1) * p(B = b2) = 0.5 * 0.5 = 0.25
Part2: What is p(a1, b1)?
p(a1, b1) = p(A = a1 ∩ B = b1) = p(A = a1) * p(B = b1) = 0.5 * 0.5 = 0.25
Part3: What is p(a1∣b2)?
𝑃(𝑎1,𝑏2)
P(a1∣b2) =
𝑃(𝑏2)
p(a1∣b2) = p(A = a1 ∣ B = b2) = p(A = a1 ∩ B = b2) / p(B = b2)
= p(A = a1) * p(B = b2) = 0.5 * 0.5 = 0.25
p(B = b2) = p(A = a1 ∩ B = b2) + p(A = a2 ∩ B = b2) = p(A = a1) * p(B = b2) + p(A = a2) * p(B = b2) = 0.5
* 0.5 + 0.5 * 0.5 = 0.5
P(a1∣b2) = 0.25 / 0.5 = 0.5
Q2: What is the expectation of X where X is a single roll of a fair 6-sided dice (with sides
X = {1, 2, 3, 4, 5, 6})? What is the variance of X?
For a fair dice, the probability of each number is 1/6.
E[X] = Σ(x * p(x)) for all x in X
E[X] = (1*1/6) + (2*1/6) + (3*1/6) + (4*1/6) + (5*1/6) + (6*1/6)
E[X] = 3.5
Var[X] = E[(𝑋 − 𝐸[𝑋])2 ]
Putting E[X] = 3.5,
Var[X] = E[(𝑋 − 3.5)2]
For a fair dice,
Var[X] = Σ[(𝑋 − 3.5)2 * p(x)] for all x in X
Var[X] = [(1 − 3.5)2 * 1/6] + [(2 − 3.5)2 * 1/6] + [(3 − 3.5)2 * 1/6] + [(4 − 3.5)2 * 1/6] + [(5 − 3.5)2 *
1/6] + [(6 − 3.5)2 * 1/6]
Var[X] = 2.92
Q3: With arbitrary random variables X, Y , when is the mutual information I(X; Y ) = 0? What does
it mean?
The mutual information I(X; Y) is given as:
I(X; Y) = H(Y) - H(Y|X)
If I(X; Y) = 0, it means that knowing the value of one random variable does not provide any
information about the other variable. In other words, X and Y are independent.
Lecture 2: Decision Tree
Error rate of A: 4/8
Error rate of B: 1/8
Error rate C: 3/8
Based on error rate, Feature B should be used.
Error rate of A after B: 0
Error rate of C after B: 1/4