0% found this document useful (0 votes)
12 views17 pages

Partial Derivatives and Gradients in Math

The document provides an overview of mathematical concepts relevant to data science, focusing on partial derivatives, gradients, directional derivatives, and the Hessian matrix. It includes examples demonstrating how to compute these derivatives and interpret them geometrically. Additionally, it discusses the Jacobian matrix and properties of functions, such as invertibility and the gradient of functions involving symmetric matrices.

Uploaded by

Harshit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views17 pages

Partial Derivatives and Gradients in Math

The document provides an overview of mathematical concepts relevant to data science, focusing on partial derivatives, gradients, directional derivatives, and the Hessian matrix. It includes examples demonstrating how to compute these derivatives and interpret them geometrically. Additionally, it discusses the Jacobian matrix and properties of functions, such as invertibility and the gradient of functions involving symmetric matrices.

Uploaded by

Harshit
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Mathematics for Data Science

Dr. Indu Joshi

Assistant Professor at
Indian Institute of Technology Mandi

26 October 2024
Rule for Finding Partial Derivatives of z 苷 f 共x, y兲
Partial Derivative- Example1
1. To find fx , regard y as a constant and differentiate f 共x, y兲 with respect to x.
2. To find fy , regard x as a constant and differentiate f 共x, y兲 with respect to y.

EXAMPLE 1 If f 共x, y兲 苷 x 3 ⫹ x 2 y 3 ⫺ 2y 2, find fx 共2, 1兲 and fy 共2, 1兲.

SOLUTION Holding y constant and differentiating with respect to x, we get

fx 共x, y兲 苷 3x 2 ⫹ 2xy 3

and so fx 共2, 1兲 苷 3 ⴢ 2 2 ⫹ 2 ⴢ 2 ⴢ 13 苷 16

Holding x constant and differentiating with respect to y, we get

fy 共x, y兲 苷 3x 2 y 2 ⫺ 4y

fy 共2, 1兲 苷 3 ⴢ 2 2 ⴢ 12 ⫺ 4 ⴢ 1 苷 8

Interpretations of Partial Derivatives


To give a geometric interpretation of partial derivatives, we recall that the e
vector function ⵜ f defined by
Gradient- Example2
⭸f ⭸f
ⵜ f 共x, y兲 苷 具 fx 共x, y兲, fy 共x, y兲典 苷 i⫹ j
⭸x ⭸y

PLE 3 If f 共x, y兲 苷 sin x ⫹ e x y, then

ⵜ f 共x, y兲 苷 具 fx , fy 典 苷 具 cos x ⫹ ye x y, xe x y 典

ⵜf 共0, 1兲 苷 具 2, 0典

h this notation for the gradient vector, we can rewrite Equation 7 f


ive of a differentiable function as
ATTENTION! If the direction is given by a vector a of any length ( 0), then
Directional Derivative- Example3
df 1
(5*) Da f   a • grad f.
ds ƒaƒ

LE 1 Gradient. Directional Derivative


Find the directional derivative of f (x, y, z)  2x 2  3y 2  z 2 at P: (2, 1, 3) in the direction of a  [1, 0, 2].
Solution. grad f  [4x, 6y, 2z] gives at P the vector grad f (P)  [8, 6, 6]. From this and (5*) we obtain,
since ƒ a ƒ  15,

1 1 4
Da f (P)  [1, 0, 2] • [8, 6, 6]  (8  0  12)    1.789.
15 15 15

The minus sign indicates that at P the function f is decreasing in the direction of a. 䊏
Chain Rule- Example4
If w = x 2 − y 2 and polar coordinates r , θ defined as x = r cos θ,
y = r sin θ. Calculate ∂w ∂w
∂r and ∂θ .

∂w ∂w dx ∂w dy
= · + · .
∂r ∂x dr ∂y dr

∂w ∂w dx ∂w dy
= · + · .
∂θ ∂x dθ ∂y dθ

∂w
= 2x cos θ − 2y sin θ = 2r cos2 θ − 2r sin2 θ = 2r cos 2θ.
∂r
Similarly,
∂w
= 2x(−r sin θ) − 2y (r cos θ) = −2r 2 cos θ sin θ − 2r 2 sin θ cos θ
∂θ
= 2r 2 sin 2θ.
Hessian Matrix- Example5

Let f (x, y ) = x 2 + 4xy + 4y 2 . Determine whether the Hessian


matrix is positive definite.

fx = 2x + 4y

fy = 4x + 8y
fxx = 2, fxy = fyx = 4, fyy = 8
The Hessian matrix H is:
 
2 4
H=
4 8
Hessian Matrix- Example5 (contd.)

- The first principal minor is H11 = 2, which is positive. - The


determinant of H is:

det(H) = (2)(8) − (4)(4) = 16 − 16 = 0

Since the determinant is zero, H is not positive definite.


Jacobian- Example6

 2 
x +y
Let F⃗ (x, y ) = . Compute the Jacobian matrix J of
sin(xy )
F⃗ (x, y ).
∂F1 ∂ 2
= (x + y ) = 2x
∂x ∂x
∂F1 ∂ 2
= (x + y ) = 1
∂y ∂y
∂F2 ∂
= (sin(xy )) = y cos(xy )
∂x ∂x
∂F2 ∂
= (sin(xy )) = x cos(xy )
∂y ∂y
Jacobian- Example6 (contd.)

The Jacobian matrix J of F⃗ (x, y ) is:


" # 
∂F1 ∂F1 
∂x ∂y 2x 1
J = ∂F2 ∂F2 =
∂x ∂y
y cos(xy ) x cos(xy )
Function- Example7
Domain of a Function- Example8
Invertible Function- Example9
Invertible Function- Example9 (contd.)
Vector Gradient- Example10

   
3 x
Let a = and x = 1 . Compute ∇x (aT x) to verify that
−2 x2
∇x (aT x) = a.

aT x = 3x1 − 2x2

(3x1 − 2x2 ) = 3
∂x1

(3x1 − 2x2 ) = −2
∂x2
 
T 3
∇x (a x) = =a
−2
Gradient of a Function in Norm Form- Example11

Let f (x) = ∥x − b∥2 , where b is a constant vector and ∥ · ∥


denotes the Euclidean norm. Find ∇x f (x).

f (x) = (x − b)T (x − b)

f (x) = x T x − 2x T b + b T b
∇x f (x) = ∇x (x T x − 2x T b + b T b)
Since ∇x (x T x) = 2x and ∇x (−2x T b) = −2b, we have:

∇x f (x) = 2x − 2b
Gradient with a Symmetric Matrix- Example12

Let f (x) = x T Ax, where A is a symmetric n × n matrix. Find


∇x f (x) and simplify the result.
Since A is symmetric, we know that A = AT .
From the general result ∇x (x T Ax) = (A + AT )x, we have:

∇x f (x) = (A + AT )x = 2Ax

Thus, when A is symmetric, ∇x (x T Ax) = 2Ax.


Thank You

Contact: indujoshi@[Link]

You might also like