Differentiability and the Gradient
In questa pagina 8
In one variable, differentiable at means : near the function is approximated by the tangent line with a negligible error. In several variables the partial derivatives alone do not give this property (we saw that they do not even guarantee continuity). So we demand it as a definition.
Definition of differentiable function
A function is differentiable at a point interior to if there exists a vector such that the increment of the function can be approximated linearly:
where is the differentialthe dot product of the gradient vector and the increment vector and is a little-o terma term that tends to zero faster than the norm of the increment describing the approximation error.
Theorem. If is differentiable at , then the vector is uniquely determined and equals the gradient of at , i.e. . Moreover, is continuous at and has all its partial derivatives there.
Example. is differentiable at with : .
Why.
- Continuity: as we have and , hence .
- : take (we move along axis ). Then and so the -th partial derivative exists and equals .
In two variables, setting and , the definition is rewritten as a limit to check: This is the differentiability test: first compute the partial derivatives (if they do not exist, is not differentiable), then check this limit with the methods of Limits and Continuity in Several VariablesThe limit of a function of several variables exists if the value approaches L independently of the path; it is shown to exist with estimates in polar coordinates and shown not to exist by restricting to different curves. Continuity requires the limit to equal the value of the function at the point.Limits and Continuity in Several Variables →.
Gradient and tangent plane
The gradient is the vector of partial derivatives, (see Partial and Directional DerivativesThe partial derivative with respect to x_i at x0 is the derivative of the one-variable function obtained by freezing all the other variables, so in practice one differentiates in x_i treating the others as constants. The gradient collects the partial derivatives; the directional derivative along a unit vector v is the limit of [f(x0 + hv) - f(x0)]/h. In several variables having all partial (even directional) derivatives does not guarantee continuity.Partial and Directional Derivatives →). If the function is differentiable, the plane tangent to the graph of at the point has equation:
In two variables, explicitly:
It is the plane passing through the point of the graph and having, along the two axes, the same slopes as the surface. Differentiability says that the vertical distance between graph and plane is , i.e. negligible with respect to the distance from .
Example. at : , , . Tangent plane: , i.e. .
Sufficient condition
The existence of partial derivatives does not always guarantee differentiability. So we use the criterion:
Total differential theorem. If has partial derivatives in a neighbourhood of and these are continuousfunctions whose limit at the point equals the value at the point at , then is differentiable at .
Example. has partial derivatives and , continuous on all of : hence is differentiable at every point.
A function whose partial derivatives are continuous at every point of an open set is said to be of class C^1a function with continuous first partial derivatives.
Directional derivative and gradient
For a differentiable function, the derivative along a direction (with ) need not be computed through the limit of the difference quotient:
Gradient formula. If is differentiable at , then for every unit vector the directional derivative exists and is given by:
Example. at with : .
Why. Take in the definition: (because ) and
Geometric interpretation
Steepest increase: the gradient points in the direction of steepest increase of the function. The value of the maximum slope is .
Why: if is the angle between and the unit vector , then . It is maximal for ( in the direction of the gradient, value ), minimal for (opposite direction, value ) and zero for .
Orthogonality: the gradient is orthogonal to the level curvethe set of points where f equals a constant c through .
Why: along the level curve is constant, so the derivative in the direction tangent to the curve is ; by point 1 that direction makes a right angle with the gradient.
Example. at : , which points radially outward, perpendicular to the level circle . The maximum slope is ; along the tangent to the circle, for instance , the derivative is .
Grafico interattivo: f = x² + y² at (1, 2): grad f = (2, 4) is perpendicular to the level curve x² + y² = 5 (circle of radius √5) and to its tangent x + 2y = 5, and is the direction of steepest increase
Worked numerical example
Consider . We check differentiability at .
- Compute the partial derivatives:
- At : , .
- The partial derivatives are elementary functions, continuous on all of . By the total differential theorem, is differentiable at (in fact at every point).
- Tangent plane at : , so .
Exercise: a function with partial derivatives, continuous but not differentiable
for , . We study the origin.
- Continuity. With : (for the function is ). So is continuous at .
- Partial derivatives. , so . , so .
- Differentiability. The candidate plane is ; we must see whether . Along with , using : which equals depending on the sign of : it does not tend to . The function is not differentiable at the origin, although it is continuous and has partial derivatives.
Functions with a parameter in the exponent: the four-step procedure
In exam problems the function is almost always of the form at (with ), or contains absolute values and roots, and one asks for which values of the parameter is continuous, has partial derivatives, is differentiable. Proceed as follows.
- Polar form. Set , ; the numerator, homogeneous of degree (i.e. with bounded and nonzero), gives . If , , etc. appear, replace them by their equivalent (, , ) and check that the remaining factor tends to (is bounded).
- Continuity: if and only if . For the limit depends on (it does not exist, unless ); for it diverges.
- Partial derivatives at : by the definition, because is given separately. If vanishes on the axes, for every value of the parameter (even where is not continuous).
- Differentiability: the limit to study is (the gradient is zero): it tends to if and only if , i.e. . So the differentiability threshold is always lower by than the continuity one.
Example: with , is continuous for and differentiable for .
Absolute values and roots. For the partial derivatives at equal (the function vanishes on the axes), but the derivative in the direction is the limit of : it exists only if . If a directional derivative does not exist, cannot be differentiable.
Common mistakes
- Swapping the implications: having partial derivatives does not imply differentiability. The classic counterexample is (with ), which has partial derivatives at the origin but is not continuous, hence not differentiable.
- Forgetting the unit vector: in computing , the vector must always be a unit vector (). If the direction is given by a non-unit vector, it must be normalized first.
- Sufficient condition mistaken for necessary: continuity of the partial derivatives is sufficient but not necessary. A function can be differentiable even if the partial derivatives are discontinuous (for example at the origin): in that case use the limit test.
- Stopping at the partial derivatives: finding and is not enough; the limit of the differentiability test must still be checked.
Versione ripasso
Definition. is differentiable at if there exists with Differentiable continuous, with partial derivatives, and . The converse is false.
Test in two variables. After computing the partial derivatives, check that Example: with is continuous with zero partial derivatives at . Along the ratio equals , which does not tend to : not differentiable.
Total differential theorem. If the partial derivatives exist near and are continuous at (e.g. if ), then is differentiable. Example: is differentiable everywhere.
Tangent plane. . Example: at , , , so .
Interpretation. , with the angle between and . The gradient points in the direction of steepest increase, with slope , and is orthogonal to the level curve. Example: for at , is perpendicular to the circle . Along the tangent the derivative is .
Numerical example. at : , , values and . Continuous partial derivatives, hence differentiable. Plane: .
Functions with a parameter, at . In polar coordinates, with , we get .
- Continuity: . For the limit depends on .
- Partial derivatives: by the definition. If on the axes, they equal for every parameter.
- Differentiability: . The threshold is lower by than the continuity one.
With : continuous for , differentiable for .
Absolute values and roots. For the partial derivatives at equal , but the derivative along exists only for . If a directional derivative does not exist, there is no differentiability.
Typical mistakes.
- Confusing partial derivatives and differentiability: has partial derivatives at but is not continuous, hence not differentiable.
- Swapping sufficient and necessary: continuous partial derivatives suffice but are not necessary (example: at the origin, to be studied with the test).
- Stopping at the partial derivatives without checking the limit of the test.
- Using a non-unit vector in .
Teoria collegata
- Constrained Extrema and Lagrange Multipliers
- Convex Functions in Several Variables
- Free Extrema in Several Variables
- Hessian Matrix and Taylor Formula
- Implicit Function Theorem
- Jacobian Matrix and the Chain Rule
- Partial and Directional Derivatives
- ADALINE and Gradient Descent
- Introduction to Machine Learning - Program Map