# Taylor Polynomials of Functions of Two Variables

- Last updated

- Save as PDF

- Page ID
- 21129

- Contributed by Paul Seeburger
- Professor (Mathematics) at Monroe Community College

Earlier this semester, we saw how to approximate a function \(f (x, y)\) by a linear function, that is, by its tangent plane. The tangent plane equation just happens to be the \(1^{\text{st}}\)-degree Taylor Polynomial of \(f\) at \((x, y)\), as the tangent line equation was the \(1^{\text{st}}\)-degree Taylor Polynomial of a function \(f(x)\).

Now we will see how to improve this approximation of \(f (x, y)\) using a quadratic function: the \(2^{\text{nd}}\)-degree Taylor polynomial for \(f\) at \((x, y)\).

## Review of Taylor Polynomials for a Function of One Variable

Do you remember Taylor Polynomials from Calculus II?

Definition: Taylor polynomials for a function of one variable, \(y = f(x)\)

If \(f\) has \(n\) derivatives at \(x = c\), then the polynomial,

\[P_n(x) = f(c) + f'(c)(x - c) + \frac{f''(c)}{2!}(x - c)^2 + \cdots + \frac{f^{(n)}(c)}{n!}(x-c)^n\]

is called the **\(n^{\text{th}}\)-degree Taylor Polynomial **for \(f\) at \(c\).

Now a function of one variable \(f(x)\) can be approximated for \(x\) near \(c\) using its \(1^{\text{st}}\)-degree Taylor Polynomial (i.e., using the equation of its **tangent line** at the point \((c, f(c)\)). This \(1^{\text{st}}\)-degree Taylor Polynomial is also called the **linear approximation** of \(f(x)\) for \(x\) near \(c\).

That is:

\[f(x) \approx f(c) + f '(c) (x - c)\]

Note

Remember that the first-derivative of this \(1^{\text{st}}\)-degree Taylor polynomial at \(x = c\) is equal to the first derivative of \(f\) at \(x = c\). That is:

Since \(P_1(x) = f(c) + f '(c) (x - c)\),

\[P_1'(c) = f'(c) \nonumber\]

A better approximation of \(f(x)\) for \(x\) near \(c\) is the **quadratic approximation **(i.e., the \(2^{\text{nd}}\)-degree Taylor polynomial of \(f\) at \(x = c\)):

\[f(x) \approx f(c) + f '(c) (x - c) + \frac{ f ''(c)}{2}(x - c)^2\]

Note

Remember that both the first and second derivatives of the \(2^{\text{nd}}\)-degree Taylor polynomial of \(f\) at \(x = c\) are the same as those for \(f\) at \(x = c\). That is:

Since \(P_2(x) = f(c) + f '(c) (x - c) + \frac{ f ''(c)}{2}(x - c)^2\),

\[P_2'(c) = f'(c) \quad \text{and} \quad P_2''(c) = f''(c) \nonumber\]

## 1st and 2nd-Degree Taylor Polynomials for Functions of Two Variables

Taylor Polynomials work the same way for functions of two variables. (There are just more of each derivative!)

Definition: first-degree Taylor polynomial of a function of two variables, \(f(x, y)\)

For a function of two variables \(f(x, y)\) whose first partials exist at the point \((a, b)\), the **\(1^{\text{st}}\)-degree Taylor polynomial** of \(f\) for \((x, y)\) near the point \((a, b)\) is:

\[f (x, y) \approx L(x, y) = f (a, b) + f_x(a, b) (x - a) + f_y(a, b) (y - b)\]

\(L(x,y)\) is also called the **linear **(or** tangent plane**)** approximation** of \(f\) for \((x, y)\) near the point \((a, b)\).

Note that this is really just the equation of the function \(f\)'s tangent plane.

**Also note that the first partial derivatives of this polynomial function are \(f_x\) and \(f_y\)!**

We can obtain an even better approximation of \(f\) for \((x, y)\) near the point \((a, b)\) by using the **quadratic approximation **of \(f\) for \((x, y)\) near the point \((a, b)\). This is just another name for the \(2^{\text{nd}}\)-degree Taylor polynomial of \(f\).

Definition: Second-degree Taylor Polynomial of a function of two variables, \(f(x, y)\)

For a function of two variables \(f(x, y)\) whose first and second partials exist at the point \((a, b)\), the **\(2^{\text{nd}}\)-degree Taylor polynomial** of \(f\) for \((x, y)\) near the point \((a, b)\) is:

\[f (x, y) \approx Q(x, y) = f (a, b) + f_x(a, b) (x - a) + f_y(a, b) (y - b) + \frac{f_{xx}(a, b)}{2}(x-a)^2 + f_{xy}(a,b)(x-a)(y-b) + \frac{f_{yy}(a, b)}{2}(y-b)^2 \label{tp2}\]

If we have already determined \(L(x,y)\), we can simplify this formula as:

\[f (x, y) \approx Q(x, y) = L(x,y) + \frac{f_{xx}(a, b)}{2}(x-a)^2 + f_{xy}(a,b)(x-a)(y-b) + \frac{f_{yy}(a, b)}{2}(y-b)^2 \]

Note: Since both mixed partials are equal, they combine to form the middle term. Originally there were four terms for the second partials, all divided by 2.

Observe that the power on the factor \((x - a)\) corresponds to the number of times the partial is taken with respect to \(x\) and the power on the factor \(y - b\) corresponds to the number of times the partial is take with respect to \(y\). For example, in the term with \(f_{xx}(a,b)\), you have the factor \((x-a)^2\), since the partial is taken with respect to \(x\) twice, and in the term with \(f_{xy}(a,b)\), you have the factors \((x-a)\) and \((y-b)\) (both raised to the first power), since the partial is taken with respect to \(x\) once and with respect to \(y\) once.

**Also note that both the first and second partial derivatives of this polynomial function are the same as those for the function \(f\)!**

Example \(\PageIndex{1}\): Finding 1st and 2nd degree Taylor Polynomials

Determine the \(1^{\text{st}}\)- and \(2^{\text{nd}}\)-degree Taylor polynomial approximations, \(L(x, y)\) & \(Q(x, y)\), for the following functions of \(x\) and \(y\) near the given point.

a. \(f(x, y) = \sin 2x + \cos y\) for \((x, y)\) near the point \((0, 0)\)

b. \(f(x, y) = xe^y + 1\) for \((x, y)\) near the point \((1, 0)\)

**Solution**

a. To determine the first-degree Taylor polynomial linear approximation, \(L(x, y)\), we first compute the partial derivatives of \(f\).

\[ f_x(x, y) = 2\cos 2x \quad \text{and} \quad f_y(x,y) = -\sin y \nonumber\]

Then evaluating these partials and the function itself at the point \((0,0)\) we have:

\[ \begin{align*} f(0,0) &= \sin 2(0) + \cos 0 = 1 \\ f_x(0,0) &= 2\cos 2(0) = 2 \\ f_y(0,0) &= -\sin 0 = 0 \end{align*} \nonumber\]

Now,

\[\begin{align*} L(x, y) &= f(0,0) + f_x(0,0) (x - 0) + f_y(0,0) (y - 0) \\

&= 1 + 2x \end{align*}\]

See the plot of this function and its linear approximation (the \(1^{\text{st}}\)-degree Taylor polynomial) in Figure \(\PageIndex{1}\).

* Figure \(\PageIndex{1}\): Graph of *\(f(x,y) = \sin 2x + \cos y \)

*and its \(1^{\text{st}}\)-degree Taylor polynomial, \(L(x,y) = 1 + 2x\)*

To determine the second-degree Taylor polynomial (quadratic) approximation, \(Q(x, y)\), we need the second partials of \(f\):

\[ \begin{align*} f_{xx}(x,y) &= -4\sin 2x \\ f_{xy}(x,y) &= 0 \\ f_{yy}(x,y) &= -\cos y \end{align*}\]

Evaluating these 2nd partials at the point \((0,0)\):

\[ \begin{align*} f_{xx}(0,0) &= -4\sin 2(0) = 0 \\ f_{xy}(0,0) &= 0 \\ f_{yy}(0,0) &= -\cos 0 = -1 \end{align*}\]

Then,

\[\begin{align*} Q(x, y) &= L(x,y) + \frac{f_{xx}(0,0)}{2}(x-0)^2 + f_{xy}(0,0)(x-0)(y-0) + \frac{f_{yy}(0,0)}{2}(y-0)^2\\

&= 1 + 2x + \frac{0}{2}x^2 + (0)xy + \frac{-1}{2}y^2 \\

&= 1 + 2x - \frac{y^2}{2} \end{align*}\]

See the plot of the function \(f\) along with its quadratic approximation (the \(2^{\text{nd}}\)-degree Taylor polynomial) in Figure \(\PageIndex{2}\).

* Figure \(\PageIndex{2}\): Graph of *\(f(x,y) = \sin 2x + \cos y \)

*and its \(2^{\text{nd}}\)-degree Taylor polynomial, \(Q(x,y) = 1 + 2x - \frac{y^2}{2}\)*

b. To determine the first-degree Taylor polynomial linear approximation, \(L(x, y)\), we first compute the partial derivatives of \(f(x, y) = xe^y + 1\) .

\[ f_x(x, y) = e^y \quad \text{and} \quad f_y(x,y) = xe^y \nonumber\]

Then evaluating these partials and the function itself at the point \((1,0)\) we have:

\[ \begin{align*} f(1,0) &= (1)e^0 + 1 = 2 \\ f_x(1,0) &= e^0 = 1 \\ f_y(1,0) &= (1)e^0 = 1 \end{align*} \nonumber\]

Now,

\[\begin{align*} L(x, y) &= f(1,0) + f_x(1,0) (x - 1) + f_y(1,0) (y - 0) \\

&= 2 + 1(x - 1) + 1y \\

&= 1 + x + y \end{align*}\]

See the plot of this function and its linear approximation (the \(1^{\text{st}}\)-degree Taylor polynomial) in Figure \(\PageIndex{3}\).

* Figure \(\PageIndex{3}\): Graph of *\(f(x, y) = xe^y + 1\)

*and its \(1^{\text{st}}\)-degree Taylor polynomial, \(L(x,y) = 1 + x + y\)*

To determine the second-degree Taylor polynomial (quadratic) approximation, \(Q(x, y)\), we need the second partials of \(f\):

\[ \begin{align*} f_{xx}(x,y) &= 0 \\ f_{xy}(x,y) &= e^y \\ f_{yy}(x,y) &= xe^y \end{align*}\]

Evaluating these 2nd partials at the point \((1,0)\):

\[ \begin{align*} f_{xx}(1,0) &= 0 \\ f_{xy}(1,0) &= e^0 = 1 \\ f_{yy}(1,0) &= (1)e^0 = 1 \end{align*}\]

Then,

\[\begin{align*} Q(x, y) &= L(x,y) + \frac{f_{xx}(1,0)}{2}(x-1)^2 + f_{xy}(1,0)(x-1)(y-0) + \frac{f_{yy}(1,0)}{2}(y-0)^2\\

&= 1 + x + y + \frac{0}{2}(x-1)^2 + (1)(x-1)y + \frac{1}{2}y^2 \\

&= 1 + x + y + xy -y + \frac{y^2}{2} \\

&= 1 + x + xy + \frac{y^2}{2}\end{align*}\]

See the plot of the function \(f\) along with its quadratic approximation (the \(2^{\text{nd}}\)-degree Taylor polynomial) in Figure \(\PageIndex{4}\).

* Figure \(\PageIndex{4}\): Graph of *\(f(x, y) = xe^y + 1\)

*and its \(2^{\text{nd}}\)-degree Taylor polynomial, \(L(x,y) = 1 + x + xy + \frac{y^2}{2}\)*

## Higher-Degree Taylor Polynomials of a Function of Two Variables

To calculate the Taylor polynomial of degree \(n\) for functions of two variables beyond the second degree, we need to work out the pattern that allows all the partials of the polynomial to be equal to the partials of the function being approximated at the point \((a,b)\), up to the given degree. That is, for \(P_3(x,y)\) we will need its first, second and third partials to all match those of \(f(x,y)\) at the point \((a,b)\). For \(P_10(x,y)\) we would need all its partials up to the tenth partials to all match those of \(f(x,y)\) at the point \((a,b)\).

If you work out this pattern, it gives us the following interesting formula for the \(n^{\text{th}}\)-degree Taylor polynomial of \(f(x, y)\), assuming all these partials exist.

Definition: \(n^{\text{th}}\)-degree Taylor Polynomial for a function of two variables

For a function of two variables \(f(x, y)\) whose partials all exist to the \(n^{\text{th}}\) partials at the point \((a, b)\), the **\(n^{\text{th}}\)-degree Taylor polynomial** of \(f\) for \((x, y)\) near the point \((a, b)\) is:

\[P_n(x,y) = \sum_{i=0}^n \sum_{j=0}^{n - i} \frac{\frac{d^{(i+j)}f}{∂x^i∂y^{\,j}}(a,b) }{i!j!}(x-a)^i(y-b)^j \label{tpn}\]

Let's verify this formula for the second-degree Taylor polynomial. (We'll leave it to you to verify it for the first-degree Taylor polynomial.)

For \(n=2\), we have:

\[P_2(x,y) = \sum_{i=0}^2 \sum_{j=0}^{2 - i} \frac{\frac{d^{(i+j)}f}{∂x^i∂y^{\,j}}(a,b) }{i!j!}(x-a)^i(y-b)^j\]

Since \(i\) will start at \(0\) and continue to increase up to \(2\), while the value of \(j\) will start at \(0\) and increase to \(2-i\) for each value of \(i\), we would see the following values for \(i\) and \(j\):

\[\begin{align*} i = 0, && j = 0 \\ i = 0, && j = 1 \\ i = 0, && j = 2 \\ i = 1, && j = 0 \\ i = 1, && j = 1 \\ i = 2, && j = 0 \end{align*}\]

Then by the formula:

\[\begin{align*} P_2(x,y) &= \frac{f(a,b)}{0!0!}(x-a)^0(y-b)^0 + \frac{f_y(a,b)}{0!1!}(x-a)^0(y-b)^1 + \frac{f_{yy}(a,b)}{0!2!}(x-a)^0(y-b)^2 + \frac{f_x(a,b)}{1!0!}(x-a)^1(y-b)^0 + \frac{f_{xy}(a,b)}{1!1!}(x-a)^1(y-b)^1 + \frac{f_{xx}(a,b)}{2!0!}(x-a)^2(y-b)^0 \\

&= f(a,b) + f_y(a,b)(y-b) + \frac{f_{yy}(a,b)}{2}(y-b)^2 + f_x(a,b)(x-a) + f_{xy}(a,b)(x-a)(y-b) + \frac{f_{xx}(a,b)}{2}(x-a)^2 \\

&= f(a,b) + f_x(a,b)(x-a) + f_y(a,b)(y-b) + \frac{f_{xx}(a,b)}{2}(x-a)^2 + f_{xy}(a,b)(x-a)(y-b) + \frac{f_{yy}(a,b)}{2}(y-b)^2 \end{align*}\]

This equation is the same as Equation \ref{tp2} above.

Note that \(P_2(x,y)\) is the more formal notation for the second-degree Taylor polynomial \(Q(x,y)\).

Exercise \(\PageIndex{1}\): Finding a third-degree Taylor polynomial for a function of two variables

Now try to find the new terms you would need to find \(P_3(x,y)\) and use this new formula to calculate the third-degree Taylor polynomial for one of the functions in Example \(\PageIndex{1}\) above. Verify your result using a 3D function grapher like CalcPlot3D.

**Answer**-
As you just found, the only new combinations of \(i\) and \(j\) would be:

\[\begin{align*} i = 0, && j = 3 \\ i = 1, && j = 2 \\ i = 2, && j = 1 \\ i = 3, && j = 0 \end{align*}\]

Note that these pairs include all the possible combinations of \(i\) and \(j\) that can add to \(3\). That is, these pairs correspond to all the possible third-degree terms we could have for a function of two variables \(x\) and \(y\), remembering that \(i\) represents the degree of \(x\) and \(j\) represents the degree of \(y\) in each term. If the point \((a,b)\) were \((0,0)\), the variable factors of these terms would be \(y^3\), \(xy^2\), \(x^2y\), and \(x^3\), respectively.

Then by the Equation \ref{tpn}:

\[P_3(x,y) = P_2(x,y) + \frac{f_{yyy}(a,b)}{0!3!}(x-a)^0(y-b)^3+ \frac{f_{xyy}(a,b)}{1!2!}(x-a)^1(y-b)^2+ \frac{f_{xxy}(a,b)}{2!1!}(x-a)^2(y-b)^1+ \frac{f_{xxx}(a,b)}{3!0!}(x-a)^3(y-b)^0\]

Simplifying, \[P_3(x,y) = P_2(x,y) + \frac{f_{yyy}(a,b)}{6}(y-b)^3+ \frac{f_{xyy}(a,b)}{2}(x-a)(y-b)^2+ \frac{f_{xxy}(a,b)}{2}(x-a)^2(y-b)+ \frac{f_{xxx}(a,b)}{6}(x-a)^3\]

## Contributors

- Paul Seeburger (Monroe Community College)