$\frac{d}{dx} \sin x=?\,$ This article/section deals with mathematical concepts appropriate for a student in late high school or early university.

In mathematics, the gradient is a vector associated to a point p of a differentiable function f(x1,...,xn) which takes real values. Specifically, the gradient at p is a vector in Rn which points in the direction in which f increases most rapidly at p. The magnitude of the gradient at p is equal to the maximum directional derivative of f at p. The gradient is an extension of the idea of derivative to functions with more than one variable.

Stated another way, a gradient is a vector that has coordinate components that consist of the partial derivatives of a function with respect to each of its variables. For example, if f(x,y) = x2 + y2, then

$\nabla f(x,y) = \left( \frac{\partial f}{\partial x}, \frac{\partial f}{\partial y} \right) = (2x,2y)$. Observe that in this case, the gradient vector (2x,2y) is orthogonal to the "level curve" defined by x2 + y2 = r2, which here is a circle: the gradient points outward from the origin, which is the direction of steepest increase of f, and vectors outward from the origin are perpendicular to circles centered at the origin. We'll see later that this is a case of a more general property of the gradient.

More precisely, we define the gradient, $\nabla f$ of f to be the vector field:

$\nabla f = (\frac{\partial f}{\partial x_1},...,\frac{\partial f}{\partial x_n})$

consisting of the various partial derivatives of f. If u is a unit vector in Rn, then, by the chain rule, the directional derivative of f in the direction of u is simply the dot product:

$\nabla f \cdot u$

Evidently by the Cauchy-Schwartz inequality, the directional derivative in the direction u is maximal in the direction of the gradient, and equal to $||\nabla f||$ for u a unit vector in the direction of the gradient.

If f is a differentiable function with smooth level sets f − 1(c), then the gradient vector field $\nabla f$ is perpendicular to the level sets of f. For fix a level set S = f − 1(c), and let v be a vector tangent to S at p. Then we can find a curve γ(t) on S with γ'(0) = v. Now

$f\circ\gamma(t) = c$

since S is a level set. Taking derivatives of both sides and applying the chain rule, we get that

$\nabla f\cdot \gamma'(0) = \nabla f\cdot v = 0$

Thus, $\nabla f$ is perpendicular to v at p, i.e., the gradient of f is perpendicular to the level sets of f.