Taylor expansion in several variables

A single-variable Taylor series rebuilds a function near a point from its ordinary derivatives: f(x)=f(a)+f′(a)(x−a)+f′′(a)2!(x−a)2+⋯f(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots. The moment a function depends on two variables, f(x,y)f(x,y), the same idea survives almost unchanged — you just replace ordinary derivatives with partial derivatives, and the algebra of "how many ways can I distribute the increment between xx and yy" turns into a binomial-style pattern involving fxf_x, fyf_y, fxxf_{xx}, fxyf_{xy}, fyyf_{yy}, and so on. This matters immediately in MA10001: the second-order Taylor terms about a point are exactly the ingredients of the discriminant test used in the very next topic to classify a critical point as a maximum, minimum, or saddle. Getting comfortable assembling the expansion here pays off directly there.

The core insight

Near (a,b)(a,b), f(x,y)f(x,y) is approximated by f(a,b)f(a,b) plus a linear term built from fx,fyf_x,f_y plus a quadratic term built from fxx,fxy,fyyf_{xx},f_{xy},f_{yy}, all evaluated at (a,b)(a,b) — the two-variable analogue of the single-variable Taylor series.

The core idea

Set-up. Let h=x−ah = x-a and k=y−bk = y-b be the increments away from the expansion point (a,b)(a,b). Assuming ff has continuous partial derivatives up to the needed order near (a,b)(a,b), the full Taylor expansion is

f(a+h,b+k)=f(a,b)+(hfx+kfy)∣(a,b)+12!(h2fxx+2hkfxy+k2fyy)∣(a,b)+⋯ ,f(a+h,b+k) = f(a,b) + \left(hf_x + kf_y\right)\Big|_{(a,b)} + \frac{1}{2!}\left(h^2f_{xx} + 2hkf_{xy} + k^2f_{yy}\right)\Big|_{(a,b)} + \cdots,

where: fx,fyf_x, f_y are first partial derivatives, fxx,fxy,fyyf_{xx}, f_{xy}, f_{yy} are second partial derivatives (with fxy=fyxf_{xy}=f_{yx} by equality of mixed partials for well-behaved ff), and every derivative on the right is evaluated at the fixed base point (a,b)(a,b), not at the moving point (x,y)(x,y).

The compact operator form. Writing D=h∂∂x+k∂∂yD = h\dfrac{\partial}{\partial x} + k\dfrac{\partial}{\partial y}, the whole series is

f(a+h,b+k)=∑m=0∞1m!(h∂∂x+k∂∂y)mf∣(a,b),f(a+h,b+k) = \sum_{m=0}^{\infty}\frac{1}{m!}\left(h\frac{\partial}{\partial x}+k\frac{\partial}{\partial y}\right)^m f\Big|_{(a,b)},

where: the mm-th term is expanded formally as a binomial power (hp+kq)m(hp+kq)^m with p=∂x,q=∂yp=\partial_x, q=\partial_y, then applied as a differential operator to ff. This is why the m=2m=2 term picks up the binomial coefficient 22 on the mixed derivative: h2fxx+2hkfxy+k2fyyh^2f_{xx} + 2hkf_{xy} + k^2f_{yy}, not h2fxx+hkfxy+k2fyyh^2f_{xx}+hkf_{xy}+k^2f_{yy}.

The truncated form actually used. In MA10001 you almost always stop at second order:

f(a+h,b+k)≈f(a,b)+hfx(a,b)+kfy(a,b)+12[h2fxx(a,b)+2hkfxy(a,b)+k2fyy(a,b)].f(a+h,b+k) \approx f(a,b) + hf_x(a,b) + kf_y(a,b) + \frac{1}{2}\left[h^2f_{xx}(a,b) + 2hkf_{xy}(a,b) + k^2f_{yy}(a,b)\right].

Keeping only the first-order terms reproduces the familiar tangent-plane linear approximation from the total differential; adding the second-order terms captures the local curvature of the surface, which is exactly the information the discriminant test needs.

Maclaurin case. When (a,b)=(0,0)(a,b)=(0,0), the same formula is called the two-variable Maclaurin expansion, directly paralleling f(x)≈f(0)+f′(0)x+⋯f(x) \approx f(0)+f'(0)x+\cdots in one variable.

Why bother with a two-variable version at all. A function of two variables cannot, in general, be evaluated exactly at every nearby point without repeating the (possibly hard) full calculation — the Taylor expansion lets you do all the hard work once, at a single convenient base point, and then reuse that derivative data to approximate ff cheaply at many nearby points, which is exactly what the worked example below does.

Figure
A base point with increments h and k leading to a nearby target point, with a flat tangent plane and a curved surface both drawn to show the linear term versus the linear plus quadratic term
Linear term (tangent plane) versus linear plus quadratic term (curved fit) x direction f base point a comma b first order only: tangent plane first plus second order: fits curvature h equals x minus a, k equals y minus b target point x, y

Second-order Taylor expansion for two variables

The goal, given all first and second partial derivatives of ff at a base point (a,b)(a,b), is to assemble the second-order Taylor approximation f(a+h,b+k)≈f(a,b)+hfx+kfy+12(h2fxx+2hkfxy+k2fyy)f(a+h,b+k) \approx f(a,b) + hf_x + kf_y + \frac{1}{2}(h^2f_{xx}+2hkf_{xy}+k^2f_{yy}) correctly, with every term evaluated at (a,b)(a,b) and the binomial coefficient 22 correctly placed on the mixed term.

Step 1. Start from the one-variable Taylor idea applied along the straight line x=a+ht, y=b+ktx=a+ht,\ y=b+kt for t∈[0,1]t\in[0,1], so t=0t=0 gives the base point and t=1t=1 gives the target point (a+h,b+k)(a+h,b+k). Define g(t)=f(a+ht, b+kt)g(t) = f(a+ht,\ b+kt); then g(0)=f(a,b)g(0)=f(a,b) and g(1)=f(a+h,b+k)g(1)=f(a+h,b+k) is exactly the value we want.

Step 2. Expand g(t)g(t) as an ordinary single-variable Maclaurin series in tt: g(t)=g(0)+g′(0)t+12!g′′(0)t2+⋯g(t) = g(0)+g'(0)t+\frac{1}{2!}g''(0)t^2+\cdots, then set t=1t=1 so that f(a+h,b+k)=g(0)+g′(0)+12!g′′(0)+⋯f(a+h,b+k)=g(0)+g'(0)+\frac{1}{2!}g''(0)+\cdots.

Step 3. Differentiate g(t)=f(a+ht,b+kt)g(t)=f(a+ht,b+kt) using the chain rule for two variables: g′(t)=hfx(a+ht,b+kt)+kfy(a+ht,b+kt)g'(t) = hf_x(a+ht,b+kt) + kf_y(a+ht,b+kt), so g′(0)=hfx(a,b)+kfy(a,b)g'(0) = hf_x(a,b)+kf_y(a,b) — this produces the first-order term.

Step 4. Differentiate again: g′′(t)=h(hfxx+kfxy)+k(hfyx+kfyy)=h2fxx+2hkfxy+k2fyyg''(t) = h\big(hf_{xx}+kf_{xy}\big) + k\big(hf_{yx}+kf_{yy}\big) = h^2f_{xx} + 2hkf_{xy} + k^2f_{yy} (using fxy=fyxf_{xy}=f_{yx}), all evaluated along the line, so g′′(0)=h2fxx(a,b)+2hkfxy(a,b)+k2fyy(a,b)g''(0) = h^2f_{xx}(a,b)+2hkf_{xy}(a,b)+k^2f_{yy}(a,b) — this is exactly where the factor 22 on the mixed term comes from, since both the fxyf_{xy} and fyxf_{yx} contributions collapse into one term.

Step 5. Substitute g(0),g′(0),g′′(0)g(0), g'(0), g''(0) back into f(a+h,b+k)=g(0)+g′(0)+12!g′′(0)+⋯f(a+h,b+k)=g(0)+g'(0)+\frac{1}{2!}g''(0)+\cdots to recover f(a,b)+hfx(a,b)+kfy(a,b)+12[h2fxx(a,b)+2hkfxy(a,b)+k2fyy(a,b)]f(a,b) + hf_x(a,b)+kf_y(a,b) + \frac{1}{2}\big[h^2f_{xx}(a,b)+2hkf_{xy}(a,b)+k^2f_{yy}(a,b)\big], the second-order Taylor expansion.

Worked example

Expand f(x,y)=x2y+sin⁡(x+y)f(x,y) = x^2y + \sin(x+y) about (1,0)(1,0) up to second order and use it to approximate f(1.1,−0.1)f(1.1,-0.1).

Step 1. Compute ff and every needed partial derivative, then evaluate at (a,b)=(1,0)(a,b)=(1,0): f(1,0)=sin⁡1≈0.8415f(1,0)=\sin 1\approx 0.8415; fx=2xy+cos⁡(x+y)⇒fx(1,0)=cos⁡1≈0.5403f_x=2xy+\cos(x+y)\Rightarrow f_x(1,0)=\cos1\approx0.5403; fy=x2+cos⁡(x+y)⇒fy(1,0)=1+cos⁡1≈1.5403f_y=x^2+\cos(x+y)\Rightarrow f_y(1,0)=1+\cos1\approx1.5403; fxx=2y−sin⁡(x+y)⇒fxx(1,0)≈−0.8415f_{xx}=2y-\sin(x+y)\Rightarrow f_{xx}(1,0)\approx-0.8415; fxy=2x−sin⁡(x+y)⇒fxy(1,0)≈1.1585f_{xy}=2x-\sin(x+y)\Rightarrow f_{xy}(1,0)\approx1.1585; fyy=−sin⁡(x+y)⇒fyy(1,0)≈−0.8415f_{yy}=-\sin(x+y)\Rightarrow f_{yy}(1,0)\approx-0.8415.

Step 2. Write the increments for the target point (1.1,−0.1)(1.1,-0.1): h=1.1−1=0.1h=1.1-1=0.1, k=−0.1−0=−0.1k=-0.1-0=-0.1.

Step 3. Assemble the second-order approximation:

f(1.1,−0.1)≈f(1,0)+hfx(1,0)+kfy(1,0)+12[h2fxx(1,0)+2hk fxy(1,0)+k2fyy(1,0)].f(1.1,-0.1) \approx f(1,0) + hf_x(1,0) + kf_y(1,0) + \frac{1}{2}\left[h^2f_{xx}(1,0) + 2hk\,f_{xy}(1,0) + k^2f_{yy}(1,0)\right].

Step 4. Substitute the numbers: ≈0.8415+(0.1)(0.5403)+(−0.1)(1.5403)+12[(0.01)(−0.8415)+2(0.1)(−0.1)(1.1585)+(0.01)(−0.8415)]=0.8415+0.05403−0.15403+12(−0.040)=0.7415−0.020=0.7215\approx 0.8415 + (0.1)(0.5403) + (-0.1)(1.5403) + \frac{1}{2}\big[(0.01)(-0.8415) + 2(0.1)(-0.1)(1.1585) + (0.01)(-0.8415)\big] = 0.8415 + 0.05403 - 0.15403 + \frac{1}{2}(-0.040) = 0.7415 - 0.020 = 0.7215. So f(1.1,−0.1)≈0.7215f(1.1,-0.1) \approx 0.7215, computed entirely from derivative information at (1,0)(1,0), without directly evaluating the (harder-to-handle-by-hand) original expression at the target point.

Competitive stretch

The Maclaurin case is worth memorizing as a shortcut: for f(x,y)=exsin⁡yf(x,y)=e^x\sin y about (0,0)(0,0), the same machinery gives f(0,0)=0f(0,0)=0, fx(0,0)=0f_x(0,0)=0, fy(0,0)=1f_y(0,0)=1, fxx(0,0)=0f_{xx}(0,0)=0, fxy(0,0)=1f_{xy}(0,0)=1, fyy(0,0)=0f_{yy}(0,0)=0, so the second-order Maclaurin approximation is exsin⁡y≈y+xye^x\sin y \approx y+xy near the origin — matching the product of the known one-variable series (1+x)(y)=y+xy(1+x)(y)=y+xy kept to total degree 22, a fast sanity check worth running whenever the base point is the origin.

Common traps

  • Dropping the factor of 22 on the mixed term. The correct second-order term is 12(h2fxx+2hkfxy+k2fyy)\frac{1}{2}(h^2f_{xx}+2hkf_{xy}+k^2f_{yy}); forgetting the 22 multiplying hkfxyhkf_{xy} is the single most common slip.
  • Evaluating derivatives at the wrong point. Every partial derivative in the formula is evaluated at the fixed base point (a,b)(a,b), never at the target point (x,y)(x,y) — mixing these up produces nonsense answers.
  • Getting the sign of hh or kk wrong. If the target point lies "before" the base point in a coordinate, that increment is negative; a sign slip here silently corrupts every later term.
  • Truncating inconsistently. Once you commit to "second order," every first- and second-order term must appear; dropping one because it looks small changes the accuracy in an uncontrolled way.

Ask the tutor: if assembling the second-order Taylor terms feels error-prone, or you want to see how this connects to the upcoming maxima/minima discriminant test, ask the AI tutor to walk through it step by step.

Why does the mixed second-order term get a factor of 2 but the pure terms h squared f xx and k squared f yy do not?

Because there is only one way to differentiate purely with respect to xx twice, or purely with respect to yy twice, but there are two equivalent routes to the mixed partial — differentiate with respect to xx then yy, or yy then xx — and since fxy=fyxf_{xy}=f_{yx} for well-behaved functions, those two equal contributions add up to give the coefficient 22. It is exactly the same reason the middle term of (h+k)2=h2+2hk+k2(h+k)^2=h^2+2hk+k^2 carries a factor of 22: the expansion is a binomial power in disguise, applied to derivatives instead of numbers.

Do I need to memorize the full infinite series, or is the second-order truncation enough for this course?

For MA10001 the second-order truncation is what you are expected to use and compute confidently; the full infinite operator series is there mainly so you understand where the pattern comes from and can extend it if a problem explicitly asks for a third-order term. In practice, almost every application here — local approximation, and the discriminant test for maxima and minima that follows this topic — only needs terms up to the quadratic ones, so memorize the second-order formula cold and treat the general series as background understanding.

How is this connected to the maxima and minima test coming up next?

The exact same second partial derivatives fxx,fxy,fyyf_{xx}, f_{xy}, f_{yy} evaluated at a critical point are what feed the discriminant D=fxxfyy−fxy2D=f_{xx}f_{yy}-f_{xy}^2 used to classify that point as a local maximum, local minimum, or saddle. The Taylor expansion is the reason that test works: near a critical point the first-order terms vanish, so the local behaviour of ff is governed entirely by the sign pattern of the quadratic (second-order) part of its Taylor expansion, which is precisely what the discriminant reads off.

Before this

Where this leads