Gradients
The gradient of a scalar function is the vector of partial derivatives. It gives the local direction of steepest increase under the Euclidean norm, so its negative is the basic descent direction used by gradient descent and neural-network backpropagation.
Defining math
For ,
The first-order approximation is
For squared error on one linear prediction, , the gradient is
This formula is the small local object that becomes batched matrix expressions in matrix multiplication and stochastic estimates in stochastic gradient descent.
Worked example
Take weights , input , and target . The prediction is , so the residual is and the loss is . Substituting into ,
A centered finite-difference check, for each coordinate , reproduces the same vector — the standard sanity test when implementing custom derivatives.
Caveats
Gradients are local. A small gradient can mean a minimum, a saddle point, saturation, or bad scaling. For curvature and second-order checks, use Jacobians and Hessians rather than gradient magnitude alone.
References
Nav