1. Aug 5, 2014

### kidsasd987

This is a bit counterintuitive to me that the gradient vector is always normal to the level curve
and the level surface.

lets say we have a function f(x,y)=z

f(x,y) partial derivative with respect to x*i +f(x,y) partial derivative with respect to y*j

what we actually get is,

then,

[(dz/dx*i)+(dz/dy)*j]/sqrt((dz/dx*i)^2+(dz/dy*j)^2)

this is always perpendicular to the level curve. But why does that direction always maximize the function?

2. Aug 6, 2014

### homeomorphic

Think of going up a hill. You always have to go perpendicular to the level curve. You're not going to be winding around the side if you want the most direct route.

3. Aug 6, 2014

### HallsofIvy

Staff Emeritus
Another way of looking at it: if z= f(x, y) then the "directional derivative", $f_{\theta}$, the rate of change of f as you move in the direction that makes angle $\theta$ with the positive x axis, is $\nabla f\cdot \vec{e}_{\theta}$ where $\vec{e}_{\theta}$ is the unit vector in that direction, which, in turn, is equal to $$\left(\frac{\partial f}{\partial x}\vec{i}+ \frac{\partial f}{\partial y}\vec{j}\right)\cdot \left(\vec{i}cos(\theta)+ \vec{j}sin(\theta)\right)= cos(\theta)\frac{\partial f}{\partial x}+ sin(\theta)\frac{\partial f}{\partial x}$$.

To maximize (or minimize) that with respect to $\theta$, take the derivative with respect to $\theta$, set it equal to 0 and solve for $\theta$. you will get
$$tan(\theta)= \frac{\frac{\partial f}{\partial y}}{\frac{\partial f}{\partial x}}$$
showing that $\theta$ for the maximum is, indeed, the direction in which $\nabla f$ points while the minimum is in the opposite direction.