What is the gradient of a function of two variables, and what does it tell you? What is the gradient of at the point ?
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 as the height of a hill at map position . A partial derivative is the ordinary school slope in one direction while the other variable is held fixed. The gradient stacks the partial derivatives into one vector: . It points in the direction in which the function rises fastest.
Steps
- Say what the gradient is: one slope per input, written as a vector. For one variable it is just the usual derivative.
- Find the slope in : treat as a fixed number, so . In the same way .
- Put them together: .
- Plug in the point: .
- Read it: at the hill rises fastest towards the upper right, so the downhill direction is . That is the direction gradient descent walks.
Common mistakes
- Treating the gradient as a single number. With two inputs it has two entries.
- Forgetting to hold the other variable fixed, for example differentiating and together as if they were one variable.
- Thinking the gradient points downhill. It points uphill; gradient descent uses its negative.
How long your answer should be
About 1–2 minutes; one short derivative for each variable.
Read this
- Khan Academy: The gradient: Article that introduces partial derivatives and the gradient vector with the uphill-direction picture.
Previous in Linear algebra and optimisation: What is a vector norm, how do the (Manhattan) norm and the (Euclidean) norm differ geometrically, and what are both norms for ?
Next in Linear algebra and optimisation: Why does gradient descent step in the direction ?