Multivariable calculus

Gradient of z ln(1 + x^2 + y^2): Mixed Roles

For f(x, y, z) = z ln(1 + x^2 + y^2) the gradient is (2xz/(1 + x^2 + y^2), 2yz/(1 + x^2 + y^2), ln(1 + x^2 + y^2)). The x and y components use the chain rule on the logarithm with z as a constant multiplier, while the z component is the logarithm itself.

f(x,y,z)=zln(1+x2+y2)f(x,y,z) = z \ln\left(1 + x^2 + y^2\right)
f=2xz1+x2+y2,  2yz1+x2+y2,  ln(1+x2+y2)\nabla f = \left\langle \frac{2xz}{1 + x^2 + y^2},\; \frac{2yz}{1 + x^2 + y^2},\; \ln\left(1 + x^2 + y^2\right) \right\rangle
fx=2xz1+x2+y2\frac{\partial f}{\partial x} = \frac{2xz}{1 + x^2 + y^2}
fy=2yz1+x2+y2\frac{\partial f}{\partial y} = \frac{2yz}{1 + x^2 + y^2}
fz=ln(1+x2+y2)\frac{\partial f}{\partial z} = \ln\left(1 + x^2 + y^2\right)

Two chain rule components and one plain one

Write D=1+x2+y2D = 1 + x^2 + y^2 to keep the algebra short. For the xx partial, zz is a constant multiplier and the logarithm needs the chain rule: the derivative of lnD\ln D is 1D\frac{1}{D} times the derivative of DD.

fx=z1DDx=z2x1+x2+y2=2xz1+x2+y2\frac{\partial f}{\partial x} = z \cdot \frac{1}{D} \cdot \frac{\partial D}{\partial x} = z \cdot \frac{2x}{1 + x^2 + y^2} = \frac{2xz}{1 + x^2 + y^2}

The yy partial is identical with yy in place of xx. The zz partial is different in kind: the logarithm contains no zz, so it is the constant here, and ff is simply a constant times zz.

fz=ln(1+x2+y2)\frac{\partial f}{\partial z} = \ln\left(1 + x^2 + y^2\right)

The denominator 1+x2+y21 + x^2 + y^2 is at least 1, so the logarithm is defined and the fractions are finite at every point in space. Nothing here blows up.

The mistake: differentiating a logarithm that has no z in it

The frequent error is fz=z1+x2+y2\frac{\partial f}{\partial z} = \frac{z}{1 + x^2 + y^2} or 11+x2+y2\frac{1}{1+x^2+y^2}, from reflexively applying the log derivative in every component. Look at what the logarithm depends on. It contains xx and yy only, so with respect to zz it is a number, and the derivative of (number) times zz is that number.

  • Ask which variables live inside each piece before differentiating. Here zz lives outside the logarithm entirely.
  • The other common slip is dropping the inner 2x2x, giving z1+x2+y2\frac{z}{1+x^2+y^2} for the xx partial.
  • Sanity check on the zz component: at x=y=0x = y = 0 it is ln1=0\ln 1 = 0, which says ff does not change with zz on the zz-axis. That is right, because ff is identically zero there.

Evaluating, and the whole axis of critical points

At (1,1,3)(1, 1, 3) the denominator is D=3D = 3, so f=3ln33.296f = 3\ln 3 \approx 3.296.

f(1,1,3)=2133,  2133,  ln3=2,  2,  ln3\nabla f(1,1,3) = \left\langle \frac{2 \cdot 1 \cdot 3}{3},\; \frac{2 \cdot 1 \cdot 3}{3},\; \ln 3 \right\rangle = \left\langle 2,\; 2,\; \ln 3 \right\rangle

Numerically that is about 2,2,1.099\left\langle 2, 2, 1.099 \right\rangle, with length roughly 3.034. The horizontal components dominate because z=3z = 3 amplifies them.

Setting all three components to zero needs lnD=0\ln D = 0, which forces D=1D = 1, so x=y=0x = y = 0. Those values also kill the first two components. The critical set is therefore the entire zz-axis, not an isolated point, which is a good reminder that critical points in three variables can form curves and surfaces.

Frequently asked questions

Why is fz\frac{\partial f}{\partial z} not a fraction like the other two?

Because ff is linear in zz. With xx and yy held fixed, f=kzf = kz where k=ln(1+x2+y2)k = \ln(1+x^2+y^2), and the derivative of kzkz with respect to zz is kk. The fraction only appears when the chain rule reaches inside the logarithm, which happens for xx and yy.

Does the gradient stay defined everywhere?

Yes. The argument 1+x2+y21 + x^2 + y^2 is at least 1, so the logarithm is defined for all real xx and yy and the denominator never reaches zero. There are no excluded points to worry about.