← Back to calculus 3

Partial Derivatives

Partial derivatives

We review the derivative you already know from single-variable calculus, then extend the same idea to functions of two variables.

The main idea stays the same: a derivative measures rate of change. The difference is that for a function of two variables, we can ask how the function changes in the xx-direction or in the yy-direction.


A quick review of the single-variable derivative

If ff is a function of one variable, then the derivative at aa is defined by the limit

f(a)=limh0f(a+h)f(a)h,f'(a) = \lim_{h \to 0} \frac{f(a+h)-f(a)}{h},

provided the limit exists.

This is the slope of the tangent line, or more generally the instantaneous rate of change of ff with respect to its input.


Partial derivatives for functions of two variables

Now let f(x,y)f(x,y) be a function of two variables.

The partial derivative with respect to xx is

fx(x,y)=fx(x,y)=limh0f(x+h,y)f(x,y)h,f_x(x,y) = \frac{\partial f}{\partial x}(x,y) = \lim_{h \to 0} \frac{f(x+h,y)-f(x,y)}{h},

and the partial derivative with respect to yy is

fy(x,y)=fy(x,y)=limh0f(x,y+h)f(x,y)h.f_y(x,y) = \frac{\partial f}{\partial y}(x,y) = \lim_{h \to 0} \frac{f(x,y+h)-f(x,y)}{h}.

The notation is different from ordinary derivatives. We use the symbol \partial instead of dd because we are differentiating with respect to only one variable while keeping the other variable fixed.

The rule

To find a partial derivative:

That is the whole idea.


Geometric meaning

If f(x,y)f(x,y) is a surface, the cleanest 2D picture is to freeze one variable and graph a slice.

Take the surface

z=f(x,y)=9x2y2.z = f(x,y) = \sqrt{9-x^2-y^2}.

At the point (1,1)(1,1) in the domain, the output is

z=91212=7.z = \sqrt{9-1^2-1^2} = \sqrt{7}.

To understand fx(1,1)f_x(1,1), keep y=1y=1 fixed and look at the 2D graph

z=8x2.z = \sqrt{8-x^2}.

To understand fy(1,1)f_y(1,1), keep x=1x=1 fixed and look at the 2D graph

z=8y2.z = \sqrt{8-y^2}.

Both slopes can be illustrated directly on the 3D surface with tangent lines drawn through the point (1,1,7)(1,1,\sqrt{7}).

Hemisphere: z = sqrt(9 - x^2 - y^2) with tangent lines

The interactive plot above draws the hemisphere surface and overlays the two tangent lines so you can view them together in 3D. Use the renderer controls to rotate and inspect the tangents against the surface.


Example 1: first partial derivatives of a polynomial

Let

f(x,y)=x2y+3xy2.f(x,y) = x^2y + 3xy^2.

Find fxf_x and fyf_y.

Solution:

For fxf_x, treat yy as constant:

fx(x,y)=2xy+3y2.f_x(x,y) = 2xy + 3y^2.

For fyf_y, treat xx as constant:

fy(x,y)=x2+6xy.f_y(x,y) = x^2 + 6xy.

This example shows the basic rule: only one variable is changing at a time.


Example 2: the other variable stays constant

Let

f(x,y)=xsiny+ycosx.f(x,y) = x\sin y + y\cos x.

Find fxf_x.

Solution:

When differentiating with respect to xx, the quantity siny\sin y is just a constant, and yy is also a constant.

So

fx(x,y)=sinyysinx.f_x(x,y) = \sin y - y\sin x.

If you see yy while taking /x\partial/\partial x, do not differentiate it. Keep it fixed.


Higher partial derivatives

We can differentiate partial derivatives again. These are called higher partial derivatives.

For example, if fxf_x is a function, then we can take its partial derivative with respect to xx again and write

fxx=2fx2.f_{xx} = \frac{\partial^2 f}{\partial x^2}.

Similarly,

fyy=2fy2,f_{yy} = \frac{\partial^2 f}{\partial y^2},

and the mixed partials are

fxy=y(fx),fyx=x(fy).f_{xy} = \frac{\partial}{\partial y}\left(\frac{\partial f}{\partial x}\right), \qquad f_{yx} = \frac{\partial}{\partial x}\left(\frac{\partial f}{\partial y}\right).

For the nice functions we study in calculus, the mixed partials usually agree:

fxy=fyx.f_{xy} = f_{yx}.

More precisely, this is guaranteed when the mixed partials are continuous near the point. In practice, that means the order of differentiation does not matter for the smooth examples in this course.


Example 3: confirm that f_xy = f_yx

Let

f(x,y)=x2y3+exy.f(x,y) = x^2y^3 + e^{xy}.

Compute fxyf_{xy} and fyxf_{yx}.

Solution:

First compute fxf_x:

fx=2xy3+yexy.f_x = 2xy^3 + ye^{xy}.

Now differentiate with respect to yy:

fxy=6xy2+exy+xyexy.f_{xy} = 6xy^2 + e^{xy} + xye^{xy}.

Next compute fyf_y:

fy=3x2y2+xexy.f_y = 3x^2y^2 + xe^{xy}.

Now differentiate with respect to xx:

fyx=6xy2+exy+xyexy.f_{yx} = 6xy^2 + e^{xy} + xye^{xy}.

So in this example,

fxy=fyx.f_{xy} = f_{yx}.

Example 4: higher derivatives of a polynomial

Let

f(x,y)=x3y2.f(x,y) = x^3y^2.

Compute fxxf_{xx}, fyyf_{yy}, fxyf_{xy}, and fyxf_{yx}.

Solution:

First partial derivatives:

fx=3x2y2,fy=2x3y.f_x = 3x^2y^2, \qquad f_y = 2x^3y.

Second partial derivatives:

fxx=6xy2,fyy=2x3.f_{xx} = 6xy^2, \qquad f_{yy} = 2x^3.

Mixed partials:

fxy=6x2y,fyx=6x2y.f_{xy} = 6x^2y, \qquad f_{yx} = 6x^2y.

Again, the mixed partials match.


Summary