What is the gradient of a function of two variables, and what does it tell you? What is the gradient of f(x,y)=x2+y2 at the point (3,4)?

Linear algebra and optimisation, Gradient methods
Level L1 Beginner. Length Short. Nature Th+Mat Both.

What's being asked

Whether you can say in plain words that the gradient is the list of slopes, one per input, and that it points uphill.

Key idea

Picture f(x,y) as the height of a hill at map position (x,y). A partial derivative is the ordinary school slope in one direction while the other variable is held fixed. The gradient ∇f stacks the partial derivatives into one vector: ∇f=(∂f∂x,∂f∂y). It points in the direction in which the function rises fastest.

Steps

  1. Say what the gradient is: one slope per input, written as a vector. For one variable it is just the usual derivative.
  2. Find the slope in x: treat y as a fixed number, so ∂f∂x=2x. In the same way ∂f∂y=2y.
  3. Put them together: ∇f(x,y)=(2x,2y).
  4. Plug in the point: ∇f(3,4)=(6,8).
  5. Read it: at (3,4) the hill rises fastest towards the upper right, so the downhill direction is −∇f=(−6,−8). That is the direction gradient descent walks.

Common mistakes

How long your answer should be

About 1–2 minutes; one short derivative for each variable.

Read this

Previous in Linear algebra and optimisation: What is a vector norm, how do the ℓ1 (Manhattan) norm and the ℓ2 (Euclidean) norm differ geometrically, and what are both norms for v=(3,−4)⊤?
Next in Linear algebra and optimisation: Why does gradient descent step in the direction −∇f(x)?