60
ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Embed Size (px)

Citation preview

Page 1: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

ME 2304: 3D Geometry & Vector Calculus

Dr. Faraz Junejo

Gradient of a Scalar field & Directional Derivative

Page 2: 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

Page 3: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 4: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 5: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Example 1: Find the partial derivatives fx and fy if f(x , y) is given by f(x , y) = x2 y + 2x + y

Page 6: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Example 2: Find fx and fy if f(x , y) is given by

f(x , y) = sin(x y) + cos x

Page 7: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Example 3: Find fx and fy if f(x , y) is given by

f(x , y) = x ex y

Page 8: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Example 4: Find fx and fy if f(x , y) is given by

f(x , y) = ln ( x2 + 2 y)

Page 9: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• If f(x, y) = x3 + x2y3 – 2y2

find fx(2, 1) and fy(2, 1)

Example 5

Page 10: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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.)

Page 11: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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.)

Page 12: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• If

• calculate

( , ) sin1

and

xf x y

y

f f

x y

Exercise: 1

Page 13: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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.)

Page 14: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 15: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• If f is a function of two variables, then

its partial derivatives fx and fy are also

functions of two variables.

HIGHER DERIVATIVES

Page 16: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 17: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 18: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 19: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 20: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

–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.)

Page 21: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 22: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Exercise: 3

Page 23: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Notation for Partial Derivatives

means xf

fx

means yf

fy

xy

ff xy

2

means

yx

ff yx

2

means

Page 24: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 25: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 26: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Example: 8

Page 27: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Example: 8 (contd.)

Page 28: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.

Page 29: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative
Page 30: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.

Page 31: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Examples of scalar quantitiesAltitude: Temperature:

Electric potential:Pressure:

Page 32: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 33: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

iii) Assignment to each point, its distance from a fixed point

222 zyxr

O

Scalar Field (contd.)

Page 34: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 35: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

A smooth scalar field implies that the function

, ,is a smooth or differentiable

function of its arguments, x,y,z.

),,( zyxf

Scalar Field (contd.)

Page 36: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 37: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.

Page 38: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.

Page 39: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Example: 1

For the scalar field (x,y) = x∅ 2sin5y, calculate gradient of∅

Page 40: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 41: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.

Page 42: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.

Page 43: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 44: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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.)

Page 45: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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

Page 46: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.

Page 47: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 48: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 49: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.

Page 50: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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.)

Page 51: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

• 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.)

Page 52: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Directional Derivative

Page 53: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Directional Derivative: Example

Page 54: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 55: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 56: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 57: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 58: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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

Page 59: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

Exercise: 2 (contd.)

Page 60: ME 2304: 3D Geometry & Vector Calculus Dr. Faraz Junejo Gradient of a Scalar field & Directional Derivative

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.