You are on page 1of 16

Application of Partial

Derivativas
Vector and Matrix of partial derivatives
Gradient of a function
• Let f(x,y,z) be a function of three variables.
• Definition:
• The gradient of 𝑓(𝑥, 𝑦, 𝑧) at point 𝑥0 , 𝑦0 , 𝑧0 , denoted by
∇𝑓 𝑥0 , 𝑦0 , 𝑧0 , is a vector of first partial derivatives of 𝑓(𝑥, 𝑦, 𝑧)
valued or calculated at point 𝑥0 , 𝑦0 , 𝑧0 .
• Its formal definition is:
𝜕𝑓(𝑥0 ,𝑦0 ,𝑧0 ) 𝜕𝑓(𝑥0 ,𝑦0 ,𝑧0 ) 𝜕𝑓(𝑥0 ,𝑦0 ,𝑧0 )
• ∇𝑓 𝑥0 , 𝑦𝑜 , 𝑧0 = 𝜕𝑥
,
𝜕𝑦
,
𝜕𝑧
Eamples of Gradient
• Example 1:
• Find the vector gradient of 𝑓 𝑥, 𝑦 = 𝑥 2 𝑦, find the gradient of 𝑓(𝑥, 𝑦)
at point (1,1)
• Answer:
𝜕𝑓 𝜕𝑓 𝜕𝑓 𝜕𝑓
• = 2𝑥𝑦 = 𝑥2 and ∇𝑓 𝑥, 𝑦 = , = 2𝑥𝑦, 𝑥 2
𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑦
• ∇𝑓 1,1 = 2,1
Eamples of Gradient
• Example 2:
• Find the vector gradient of 𝑓 𝑥, 𝑦 = 𝑥 2 𝑦 4 + 𝑥 3 𝑦 − 𝑥, find the
gradient of 𝑓(𝑥, 𝑦) at point (0,1)
• Answer:
𝜕𝑓 𝜕𝑓
• = 2𝑥𝑦 4 + 3𝑥 2 𝑦 −1 = 4𝑥 2 𝑦 3 + 𝑥 3 and ∇𝑓 𝑥, 𝑦 =
𝜕𝑥 𝜕𝑦
𝜕𝑓 𝜕𝑓
, = 2𝑥𝑦 4 + 3𝑥 2 𝑦 − 1, 4𝑥 2 𝑦 3 + 𝑥 3
𝜕𝑥 𝜕𝑦
• ∇𝑓 0,1 = −1,0
Properties of the gradient
• 1. The gradient of a function allows to calculate the first derivative of
𝑓(𝑥, 𝑦, 𝑧) along the direction of a vector.
• Given 𝑓(𝑥, 𝑦, 𝑧) and a vector 𝑣 = 𝑣1 , 𝑣2 , 𝑣3 we say that
• 𝑓 ′ 𝑣 𝑥0 , 𝑦0 , 𝑧0 = ∇𝑓 𝑥0 , 𝑦0 , 𝑧0 . 𝑣 𝑡
• Important: as the gradient is defined as a row vector, we consider the
transpose of the vector v to satisfy the condition of product of two
vectors.
• 2. The gradient of a function at point P shows the direction of a
greatest increasing direction at point P.
Examples: finding the slope of f(x,y) in a
direction of a vector.
• Example 1: Find the slope of the following functions in the direction
of the vector

a) 𝑓 𝑥, 𝑦 = 𝑥 2 𝑦 at P(1,1) in the direction of 𝑣 = (1,0)


b) 𝑓 𝑥, 𝑦 = 𝑥 2 𝑦 4 + 𝑥 3 𝑦 − 𝑥 at point P(0,1) in the direction 𝑣 =
(−2,4)
Examples: finding the slope of f(x,y) in a
direction of a vector.
• Example 1: Find the slope of the following functions in the direction
of the vector
Solution a
a) 𝑓 𝑥, 𝑦 = 𝑥 2 𝑦 at P(1,1) in the direction of 𝑣 = (1,0)

∇𝑓 𝑥, 𝑦 = 2𝑥𝑦, 𝑥 2 and ∇𝑓 1,1 = (2,1)


1
𝑓′𝑣 = 2,1 . =1×2+1×0=2+0=2
0
Examples: finding the slope of f(x,y) in a
direction of a vector.
• Example 1: Find the slope of the following functions in the direction
of the vector
Solution b
𝑓 𝑥, 𝑦 = 𝑥 2 𝑦 4 + 𝑥 3 𝑦 − 𝑥 at point P(0,1) in the direction 𝑣 = (−2,4)
𝜕𝑓 𝜕𝑓
• = 2𝑥𝑦 4 + 3𝑥 2 𝑦 −1 = 4𝑥 2 𝑦 3 + 𝑥 3 and
𝜕𝑥 𝜕𝑦
𝜕𝑓 𝜕𝑓
∇𝑓 𝑥, 𝑦 = , = 2𝑥𝑦 4 + 3𝑥 2 𝑦 − 1, 4𝑥 2 𝑦 3 + 𝑥 3
𝜕𝑥 𝜕𝑦
• ∇𝑓 0,1 = −1,0
−2
𝑓′𝑣 = −1,0 . = −1 × −2 + 0 × 4 = 2 + 0 = 2
4
Examples of derivative of function in a
direction of a vector
• Example 2: Find the derivative of the function 𝑓 𝑥, 𝑦 = 𝑥 𝑒 𝑦 at point
P(1,1) and in the direction 𝑣 = (1,2)
• Solution
• ∇𝑓 = (𝑒 𝑥 , 𝑥𝑒 𝑦 ) ∇𝑓 1,1 = (𝑒, 𝑒)
1
• 𝑓 ′ 𝑣 1,1 = 𝑒, 𝑒 . = 𝑒 × 1 + 𝑒 × 2 = 𝑒 + 2𝑒 = 3𝑒
2
Jacobian Matrix
• Assume a function a vector function or functional, that is,
• 𝑓: ℝ𝑛 → ℝ𝑚 such that
𝑥1 , 𝑥2 , … , 𝑥𝑛 → 𝑓 𝑥1 , 𝑥2 , … , 𝑥𝑛 =
𝑓1 𝑥1 , 𝑥2 , … , 𝑥𝑛 , 𝑓2 (𝑥1 , 𝑥2 , … , 𝑥𝑛 , … , 𝑓𝑚 (𝑥1 , 𝑥2 , … , 𝑥𝑛 ))
For each one function in the vector function we can calculate its
gradient, for example ∇𝑓1 , ∇𝑓2 , … , ∇𝑓𝑚
Therefore, we define the Jacobian matrix, written as 𝐽𝑓(𝑥0 ), the matrix
that has the m gradients as a row vectors, that is,
Jacobian matrix
𝜕𝑓1 𝜕𝑓1
∇𝑓1 (𝑥0 ) …
𝜕𝑥1 𝜕𝑥𝑛
• 𝐽𝑓 𝑥0 = ⋮ = ⋮ ⋮ ⋮
∇𝑓𝑚 (𝑥0 ) 𝜕𝑓𝑚 𝜕𝑓𝑚

𝜕𝑥1 𝜕𝑥𝑛
• Example:
• 𝑓 𝑥, 𝑦 = 𝑥 2 𝑦, ln 𝑥𝑦 find the jacobian matrix at point (1,1)
Jacobian matrix: Example
• Solution:
• We consider that 𝑓 𝑥, 𝑦 = 𝑓1 𝑥, 𝑦 , 𝑓2 (𝑥, 𝑦) where 𝑓1 𝑥, 𝑦 = 𝑥 2 𝑦
and 𝑓2 𝑥, 𝑦 .
• 𝑓1 𝑥, 𝑦 = 𝑥 2 𝑦 and 𝑓2 𝑥, 𝑦 = ln 𝑥𝑦
• First we calculate gradient vectors:
𝜕𝑓1 𝜕𝑓1 𝜕𝑓2 𝜕𝑓2 1 1
• ∇𝑓1 = , = 2𝑥𝑦, 𝑥 2 ∇𝑓2 = , = ,
𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑦 𝑥 𝑦
2𝑥𝑦 𝑥2 2 1
• 𝐽𝑓 = 1 1 𝑡ℎ𝑒𝑟𝑒𝑓𝑜𝑟𝑒, 𝐽𝑓 1,1 =
𝑥 𝑦
1 1
Matrix of second derivatives: Hessian Matrix
• Let us learn by an example
• Let 𝑓 𝑥, 𝑦 = 𝑥 2 𝑦 4 + 𝑥 3 𝑦 − 𝑥
• Step 1: we find all of first order partial derivatives of the function
𝜕𝑓 4 2 𝜕𝑓
• = 2𝑥𝑦 + 3𝑥 𝑦 − 1 and = 4𝑥 2 𝑦 4 + 𝑥 3
𝜕𝑥 𝜕𝑦
• Step 2: we find the second partial derivative of f as the partial
derivatives of first order derivatives, that is,
Hessian matrix
𝜕2 𝑓 𝜕 𝜕𝑓 𝜕 4 2 4
• = = 2𝑥𝑦 + 3𝑥 𝑦 − 1 = 2𝑦 + 6𝑥𝑦
𝜕𝑥 2 𝜕𝑥 𝜕𝑥 𝜕𝑥
𝜕2 𝑓 𝜕 𝜕𝑓 𝜕 2 3 3 2 2
• 2 = = 4𝑥 𝑦 + 𝑥 = 12𝑥 𝑦
𝜕𝑦 𝜕𝑦 𝜕𝑦 𝜕𝑦
𝜕2 𝑓 𝜕 𝜕𝑓 𝜕𝜕
• = = 4𝑥 2 𝑦 3 + 𝑥 3 = 8𝑥𝑦 3 + 3𝑥 2
𝜕𝑥𝜕𝑦 𝜕𝑥 𝜕𝑦 𝜕𝑥
𝜕2 𝑓 𝜕 𝜕𝑓 𝜕
• = = 2𝑥𝑦 4 + 3𝑥 2 𝑦 − 1 = 8𝑥𝑦 3 + 3𝑥 2
𝜕𝑦𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑦
Hessian Matrix
• Definition: given a function for which its second partial derivatives
exist, we define the Hessian matrix as the matrix of all the second
partial derivatives of that function.
• Notation
𝜕2 𝑓 𝜕2 𝑓 𝜕2 𝑓

𝜕𝑥12 𝜕𝑥2 𝜕𝑥1 𝜕𝑥𝑛 𝜕𝑥1
• 𝐻𝑓 = ⋮ ⋮ ⋮ ⋮
𝜕2 𝑓 𝜕2 𝑓 𝜕2 𝑓
… 2
𝜕𝑥1 𝜕𝑥𝑛 𝜕𝑥2 𝜕𝑥𝑛 𝜕𝑥𝑛
Example of Hessian Matrix
• For the example given for second partial derivatives, the Hessian
matrix is:

2𝑦 4 + 6𝑥𝑦 8𝑥𝑦 3 + 3𝑥 2
• H𝑓 =
8𝑥𝑦 3 + 3𝑥 2 12𝑥 2 𝑦 2
• We can compute real values of the Hessian matrix at point (1,1).

You might also like