Post on 01-Jan-2016
ME 2304: 3D Geometry & Vector Calculus
Dr. Faraz Junejo
Gradient of a Scalar field & Directional Derivative
Partial Derivatives
Let f(x,y) be a function with two variables.
If we keep y constant and differentiate f (assuming f is differentiable)
with respect to the variable x, we obtain what is called the partial
derivative of f with respect to x which is denoted by:
xforx
f
Similarly If we keep x constant and differentiate f (assuming f is differentiable) with respect to the variable y, we obtain what is called the partial derivative of f with respect to y which is denoted by
yfory
f
Ex 1. 2( , ) 3 lnf x y x y x y
6 lnf
xy yx
2 13
fx x
y y
Ex 2.
2
( , ) xy yg x y e
2
2 1 xy ygxy e
y
Partial Derivatives: Examples
Ex 3. 4 3( , , ) 2f x y z xy z xy
4 3 2f
y z yx
3 34 2f
xy z xy
4 23f
xy zz
Partial Derivatives: Examples
Example 1: Find the partial derivatives fx and fy if f(x , y) is given by f(x , y) = x2 y + 2x + y
Example 2: Find fx and fy if f(x , y) is given by
f(x , y) = sin(x y) + cos x
Example 3: Find fx and fy if f(x , y) is given by
f(x , y) = x ex y
Example 4: Find fx and fy if f(x , y) is given by
f(x , y) = ln ( x2 + 2 y)
• If f(x, y) = x3 + x2y3 – 2y2
find fx(2, 1) and fy(2, 1)
Example 5
• Holding y constant and differentiating with respect to x, we get:
fx(x, y) = 3x2 + 2xy3
– Thus, fx(2, 1) = 3 . 22 + 2 . 2 . 13
= 16
Example 5 (contd.)
• Holding x constant and differentiating with respect to y, we get:
fy(x, y) = 3x2y2 – 4y
– Thus, fy(2, 1) = 3 . 22 . 12 – 4 . 1
= 8
Example 5 (contd.)
• If
• calculate
( , ) sin1
and
xf x y
y
f f
x y
Exercise: 1
• Using the Chain Rule for functions of one variable, we have:
2
1cos cos
1 1 1 1
cos cos1 1 1 1
f x x x
x y x y y y
f x x x x
y y y y y y
Exercise: 1(contd.)
• Find fx, fy, and fz if f(x, y, z) = exy ln z
– Holding y and z constant and differentiating with respect to x, we have:
– fx = yexy ln z
– Similarly,
– fy = xexy ln z
– fz = exy/z
Exercise: 2
• If f is a function of two variables, then
its partial derivatives fx and fy are also
functions of two variables.
HIGHER DERIVATIVES
• So, we can consider their partial derivatives
(fx)x , (fx)y , (fy)x , (fy)y
• These are called the second partial derivatives of f.
SECOND PARTIAL DERIVATIVES
• If z = f(x, y), we use the following notation:2 2
11 2 2
2 2
12
2 2
21
2 2
22 2 2
( )
( )
( )
( )
x x xx
x y xy
y x yx
y y yy
f f zf f f
x x x x
f f zf f f
y x y x y x
f f zf f f
x y x y x y
f f zf f f
y y y y
NOTATION
• Thus, the notation fxy (or ∂2f/∂y∂x) means
that we first differentiate with respect to x
and then with respect to y.
• In computing fyx , the order is reversed.
SECOND PARTIAL DERIVATIVES
• Find the second partial derivatives of
f(x, y) = x3 + x2y3 – 2y2
– We know that
fx(x, y) = 3x2 + 2xy3 fy(x, y) = 3x2y2 – 4y
Example 6
–Hence,
2 3 3
2 3 2
2 2 2
2 2 2
3 2 6 2
3 2 6
3 4 6
3 4 6 4
xx
xy
yx
yy
f x xy x yx
f x xy xyy
f x y y xyx
f x y y x yy
Example: 6 (contd.)
Ex 3.2 3 5( , ) lnf x y x y x x y
Second-Order Partial Derivatives (fxx, fyy)
23 3
22 20
fy x
x
2 22 1
6f f
xyy x x y y
22
2 26
f xx y
y y
Exercise: 3
Notation for Partial Derivatives
means xf
fx
means yf
fy
xy
ff xy
2
means
yx
ff yx
2
means
• Partial derivatives of order 3 or higher can also be defined.
2 3
2xyy xy y
f ff f
y y x y x
HIGHER DERIVATIVES
• Calculate fxxyz if f(x, y, z) = sin(3x + yz)
– fx = 3 cos(3x + yz)
– fxx = –9 sin(3x + yz)
– fxxy = –9z cos(3x + yz)
– fxxyz = –9 cos(3x + yz) + 9yz sin(3x + yz)
Example 7
Example: 8
Example: 8 (contd.)
Interpretations of Partial Derivatives
• As with functions of single variables partial derivatives represent the rates of change of the functions as the variables change.
• As we saw in the previous section, fx(x , y) represents the rate of change of the function f ( x, y) as we change x and hold y fixed while, fy(x , y) represents the rate of change of f ( x, y) as we change y and hold x fixed.
Scalar FieldEvery point in a region of space is assigned a
scalar value obtained from a scalar function f(x,
y, z), then a scalar field f(x, y, z) is defined in the
region, such as the pressure or temperature in
atmosphere, etc.
Examples of scalar quantitiesAltitude: Temperature:
Electric potential:Pressure:
Scalar Field
Scalar Field :
A scalar quantity, smoothly assigned to each point of a certain region of space is called a scalar field
Examples :
i) Temperature and pressure distribution in the atmosphere
ii) Gravitational potential around the earth
iii) Assignment to each point, its distance from a fixed point
222 zyxr
O
Scalar Field (contd.)
O
),,( zyx
),,( zyxf
x
z
y
Once a coordinate system is set up, a scalar field is mathematically represented by a function : )(),,( rfzyxf
is the value of the scalar assigned to the point (x,y,z)
),,( zyxf
A smooth scalar field implies that the function
, ,is a smooth or differentiable
function of its arguments, x,y,z.
),,( zyxf
Scalar Field (contd.)
Since the scalar field has a definite value at each point, we must have
),,(),,( zyxfzyxf
O),,( zyxf
Consider two coordinate systems.
x
y
z
O’
z
y
x
),,( zyxf
GradientThe gradient of a function, f(x, y), in two dimensions is defined as:
• The gradient of a function is a vector field.
• It is obtained by applying the vector operator to
the scalar function f(x, y)• Such a vector field is called a gradient (or conservative) vector field.
Gradient (contd.)
Del operator
x y z
i j k
Gradient
grad f f f
f fx y z
i j k
Gradient characterizes maximum increase. If at a point
P the gradient of f is not the zero vector, it represents
the direction of maximum space rate of increase in f at
P.
Example: 1
For the scalar field (x,y) = x∅ 2sin5y, calculate gradient of∅
• For the scalar field (x,y) = 3x + 5y∅ , calculate gradient of f.
Solution: Given scalar field (x,y) = 3x + 5y∅
• For the scalar field (x,y) = x∅ 4yz,calculate gradient of ∅.
Example: 2
Gradient of a Scalar field
• In vector calculus, the gradient of a scalar field
is a vector field that points in the direction of
the greatest rate of increase of the scalar field,
and whose magnitude is the greatest rate of
change.
Interpretation
• Consider a room in which the temperature is given by
a scalar field, T, so at each point (x,y,z) the
temperature is T(x,y,z).
• At each point in the room, the gradient of T at that
point will show the direction the temperature rises
most quickly.
• The magnitude of the gradient will determine how
fast the temperature rises in that direction.
• Since temperature T depends on those three variables
we can ask the question: how does T change when we
change one or more of those variables?
• And as always, the answer is found by differentiating
the function. In this case, because the function
depends on more than one variable, we're talking
partial differentiation.
Gradient of temperature field
• Now if we differentiate T with respect to x, that tells us
the change of T in the x-direction. That is therefore the i-
component of the gradient of T.
• You can see that there is going to be three components
of the gradient of T, in the i, j and k directions, which we
find by differentiating with respect to x, y and z
respectively. So this quantity "the gradient of T" must be
a vector quantity. Indeed it is a vector field.
Gradient of temperature field (contd.)
• This vector field is called "grad T" and written like and it is given as:
Gradient of temperature field (contd.)
T
kz
Tj
y
Ti
x
TT
Gradient of temperature field : Summary
• In three dimensions, a scalar field is simply a field that takes on a single scalar value at each point in space. For example, the temperature of all points in a room at a particular time t is a scalar field.
• The gradient of this field would then be a vector that pointed in the direction of greatest temperature increase.
• Its magnitude represents the magnitude of that increase.
Example: 3
If T(x,y,z) is given by:Determine
)sin(2),,( 3 zexzyxT yT
kzexjzexizexT
kzexz
jzexy
izexx
T
kz
Tj
y
Ti
x
TT
yyy
y
yy
)cos(2)sin(2)sin(6
)sin(2
)sin(2)sin(2
332
3
33
Example: 4 Given potential function V = x2y + xy2 + xz2, (a) find the gradient of V, and (b) evaluate it at (1, -1, 3).
Solution:(a)
2 2 2(2 ) ( 2 ) 2
V V VV
x y z
xy y z x xy xz
i j k
i j k
(b) (1, 1,3)
( 2 1 9) (1 2) 6
8 6
V
i j k
= i j k
2 2 2
8 6 1ˆ (8 6 )
1018 ( 1) 6
i j ka i j k Direction of
maximum increase
Summary The gradient of a scalar field is a vector field,
whose:
• Magnitude is the rate of change, and
• which points in the direction of the greatest
rate of increase of the scalar field.
• If the vector is resolved, its components
represent the rate of change of the scalar field
with respect to each directional component.
• Hence for a two-dimensional scalar field ∅ (x,y).
• And for a three-dimensional scalar field ∅ (x, y, z)
• Note that the gradient of a scalar field is the derivative of f in each direction
Summary (contd.)
• The gradient of any scalar field is a vector,
whose direction is the direction in which the
scalar increases most rapidly, and whose
magnitude is the maximum rate of change
Summary (contd.)
Directional Derivative
Directional Derivative: Example
Maximum and minimum value of Directional Derivative
• Since, the directional derivative of f in the direction of n is just the scalar projection of grad f along the direction of n i.e.
fDf
hence
Becausef
Dwhere
fD
fn
fn
fn
ˆ
ˆ
ˆ
,1cos1 have weand 0
, .n̂ and between angle theis
derivative ldirectionarepresent ,
cos
Maximum and minimum value of Directional Derivative
In other words,
• The maximum value of directional derivative
is and it occurs when has the same
direction as
• The minimum value of directional derivative is
a and it occurs when
has the opposite direction i.e.
f n̂
) or θθen f (i.e. wh 01cos
f f and n̂ ) or θθwhen 1801cos
Maximum and minimum value of Directional Derivative
In other words,
• The maximum value of directional derivative
is and it occurs when has the same
direction as
f n̂
) or θθen f (i.e. wh 01cos
Exercise: 1• Calculate the directional derivative of the following
function in the given direction and at the stated point.
(1,2,3)at direction in the 33),( 22 jyxyxf
Exercise: 2
• Calculate the directional derivative of the following
function in the given direction and at the stated point.
(0,-1,2)at 22direction in the ),( 22 kjiyxyxf
Exercise: 2 (contd.)
Summary
• The directional derivative in any direction is given by
the dot product of a unit vector in that direction with
the gradient vector. So in effect, a directional
derivative tells the slope of a surface in a given
direction.
• The directional derivative of f in the direction of n is
just the scalar projection of grad f along the
direction of n.