# Taylor approximation of function in two variables

Let $f(x,y)$ be a real-valued function in two variables.

Let $x_n \to x_0$ and $y_n \to y_0$ as $n \to \infty$.

We assume $f(x,y)$ is differentiable in $x$ at $(x_0, y_0)$ with derivative $f'_x(x_0,y_0)$. Further suppose $f'_x(x,y)$ is continuous at $(x_0,y_0)$.

Question: Consider the following Taylor expansion about $(x_0,y_n)$: $$f(x_n,y_n) = f(x_0,y_n) + f'_x(x_0,y_n)(x_n - x_0) + R_n(x_n,y_n)$$

Is it neccesary true that $R_n(x_n,y_n) = o(|x_n - x_0|)$?

Clearly if all instances of $y_n$ are replaced by $y_0$, the Taylor expansion is correct based on the definition of differentiability. And if $f(x,y)$ is differentiable in both $x$ and $y$ at $(x_0,y_0)$, we have

$$f(x_n,y_n) = f(x_0,y_0) + f'_x(x_0,y_0)(x_n - x_0) + f'_y(x_0,y_0)(y_n - y_0) + R_n^*(x_n,y_n)$$

with $R^*_n(x_n,y_n) = o(|x_n - x_0| + |y_n - y_0|)$.

However, if we don't have differentiability in the two variables, I wonder if the Taylor expansion in the question is correct.

Counterexample: Define $f$ to be $0$ on the set $\{y>|x|\}\cup \{(x,y):y\le 0\},$ and $f=1$ everywhere else. Let $(x_0,y_0)=(0,0).$ Then $f_x(0,y)=0$ for all $y.$ But $f(1/n,1/(2n)) = 1$ for all $n,$ which forces $R_n(1/n,1/(2n)) = 1$ for all $n.$

Yes. continuity of $f_x'(x,y)$ at $(x_0,y_0)$ is enough.

Proof:

Because $f_x'(x,y)$ is continuous at $(x_0,y_0)$, there exists a closed ball $\mathcal{B}$ centered at $(x_0,y_0)$ such as $f'_x(x,y)$ exists. For $n$ high enough, both $x_n$ and $y_n$ are in the ball, and we can thus write

$$f(x_n,y_n) = f(x_0,y_n) + f'_x(x_0,y_n)(x_n - x_0) + R_n(x_n,y_n)$$

with

$$\frac{R_n(x_n,y_n)}{x_n - x_0} = \frac{f(x_n,y_n) - f(x_0,y_n)}{x_n - x_0} - f'_x(x_0,y_n)$$

We need to find a sufficient condition for

$$\frac{R_n(x_n,y_n)}{x_n - x_0} = o(1)$$

For $n$ high enough so that $x_n$ and $y_n$ are in the ball $\mathcal{B}$, we have, from the Mean Value Theorem,

$$\frac{ f(x_n,y_n) - f(x_0,y_n)}{x_n - x_0} = f'_x(\tilde{x}_n,y_n)$$

where $\tilde{x}_n$ is between $x_n$ and $x_0$.

Hence, together with the triangle inequality,

\begin{align} \left|\frac{R_n(x_n,y_n)}{x_n - x_0}\right| &= \left| f'_x(\tilde{x}_n,y_n) - f'_x(x_0,y_n) \right| \\ &\le \left| f'_x(\tilde{x}_n,y_n) - f'_x(x_0,y_0) \right| + \left| f'_x(x_0,y_n) - f'_x(x_0,y_0) \right|\\ &= o(1) \end{align}

with the last true because of the continuity of the derivative at $(x_0,y_0)$.

This proves the result.

Note 1: Essentially the same proof can be used when $x$ and $y$ are vectors. However, if $x$ is a vector, we need that $f$ be differentiable in $x$ in a neighborhood of $(x_0,y_0)$ to justify the use of the mean value theorem.

Note 2: Instead of the continuity of $f_x'(x,y)$ at $(x_0,y_0)$, we can assume that at $x_0$ and $y$ on a closed ball $\mathcal{B}$ centered at $y_0$ , we have $f_x'(x,y)$ continuous in $x$ uniformly in $y$, so that, for any $x_n \to 0$,

$$\sup_{y \in \mathcal{B}}\left| f'_x({x}_n,y) - f'_x(x_0,y) \right| = o(1)$$

In which case, for $n$ large enough so that $y_n$ is in the ball,

$$\left| f'_x(\tilde{x}_n,y_n) - f'_x(x_0,y_n) \right| \le \sup_{y \in \mathcal{B}}\left| f'_x(\tilde{x}_n,y) - f'_x(x_0,y) \right| = o(1)$$