Multivariable calculus

Directional derivative of ln(x^2 + y^2) at (1, 2)

At (1, 2) the gradient of f(x,y) = ln(x^2 + y^2) is (2/5, 4/5). Dotting with the unit direction (0.8, -0.6) gives -4/25, that is -0.16. The value is negative, so f decreases as you step away from (1, 2) in that direction.

f(x,y)=ln⁡(x2+y2)f(x,y) = \ln(x^2 + y^2)
Duf(1,2)=−425=−0.16D_{\mathbf{u}} f(1,2) = -\frac{4}{25} = -0.16

At x = 1, y = 2, in the unit direction (0.8, -0.6).

Log outside, chain rule inside

For ln⁡(u)\ln(u) the partial is ux/uu_x / u, so the inner derivative sits on top. With u=x2+y2u = x^2 + y^2 that gives 2x2x over uu in the xx slot and 2y2y over uu in the yy slot.

∇f=⟨2xx2+y2,  2yx2+y2⟩,∇f(1,2)=⟨25,45⟩\nabla f = \left\langle \frac{2x}{x^2+y^2},\; \frac{2y}{x^2+y^2} \right\rangle, \qquad \nabla f(1,2) = \left\langle \frac{2}{5}, \frac{4}{5} \right\rangle

At (1,2)(1,2) the denominator is 1+4=51 + 4 = 5. Dotting with u=⟨0.8,−0.6⟩\mathbf{u} = \langle 0.8, -0.6 \rangle takes one line.

Duf(1,2)=25(0.8)+45(−0.6)=0.32−0.48=−425D_{\mathbf{u}} f(1,2) = \frac{2}{5}(0.8) + \frac{4}{5}(-0.6) = 0.32 - 0.48 = -\frac{4}{25}

The mistake: dropping the inner derivative

The usual slip is writing ∂f∂x=1x2+y2\frac{\partial f}{\partial x} = \frac{1}{x^2+y^2}, as though ln⁡\ln of a lump differentiates like ln⁡x\ln x. That halves the xx component here and quarters the yy component, giving 15(0.8)+15(−0.6)=0.04\frac{1}{5}(0.8) + \frac{1}{5}(-0.6) = 0.04, a positive number where the truth is negative.

A sign check catches it. The gradient always points away from the origin here, because ln⁡(x2+y2)\ln(x^2+y^2) grows with distance, so the sign of the answer is the sign of the direction's component along the outward radial vector ⟨1,2⟩/5\langle 1, 2 \rangle / \sqrt{5}. For ⟨0.8,−0.6⟩\langle 0.8, -0.6 \rangle that component is (0.8−1.2)/5≈−0.179(0.8 - 1.2)/\sqrt{5} \approx -0.179, pointing inward, so a negative answer is what you should expect. A negative yy part on its own proves nothing: ⟨0.96,−0.28⟩\langle 0.96, -0.28 \rangle also tilts downward and gives +0.16+0.16.

Reading the negative sign

The level curves of ff are circles centred at the origin, and the gradient is perpendicular to them. The angle between ∇f(1,2)\nabla f(1,2) and u\mathbf{u} is about 100.3 degrees, just past the right angle that would give zero.

  • Angle under 90 degrees: ff increases along that direction
  • Angle exactly 90 degrees: you are moving along the level circle and the rate is 0
  • Angle over 90 degrees, as here: ff decreases, and the value is negative

The size is small because ∥∇f(1,2)∥=25≈0.894\lVert \nabla f(1,2) \rVert = \frac{2}{\sqrt{5}} \approx 0.894 and the cosine is only about −0.179-0.179.

The function is defined everywhere except the origin, and (1, 2) is well inside its domain. The build rebuilds the gradient there by central differences on ln(x^2 + y^2) and fails unless the dot product with (0.8, -0.6) is still -0.16.

Frequently asked questions

Does the answer depend on the base of the logarithm?

Yes. This page uses the natural log. For log⁡10(x2+y2)\log_{10}(x^2+y^2) every component and the final answer are divided by ln⁡10≈2.303\ln 10 \approx 2.303, giving about −0.0695-0.0695.

What is the fastest rate of decrease at (1, 2)?

It is −∥∇f(1,2)∥=−25≈−0.894-\lVert \nabla f(1,2) \rVert = -\frac{2}{\sqrt{5}} \approx -0.894, in the direction −∇f-\nabla f, which points back toward the origin along ⟨−1,−2⟩/5\langle -1, -2 \rangle / \sqrt{5}.