Multivariable calculus

Gradient of x^2 y - 3yz + z^3: Term by Term

For f(x, y, z) = x^2 y - 3yz + z^3 the gradient is (2xy, x^2 - 3z, 3z^2 - 3y). The cross term -3yz contributes to both the y and the z component, carrying its minus sign into each. At (2, 1, 1) the gradient is (4, 1, 0).

f(x,y,z)=x2y3yz+z3f(x,y,z) = x^2 y - 3yz + z^3
f=2xy,  x23z,  3z23y\nabla f = \left\langle 2xy,\; x^2 - 3z,\; 3z^2 - 3y \right\rangle
fx=2xy\frac{\partial f}{\partial x} = 2xy
fy=x23z\frac{\partial f}{\partial y} = x^2 - 3z
fz=3z23y\frac{\partial f}{\partial z} = 3z^2 - 3y

Scan all three terms for every component

With a sum, the work is bookkeeping: for each variable, go through all three terms and ask whether that term contains the variable. For xx, only x2yx^2 y does, and yy is a constant multiplier.

fx=y2x0+0=2xy\frac{\partial f}{\partial x} = y \cdot 2x - 0 + 0 = 2xy

For yy, two terms contain it: x2yx^2 y gives x2x^2, and 3yz-3yz gives 3z-3z. The cube has no yy.

fy=x23z\frac{\partial f}{\partial y} = x^2 - 3z

For zz, the terms 3yz-3yz and z3z^3 both contribute, giving 3y-3y and 3z23z^2.

fz=3z23y\frac{\partial f}{\partial z} = 3z^2 - 3y

The cross term 3yz-3yz is the one doing double duty. It shows up in two of the three components, and it is the reason the components are not independent of each other.

The mistake: losing the cross term or its sign

The two errors here are dropping 3yz-3yz from one of the components and copying its sign wrongly. Because the term appears in the yy and zz partials, an omission in either place produces an answer that looks plausible and is wrong at almost every point.

  • In fy\frac{\partial f}{\partial y} the surviving piece is 3z-3z, not 3yz-3yz and not 3-3. The yy is what gets differentiated away.
  • In fz\frac{\partial f}{\partial z} it is 3y-3y, and the minus sign travels with it.
  • The term x2yx^2 y contributes to two components as well, 2xy2xy and x2x^2. Only z3z^3 is confined to a single component.

A useful habit is to write the function as a column of terms and tick off each one as you scan for a variable. Errors here are almost never conceptual, they are missed terms.

A worked value and the only critical point

At (2,1,1)(2,1,1) the function value is f=43+1=2f = 4 - 3 + 1 = 2.

f(2,1,1)=221,  43,  33=4,  1,  0\nabla f(2,1,1) = \left\langle 2 \cdot 2 \cdot 1,\; 4 - 3,\; 3 - 3 \right\rangle = \left\langle 4,\; 1,\; 0 \right\rangle

The zz component is zero at this point because 3z23z^2 and 3y3y happen to balance there. Moving in the zz direction changes ff only at second order from (2,1,1)(2,1,1), while the xx direction is four times more productive than the yy direction.

For critical points, solve 2xy=02xy = 0, x2=3zx^2 = 3z and 3z2=3y3z^2 = 3y together. If x=0x = 0 then z=0z = 0 and so y=z2=0y = z^2 = 0. If instead y=0y = 0 then z2=0z^2 = 0, so z=0z = 0 and x2=0x^2 = 0. Either branch lands on the origin, which is the only critical point of this function.

Frequently asked questions

Why does fx\frac{\partial f}{\partial x} contain a yy?

Because the term x2yx^2 y has yy as a constant multiplier while xx is differentiated. The power rule turns x2x^2 into 2x2x and the yy rides along, giving 2xy2xy.

How can the zz component be zero when the function clearly depends on zz?

A component of the gradient is a rate at one point, not a statement about the whole function. At (2,1,1)(2,1,1) the two zz contributions, 3z2=33z^2 = 3 and 3y=3-3y = -3, cancel exactly. Move to (2,1,2)(2,1,2) and the zz component becomes 123=912 - 3 = 9.