Multivariable Taylor expansion: what the Hessian adds

The question
Can you tune 3 Hessian entries to match a surface near one point?
Keep the height and tilt fixed. Adjust the bending.
- 1 SeeFit three Hessian entries.
- 2 TryPredict, then test the local error.
- 3 ProveReduce a surface to a slice.
- 4 ApplyEstimate changes and bound the remainder.
Before you start · 3 quick checks on a partial derivative, a Taylor coefficient, and a path
Two ideas before you start
2 ideasA displacement starts at the center
The slice z = x² and its tangent at the selected center.
Changing the center changes the local model. The step is measured from that center, not from the origin.
Exact definition
Write the center as \(p=(a,b)\) and the displacement as \(h=(u,v)\). The destination is \(p+h=(a+u,b+v)\), and the step length is \(\|h\|=\sqrt{u^2+v^2}\). The gradient \(\nabla f(p)=(f_x(p),f_y(p))\) collects the first partial derivatives. Its dot product with the step is \(f_x(p)u+f_y(p)v\).
The tangent-plane model is \(T_1(p+h)=f(p)+\nabla f(p)\cdot h\). Like the tangent line in Taylor polynomials, it matches the value and first derivatives at the center. It need not match a nearby value exactly.
The Hessian keeps track of bending
Two coordinate slices of z = 3x² + y².
A surface can bend differently in different directions. Coordinate slices show the diagonal entries; changing one slope across the other coordinate gives the mixed entry.
Exact definition
Assume \(f\in C^2\) on an open neighborhood of \(p\): all partial derivatives through order two exist and are continuous there. The Hessian is the matrix
\[H(p)=\begin{pmatrix}f_{xx}(p)&f_{xy}(p)\\f_{yx}(p)&f_{yy}(p)\end{pmatrix}.\]Continuous second partials imply \(f_{xy}=f_{yx}\), so only three entries are independent in two variables. Matrix multiplication gives
\[h^{\mathsf T}Hh=f_{xx}u^2+2f_{xy}uv+f_{yy}v^2.\]The entries here are evaluated at the center. The symbol \(\mathsf T\) means transpose: it turns the column vector into a row. This expression is called a quadratic form. No eigenvalue calculation is needed for this lesson.
Fine print: a local polynomial, not a global fit
Coordinates must stay in the domain of the function. Choose a small open disk around the center so each segment to a nearby point stays in that domain. Taylor coefficients come from derivatives at one point. They do not minimize every possible average error over a large region. In the fitting game the target is exactly quadratic, so matching its derivatives also matches its whole surface. General smooth surfaces leave a remainder.
The lesson on critical points uses Hessian signs to classify stationary points. Here the center may have a nonzero gradient. The task is to estimate a value, not to find or classify an extremum.
Fit the quadratic patch
- Adjust A, B, and C. A and C are your guesses for the diagonal Hessian entries \(f_{xx}\) and \(f_{yy}\); B is your guess for the mixed entry \(f_{xy}\).
- The solid mesh is the target; the dashed mesh is your model. The score appears after your first adjustment.
- Press Check my fit to see which entries are too small or too large. Match all entries to continue to Next surface.
What the score measures
The root mean square error, or RMSE, is the square root of the average squared vertical error. This game samples a square centered at the origin, using coordinates −0.5, −0.25, 0, 0.25, and 0.5 on each axis. It scores all 25 pairs. The control step is one integer, from −6 to 6. A rounded score is a measurement on this grid, not a guarantee between samples.
There is a special reason an exact zero score settles this game: both surfaces are quadratic with the same constant and linear terms. Matching on the coordinate axes fixes the two pure quadratic coefficients; matching a point off those axes then fixes the mixed coefficient. Thus matching these samples forces the entire quadratic difference to vanish. This argument would fail for an arbitrary nonquadratic target.
How does the error change?
Now use a nonquadratic surface, \(f(x,y)=e^{x+2y}\), centered at the origin. Its model is \(T_2(x,y)=1+(x+2y)+(x+2y)^2/2\). A step \(h=(r,r)\) changes both coordinates together.
Choose a step that meets an error target
Use what you found above. Select a row with the slider, then meet the two goals. Each asks for the largest allowed r satisfying its condition. The table gives actual errors and upper bounds; they answer different questions.
| r | Actual error | Upper bound |
|---|
Why this particular bound holds
On this path set \(s=3r\). One-variable Taylor's theorem gives a positive remainder \(e^\xi s^3/6\), with \(0\lt\xi\lt s\). Since the exponential is increasing, the error is at most \(e^s s^3/6\). This bound controls the third derivative along the entire segment. The proof stage derives this bound for \(0\lt s\lt1\); the same steps work for every positive s, including the larger steps in the table.
For a different direction the expression changes. Along \(h=(r,-r/2)\), the exponent is unchanged and the second-order model is exact. Direction matters as well as distance: a remainder ratio seen on one path is not a rule for every direction.
Turn the surface into a one-variable path
Let f be C² on an open neighborhood of p. For h sufficiently small that the segment p + th, 0 ≤ t ≤ 1, stays there,
\[\begin{aligned} f(p+h)&=f(p)+\nabla f(p)\cdot h\\&\quad+\tfrac12h^{\mathsf T}H(p)h+R(h),\\\frac{R(h)}{\|h\|^2}&\longrightarrow0\quad(h\to0,\ h\ne0).\end{aligned}\]The limit holds from all directions. It says the error is small compared with squared distance. It does not say that the error vanishes at every nearby point, or that it always has a cubic bound.
General derivation and the uniform remainder
Define \(g(t)=f(p+th)\) on the segment. The multivariable chain rule, applied twice, gives \(g'(t)=\nabla f(p+th)\cdot h\) and \(g''(t)=h^{\mathsf T}H(p+th)h\). The direction vector is constant, so it has no derivative terms of its own.
Integration by parts gives \(g(1)=g(0)+g'(0)+\int_0^1(1-t)g''(t)\,dt\). Subtract the constant Hessian contribution to obtain
\[\begin{aligned}R(h)=\int_0^1 &(1-t)\,h^{\mathsf T}\\&\cdot[H(p+th)-H(p)]h\,dt.\end{aligned}\]Define \(\omega(\rho)\) to be the supremum of the operator norm of \(H(z)-H(p)\) for \(\|z-p\|\le\rho\), inside a closed disk contained in the neighborhood. The operator norm is the largest stretch of a unit vector. It gives \(|h^{\mathsf T}Ah|\le\|A\|\|h\|^2\). Continuity makes \(\omega(\rho)\to0\). Therefore
\[|R(h)|\le\tfrac12\omega(\|h\|)\|h\|^2.\]This one bound works for every direction, which is stronger than checking the limit along a few selected lines. The zero step satisfies the expansion directly with zero remainder.
Build a concrete instance. Take \(f(x,y)=e^{x+2y}\), p at the origin, and \(h=(u,v)\). Put \(s=u+2v\) and assume \(0\lt s\lt1\). Thus \(g(t)=e^{ts}\). These conditions apply to every option below.
Multiply out \((u+2v)^2\), then compare its coefficients with the Hessian. A mixed term is not an extra independent direction; it records how the slope in one coordinate changes as the other coordinate changes.
When a cubic bound is justified
If f has continuous third derivatives near the segment, the one-variable remainder applied to g gives \(R(h)=D^3f(p+\theta h)[h,h,h]/6\) for some \(0\lt\theta\lt1\). Here D³f is the third derivative applied to three vectors. If its size on unit vectors is at most M throughout the neighborhood, then \(|R(h)|\le M\|h\|^3/6\). Without such extra control, keep the C² statement above.
Compute the step before the estimate
Each problem has hints and a worked solution. Enter one number. Answers within the displayed absolute tolerance are accepted. This checks numerical arithmetic; it does not change an exact symbolic identity into an approximate one.
Further reading
- J. E. Marsden and A. Tromba, Vector Calculus, chapter 3, “Higher-Order Derivatives; Maxima and Minima.”