In vector calculus, the gradient ∇f of a scalar-valued differentiable function f of several variables is the vector field (or vector-valued function) whose value at a point p gives the direction and the rate of fastest increase. The nabla symbol ∇, pronounced "del", denotes the vector differential operator. If the gradient of a function is non-zero at a point p, the direction of the gradient is the direction in which the function increases most quickly from p, and the magnitude of the gradient is the rate of increase in that direction, the greatest absolute directional derivative. This property of the gradient as the fastest increase leads to gradient descent, an optimization technique to minimize a function. This technique is widely used in machine learning. In coordinate-free terms, the gradient ∇f may be defined by: df=∇f⋅d𝐫 where df is the total infinitesimal change in f for an infinitesimal displacement d𝐫, and is seen to be maximal when d𝐫 is in the direction of the gradient ∇f. In a Cartesian coordinate system, the gradient is a vector of partial derivatives. For f:ℝn→ℝ, its gradient ∇f:ℝn→ℝn is defined at the point p=(x1,…,xn) as the vector ∇f(p)=[∂f∂x1(p)⋮∂f∂xn(p)]. (See § Cartesian coordinates for the conditions under which the above formula applies). The gradient is dual to the total derivative df; see § Relationship with total derivative. It also admits multiple generalizations to more general functions on manifolds; see § Generalizations.
Motivation
Consider a room where the temperature is given by a scalar field, T, so at each point (x, y, z) the temperature is T(x, y, z), independent of time. At each point in the room, the gradient of T at that point will show the direction in which the temperature rises most quickly, moving away from (x, y, z). The magnitude of the gradient will determine how fast the temperature rises in that direction. Consider a surface whose height above sea level at point (x, y) is H(x, y). The gradient of H at a point is a plane vector pointing in the direction of the steepest slope or grade at that point. The steepness of the slope at that point is given by the magnitude of the gradient vector. The gradient can also be used to measure how a scalar field changes in other directions, rather than just the direction of greatest change, by taking a dot product. Suppose that the steepest slope on a hill is 40%. A road going directly uphill has slope 40%, but a road going around the hill at an angle will have a shallower slope. For example, if the road is at a 60° angle from the uphill direction (when both directions are projected onto the horizontal plane), then the slope along the road will be the dot product between the gradient vector and a unit vector along the road, as the dot product measures how much the unit vector along the road aligns with the steepest slope, which is 40% times the cosine of 60°, or 20%. More generally, if the hill height function H is differentiable, then the gradient of H dotted with a unit vector gives the slope of the hill in the direction of the vector, the directional derivative of H along the unit vector.
Notation The gradient of a function f at point a is usually written as ∇f(a). It may also be denoted by any of the following:
∇→f(a) : to emphasize the vector nature of the result. gradf ∂if and f,i : Written with Einstein notation, where repeated indices (i) are summed over.
Definition
The gradient (or gradient vector field) of a scalar function f(x1, x2, x3, …, xn) is denoted ∇f or ∇→f where ∇ (nabla) denotes the vector differential operator, del. The notation grad f is also commonly used to represent the gradient. The gradient of f is defined as the unique vector field whose dot product with any unit vector 𝐯̂ at each point x is the directional derivative of f along v. That is, (∇f(x))⋅𝐯̂=D𝐯f(x) where the right-hand side is the directional derivative and there are many ways to represent it. Formally, the derivative is dual to the gradient; see relationship with derivative. When a function also depends on a parameter such as time, the gradient often refers simply to the vector of its spatial derivatives only (see Spatial gradient). The magnitude and direction of the gradient vector are independent of the particular coordinate representation.
Cartesian coordinates In a Cartesian coordinate system with a Euclidean metric, for f:ℝn→ℝ, its gradient ∇f:ℝn→ℝn, if it exists, is defined at the point p=(x1,…,xn) as ∇f(p)=[∂f∂x1(p)⋮∂f∂xn(p)].
Three-dimensional case A common special case is when n=3 and p=(x,y,z), the gradient is given by ∇f(p)=∂f∂x𝐢+∂f∂y𝐣+∂f∂z𝐤. Note the notation change from the n-dimensional definition, where x1,x2,x3 are renamed to x,y,z. The vectors i, j, k are the standard unit vectors in the directions of the x, y and z coordinates, respectively. For example, the gradient of the function f(x,y,z)=2x+3y2−sin(z) is ∇f(x,y,z)=2𝐢+6y𝐣−cos(z)𝐤. or ∇f(x,y,z)=[26y−cosz].
Conditions for validity The definition ∇f(p)=[∂f∂x1(p)⋮∂f∂xn(p)] only holds if f is differentiable at p. There can be functions for which partial derivatives exist in every direction but fail to be differentiable. For example, the function f(x,y)={x2yx2+y2if (x,y)≠(0,0)0if (x,y)=(0.0), is not differentiable at the origin, as it does not have a well-defined tangent plane despite having well-defined partial derivatives in every direction at the origin. Furthermore, this definition as the vector of partial derivatives is valid only when the basis of the coordinate system is orthonormal. For any other basis, the metric tensor at that point needs to be taken into account.
Cylindrical and spherical coordinates
In cylindrical coordinates, the gradient is given by: ∇f(ρ,φ,z)=∂f∂ρ𝐞ρ+1ρ∂f∂φ𝐞φ+∂f∂z𝐞z, where ρ is the axial distance, φ is the azimuthal or azimuth angle, z is the axial coordinate, and eρ, eφ and ez are unit vectors pointing along the coordinate directions. In spherical coordinates with a Euclidean metric, the gradient is given by: ∇f(r,θ,φ)=∂f∂r𝐞r+1r∂f∂θ𝐞θ+1rsinθ∂f∂φ𝐞φ, where r is the radial distance, φ is the azimuthal angle and θ is the polar angle, and er, eθ and eφ are again local unit vectors pointing in the coordinate directions (that is, the normalized covariant basis). For the gradient in other orthogonal coordinate systems, see Orthogonal coordinates (Differential operators in three dimensions).
… excerpt ends here. Continue reading the full article.



