Recommended resources
The freely available resources this lesson will direct you to.
- M4ML - Multivariate Calculus - 4.8 Multivariate Taylorwww.youtube.com
- Taylor Series and Taylor's Theorem for Multivariable Functions, Real Analysis IIwww.youtube.com
- Taylor's Theorem in One and Several Variableswww.rose-hulman.edu
- Hessian Matrix, Taylor Series, and the Newton-Raphson ...pyimagesearch.com
Welcome to the next lesson in our journey through multivariable calculus. In our previous session, we introduced the Hessian matrix and saw how its eigenvalues reveal the local curvature of a function's surface. This gave us a powerful tool to understand the geometry at a specific point—whether it's bowl-shaped, dome-shaped, or a saddle.
Today, we will synthesize this concept with the gradient to construct one of the most fundamental tools in applied mathematics: the Taylor expansion for multivariable functions. Just as Taylor series in single-variable calculus allow us to approximate complex functions with simple polynomials, their multivariable counterparts let us approximate complex surfaces with planes and quadratic shapes. This is the theoretical bedrock for many optimization algorithms, including Newton's method, which you'll encounter in deep learning.
Our goal is to construct and understand both the first-order (linear) and second-order (quadratic) Taylor approximations.
From Tangent Lines to Tangent Planes
Let's start by recalling the Taylor expansion for a single-variable function around a point :
The first-order approximation, , gives the tangent line to the function at . It's the best linear approximation of the function near that point.
Now, consider a scalar-valued function of multiple variables, , where . We want to approximate this function near a point .
The first-order term in the 1D case is the product of the derivative and the displacement, . In the multivariable world, the derivative is captured by the gradient, , and the displacement is the vector .
How would you combine the gradient vector and the displacement vector to produce a scalar value analogous to the 1D term ?
This operation is precisely the dot product, which projects the displacement vector onto the direction of steepest ascent. This gives us the first-order Taylor expansion, also known as the linear or tangent plane approximation:
This equation defines a hyperplane (a plane in 3D) that is tangent to the surface of at the point . It has the same value and the same "slope" (gradient) at that point.
The following video provides an excellent visual intuition for how these approximations build up from a constant value (zeroth-order) to a tangent plane (first-order) and finally to a curved surface (second-order).
M4ML - Multivariate Calculus - 4.8 Multivariate Taylor
This video from Imperial College London, "M4ML - Multivariate Taylor," demonstrates how Taylor approximations look as surfaces.
Watch the segment from the visual demonstration. Pay attention to how the zeroth-order approximation is a flat plane, and the first-order approximation is a tilted plane that matches the function's gradient at the point of expansion.
Incorporating Curvature: The Second-Order Approximation
The linear approximation is good, but it's flat. It completely ignores the curvature we studied in the last lesson. To create a better approximation, we need to include a second-order term.
In the 1D case, this term is . It involves the second derivative and the square of the displacement. For the multivariable case, the second derivative is the Hessian matrix, , and the displacement is the vector .
Drawing on our previous lesson, how can we combine the Hessian matrix with two instances of the displacement vector to produce a scalar value that represents curvature's effect?
You're right, this calls for the quadratic form we explored previously. Here, the vector is our displacement vector . By adding this term, we arrive at the second-order Taylor expansion:
This is no longer a flat plane but a quadratic surface (a paraboloid or hyperboloid) that approximates the original function. It matches the function's value, its gradient, and its curvature (as defined by the Hessian) at the point .

The following resource provides a clear, concise summary of these formulas and presents them in the compact matrix notation that is standard in machine learning.
Hessian Matrix, Taylor Series, and the Newton-Raphson ...
This article from PyImageSearch lays out the formulas for multivariable Taylor series in a very practical way.
Please read the sections titled "Linearization" and "Taylor Series Expansion". Focus on the equations for the first-order approximation and the second-order approximation. Notice how the gradient and Hessian slot perfectly into the general Taylor series structure.
A Concrete Example
Let's solidify this with a worked example from the same article. We'll find the first and second-order approximations for the function around the point .
The process involves:
- Evaluating the function at the point: .
- Computing the gradient and evaluating it at .
- Computing the Hessian and evaluating it at .
- Plugging these components into the Taylor expansion formulas.
Hessian Matrix, Taylor Series, and the Newton-Raphson ...
Let's continue with the PyImageSearch article.
Read through the short example that begins just after the second figure. It shows the calculation of the gradient and Hessian for the example function and then assembles the first- and second-degree polynomial approximations.
This process demonstrates how the abstract formulas translate into a concrete computational recipe. In practice, libraries like PyTorch or JAX would compute these derivatives automatically, but understanding the underlying structure is crucial.
Taylor's Theorem: Making the Approximation Exact
So far, we've used the "approximately equal" sign (). But how good is this approximation? Taylor's Theorem provides the answer by giving an exact expression that includes a remainder term. The most intuitive form is the Lagrange remainder.
For the second-order expansion, the theorem states that there exists some point on the line segment connecting and such that:
Notice the only difference: the Hessian is evaluated at this intermediate point , not at . This means the error in our quadratic approximation is determined by how much the Hessian changes between and . If the function has very stable, slowly-changing curvature, our approximation will be excellent.
The proof of this theorem is a beautiful piece of calculus. It works by reducing the multivariable problem to a single-variable problem along the line connecting and , and then applying the familiar 1D Taylor's theorem.
To see how this is formally stated and derived, let's look at a more rigorous resource.
Taylor Series and Taylor's Theorem for Multivariable Functions, Real Analysis II
This video, "Taylor Series and Taylor's Theorem for Multivariable Functions" by Dr. Bevin Maultsby, provides a formal proof.
Watch from the statement of the theorem. The instructor carefully lays out the full theorem, including the Taylor polynomial and the Lagrange remainder term. The key insight is that the remainder term looks almost identical to the next term in the series, but the derivative is evaluated at an unknown point c on the line segment between p and x. Then, watch the setup of the proof from parameterizing the line segment, which introduces the core strategy of defining a single-variable function h(t) by evaluating f along the line.
This reduction to a 1D problem is a common and powerful technique in multivariable analysis, elegantly connecting complex higher-dimensional concepts back to the foundational principles of single-variable calculus.
Conclusion
In this lesson, we have assembled the gradient and the Hessian into the multivariable Taylor series, a tool for creating local polynomial approximations of complex functions.
Key Takeaways:
- The first-order Taylor expansion approximates a function with a tangent hyperplane, using the function's value and gradient at a point.
- The second-order Taylor expansion provides a more accurate quadratic approximation by also matching the function's curvature via the Hessian.
- Taylor's Theorem makes these approximations exact by adding a remainder term, which depends on higher-order derivatives at an intermediate point.
You now possess the complete analytical toolkit for describing the local behavior of a multivariable function. In our next and final lesson of this module, we will apply these Taylor expansions at critical points (where ) to formally derive the second derivative test and classify these points as local minima, maxima, or saddle points.