Truncation error in finite difference approximation of mixed derivative

finite difference methodsnumerical methodspartial derivative

In a textbook (https://onlinelibrary.wiley.com/doi/pdf/10.1002/9781119083405.app1) I came across a way of deriving a finite-difference discretization of the mixed derivative $\frac{\partial^2 f}{\partial x \partial y}$ by repeatedly applying central discretizations of the first derivatives:

$$ \Big( \frac{\partial^2 f}{\partial x \partial y}\Big)_{i,j} = \frac{1}{2\Delta x}\Big[ \Big(\frac{\partial f}{\partial y}\Big)_{i+1,j} – \Big(\frac{\partial f}{\partial y}\Big)_{i-1,j} \Big] + O(\Delta x^2)$$

where the derivatives to y are approximated as:
$$ \Big(\frac{\partial f}{\partial y}\Big)_{i+1,j} = \frac{1}{2\Delta y}(f_{i+1,j+1} – f_{i+1,j-1}) + O(\Delta y^2)\\
\Big(\frac{\partial f}{\partial y}\Big)_{i-1,j} = \frac{1}{2\Delta y}(f_{i-1,j+1} – f_{i-1,j-1}) + O(\Delta y^2)\\ $$

when you fill those into the first equation it seems to me like you'd get:

$$ \Big( \frac{\partial^2 f}{\partial x \partial y}\Big)_{i,j} = \frac{1}{4\Delta x \Delta y}( f_{i+1,j+1} – f_{i+1,j-1} – f_{i-1,j+1} + f_{i-1,j-1}) + O(\frac{\Delta y^2}{\Delta x}) + O(\Delta x^2)$$

so that for similar $O(\Delta x) = O(\Delta y)$ the truncation error will be first order in $\Delta y$. However the book claims that this discretization is second-order accurate in both $\Delta x$ and $\Delta y$. Why is this?

Best Answer

The reasoning in OP isn't wrong, and the big O notation $O(\Delta x^2, \Delta y^2)$ should be understood componentwise. To demonstrate this convergence feature, we usually write the 2D Taylor series (in two variables) as follows: $$ f(x+\delta x,y+\delta y) = f(x,y) + \delta x f_x(x,y) +\delta y f_y(x,y) + \tfrac12\left(\delta x^2 f_{xx}(x,y) + 2\delta x\delta y f_{xy}(x,y) + \delta y^2 f_{yy}(x,y)\right) + O(\delta x^3, \delta y^3) \, . $$ Injecting those Taylor approximations of $f_{i\pm 1,j\pm 1} = f(x_i\pm\Delta x,y_j\pm\Delta y)$ in the finite difference yields the expected local truncation error -- see this related post. In facts, note that \begin{aligned} f_{i+1,j+1}-f_{i+1,j-1} &= 2\Delta y\, (f_y + \Delta x f_{xy})_{i,j} + O(\Delta x^3, \Delta y^3) \\ f_{i-1,j+1}-f_{i-1,j-1} &= 2\Delta y\, (f_y - \Delta x f_{xy})_{i,j} + O(\Delta x^3, \Delta y^3) \end{aligned} which difference equals $4\Delta x\Delta y\, (f_{xy})_{i,j} + O(\Delta x^3,\Delta y^3)$. QED

Related Question