100% found this document useful (1 vote)
283 views5 pages

Understanding Partial Derivatives and Differentiation

The document discusses partial derivatives and how to calculate them. Partial derivatives are used when a function depends on more than one variable. To calculate the partial derivative with respect to one variable, the other variables are treated as constants. Higher order partial derivatives and total differentials are also discussed. The document provides examples of calculating first and second order partial derivatives. It also explains how to use partial derivatives to estimate errors or uncertainties in a function due to uncertainties in its variables.

Uploaded by

Pk Gyabaa
Copyright
© Attribution Non-Commercial (BY-NC)
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
100% found this document useful (1 vote)
283 views5 pages

Understanding Partial Derivatives and Differentiation

The document discusses partial derivatives and how to calculate them. Partial derivatives are used when a function depends on more than one variable. To calculate the partial derivative with respect to one variable, the other variables are treated as constants. Higher order partial derivatives and total differentials are also discussed. The document provides examples of calculating first and second order partial derivatives. It also explains how to use partial derivatives to estimate errors or uncertainties in a function due to uncertainties in its variables.

Uploaded by

Pk Gyabaa
Copyright
© Attribution Non-Commercial (BY-NC)
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

1Q2 Course Notes §6 Partial derivatives

6 Partial Differentiation

6.1 Introduction

A function of 1 variable e.g. f(x) = x2 can be represented as a curve of height f above the x axis.
A function of 2 variables e.g. f(x, y) = x2 + y2 can be represented as a surface of height f above the x, y
plane.
Functions of more than 2 variables exist, but cannot so easily be visualised. For example, the temperature on
a flat metal plate can be represented as function T (x, y) where x, y coordinates are used to define a position
on the plate. However, if you were studying the cooling or heating of the plate, you would need T (x, y, t)
where t is time, and if it were the temperature in a solid block it would be T (x, y, z, t)—4 variables.
Back to 2 variables, represented by a surface. If you cut a cross-section through the surface at fixed x or
fixed y, you get a curve, a function of 1 variable (the one not fixed). This can be differentiated in the normal
way. When a function of more than 1 variable is differentiated with respect to only one variable, the others
being treated as constants, the resulting expression is known as a partial derivative. The notation uses a
different d from that used for functions of 1 variable (ordinary derivative). Take a function of 1 variable
f(x) = x2 :
d
ordinary derivative f(x) = 2x
dx
Take a function of 2 variables, for example g(x, y) = 2xy2 : It has 2 partial derivatives:

∂ ∂
g(x, y) = 2y2 and g(x, y) = 4xy
∂x ∂y

To find ∂x g(x, y), one treats y as if it were a constant, and just differentiate with respect to x. And to find

∂y g(x, y), one treats x as if it were a constant, and just differentiate with respect to y. That’s all there is to
it!
∂g
A short notation is often used: = gx etc.
∂x
Of course, if g is a function of say 3 variables, such as g(x, y, z) = xy2 + xz3 then we also have ∂g/∂z =
3xz2 (obtained by keeping both x and y constant and just differentiating with respect to z; it’s also written
gz of course). And so on, with more variables.

6.2 Higher Derivatives

One can also differentiate more than once, also with respect to different variables. For example, given
g(x, y) = 2xy2 :
∂g ∂g
= gx = 2y2 = gy = 4xy
∂x ∂y
∂2 g
µ ¶
∂ ∂g
= = gyy = 4x
∂y2 ∂y ∂y
∂2 g
µ ¶
∂ ∂g
= = gxx = 0
∂x2 ∂x ∂x
∂2 g
µ ¶
∂ ∂g
= = gxy = 4y
∂x∂y ∂x ∂y
∂2 g
µ ¶
∂ ∂g
= = gyx = 4y
∂y∂x ∂y ∂x

6.1 2005/6
1Q2 Course Notes §6 Partial derivatives

Notice that the last two are equal. Indeed, for any reasonable function (and in particular all those you will
come across in your Engineering courses), it turns out that:

fxy = fyx

as in the example above. (There are examples where fxy 6= fyx but they are hard to construct, and don’t
occur in nature!)

6.3 Total Differential

Recall first that if f(x) is a function of 1 variable, then changing x by δx produces a corresponding change
δf in f(x), and if the change is small enough then
df
δf ≈ δx.
dx

How do we adapt this if we have two variables? Again, take g(x, y) = 2xy2 . Changes δx and δy will
produce change δg. If these changes are small enough, δg can be approximated in two steps: first do the
change for x and then the change for y as follows.
(i) First keep y constant and change x. This produces an approximate change:
∂g
δg1 ≈ δx = 2y2 δx
∂x
(ii) Then keep x constant and change y. This produces a further approximate change:
∂g
δg2 ≈ δy = 4xyδy
∂y
The approximate combined effect δg of both these changes is simply their sum:

δg(x, y) ≈ gx δx + gy δy

This is known as a total differential.


For more than 2 variables, just add extra terms, e.g.:

δg(x, y, z) ≈ gx δx + gy δy + gz δz

6.4 Errors

Let g(x, y) be a function of 2 variables (eg representing temperature or height above sea-level or . . . ). In
any measurement there is a degree of uncertainty (nothing is ever 100% accurate), and we can use the total
differential to estimate the error (or uncertainty) in g as a result of uncertainties in x and y. If δx and δy
are the uncertainties in x and y respectively, then use

δg(x, y) ≈ gx δx + gy δy

However, one doesn’t know whether the uncertainty δx and δy are positive or negative, so we really need
to use
|δg(x, y)| ≈ |gx δx| + |gy δy|

Example Perfect gas law: PV = RT (where R is a constant, P is pressure, V is volume per mole, T is
temperature in Kelvin). So we can write P as a function of V and T :
RT
P(V, T ) =
V

6.2 2005/6
1Q2 Course Notes §6 Partial derivatives

The estimated value of P may differ from the true value due to errors or uncertainties δT and δV in measured
values of T and V respectively. Use the partial derivatives,
∂P/∂T = R/V, ∂P/∂V = −RT/V 2 .
The maximum error in P is therefore:
¯ ¯ ¯ ¯
¯ R ¯ ¯ RT ¯
|δP| ≈ ¯ δT ¯ + ¯ 2 δV ¯¯ .
¯ ¯ ¯
V V

In other words, µ ¶
RT R RT
P= ± |δT | + 2 |δV|
V V V

For example (ignoring the units), suppose the constant R = 8, and temperature T = 300±10 and the volume
V = 2 ± 0.3 then |δT | = 10 and |δV| = 0.3, so
µ ¶
8 × 300 8 8 × 300
P= ± 10 + 0.3 = 1200 ± (40 + 180) = 1200 ± 220.
2 2 4

6.5 Function of a Function (chain rules)

6.5.1 Given f(u) where u = u(x, y)

This means that f is a function of 1 variable u, and through the substitution it becomes a function of 2
variables.
df ∂u df ∂u
fx = fy =
du ∂x du ∂y
(careful to use the d’s and ∂’s in the right places).
For example, if f(u) = sin(u) and u = x2 + y2 then

fx = 2x cos(u), fy = 2y cos(u).

6.5.2 Total Derivative

The total derivative is not a partial derivative, but is derived using partial derivatives. It occurs when the
variables are expressible each as functions of a single variable.
Example: “A box has sides x, y, z changing in length over time t. Find the rate of change in volume.”
The volume is V(x, y, z) = xyz. And x, y and z are all changing as functions of time t:

x = x(t) y = y(t) z = z(t)

In a short time interval δt, x changes by δx, y changes by δy and z changes by δz, resulting in a change in
volume V of δV. From the total differential (see section 6.3): δV ≈ Vx δx + Vy δy + Vz δz. But

dx dy dz
δx ≈ δt δy ≈ δt δz ≈ δt
dt dt dt
Therefore: µ ¶
dx dy dz
δV ≈ Vx + Vy + Vz δt
dt dt dt
δV dx dy dz
≈ Vx + Vy + Vz
δt dt dt dt

6.3 2005/6
1Q2 Course Notes §6 Partial derivatives

In the limit as δt → 0 we obtain the rate of change of V with time:

dV dx dy dz
= Vx + Vy + Vz
dt dt dt dt
In this example Vx = yz, Vy = xz and Vz = xy. dx/dt, dy/dt and dz/dt are either given as functions
of t or simply as values (e.g. ‘x is decreasing at 0.2 metres per second’ means dx/dt = −0.2 if units are
metres.)
In general, given a function f(x, y, z, . . .) where the variables x, y, z, . . . are each functions of another vari-
able t, then the total derivative is given by:

df dx dy dz
= fx + fy + fz +···
dt dt dt dt

6.5.3 Total Derivative where variables are related

Suppose f(x, y) is a function of 2 variables, and x and y are related. There are two types of situation:
(1) If y is a known function of x (i.e. y = y(x)).
In this case we can adapt the expression for total derivative from section 6.5.2, by defining t = x. This
means dx/dt = dx/dx = 1, dy/dt = dy/dx and df/dt = df/dx; giving the total derivative:

df dy
= fx + fy
dx dx

This can also be written using ∂s - which shows clearly why we need to be careful about the difference
between ∂ and d: ∂f/∂x and df/dx are not the same thing!
(2) If y and x are related in a known way, but you don’t know y(x) (or it is difficult to determine).
If you arrange the relationship between the variables into the form g(x, y) = 0, it is possible to find dy/dx
and use this in the equation in case (1) above.
g(x, y) = 0 means that any change in x involves a change in y such that g remains zero. This means that
the total derivative of g is dg/dx = 0. We now use the formula from case (1) above:

dy dy gx
0 = gx + gy giving =−
dx dx gy

Now we use the same formula to find the total derivative of f:


df gx
= fx − f y (assuming gy 6= 0)
dx gy

6.6 Coordinate Systems

Introduction Say a function is expressed in one coordinate system but you want derivatives with respect
to a different system. Though you could perhaps substitute the new variables then take derivatives, it may
be easier to do it differently.
First I will describe some common coordinate systems in 2 and 3 dimensions and their relationship to
Cartesian.
(a) Cartesian: (x, y) (2 dimensions) or (x, y, z) (3 dimensions). You should be familiar with the convention
for the direction of the 3 Cartesian axes.
(b) Plane Polar: (r, θ) (2 dimensions) where x = r cos θ, y = r sin θ.
(c) Cylindrical Polar: (r, θ, z) (3 dimensions) where x = r cos θ, y = r sin θ, z = z.

6.4 2005/6
1Q2 Course Notes §6 Partial derivatives

(d) Spherical Polar: (r, θ, φ) (3 dimensions) where x = r sin θ cos φ, y = r sin θ sin φ, z = r cos θ.
N.B. (1) Other labelling conventions exist (2) In the convention used here the r and θ in spherical polar
coordinates are not the same as the r and θ in cylindrical polar coordinates!

6.6.1 Partial Derivatives with Change of Variable

If you know the relationship between 2 sets of variables, you can express a function in terms of either
system. It is best to use a different symbol for each function so that the variables do not have to be written
in each time:
e.g. function f(x, y) in Cartesian coordinates may be called F(r, θ) in plane polar. F would be written out
by converting x and y as described above. So if f(x, y) = x2 + y3 then F(r, θ) = r2 cos2 θ + r3 sin3 θ.
If you do not wish to convert a function to new variables, but need to know its partial derivatives with
respect to different variables, this is how it is done:
(i) Given two different coordinate systems; x, y, z, . . . (not necessarily Cartesian) and α, β, γ, . . . where
x, y, z, . . . are each functions of α, β, γ, . . .: Write

f(x, y, z, . . .) = G(α, β, γ, . . .)

where x = x(α, β, γ, . . .), y = y(α, β, γ, . . .) z = z(α, β, γ, . . .) etc. . . . Then:

Gα = fx xα + fy yα + fz zα + · · ·

Gβ = fx xβ + fy yβ + fz zβ + · · ·
etc. . .
Example of change from Cartesian to Cylindrical Polar:
We have x = r cos θ, y = r sin θ, z = z.
Let G(r, θ, z) = f(x, y, z) = x2 + 3xy + y2 + z2 . Then

Gr = fx xr + fy yr + fz zr
Gθ = fx xθ + fy yθ + fz zθ
Gz = fx xz + fy yz + fz zz

Now, fx = 2x + 3y = 2r cos θ + 3r sin θ = r(2 cos θ + 3 sin θ)


fy = 3x + 2y = r(3 cos θ + 2 sin θ)
fz = 2z (unchanged in new coordinates)
xr = cos θ, yr = sin θ, zr = 0
xθ = −r sin θ, yθ = r cos θ, zθ = 0
xz = 0, yz = 0, zz = 1.
Substituting these into the formulae above and simplifying we get:

Gr = 2r(1 + 3 sin θ cos θ)


Gθ = 3r2 (cos 2θ − sin 2θ)
Gz = 2z.

These notes were originally written by D.A. Howe,


and edited successively by J. Ford and J. Montaldi.

6.5 2005/6

You might also like