# The indexing of partial derivatives in solving PDE by finite differences

In pages 303 and 304 of Lesson 37 from Stanley Farlow's book titled Partial Differential Equations for Scientists and Engineers (1993), the author writes:

It is also convenient (especially if we want to use a computer) to use the following notation:

$$u(x,y) = u_{i,j}$$

$$u(x, y+k) = u_{i+1,j}$$

$$u(x, y-k) = u_{i-1,j}$$

$$u(x+h, y) = u_{i,j+1}$$

In the right side of the four equations above, $$x$$ and $$y$$ are variables, $$k$$ and $$h$$ are constants.

I don't understand why he writes $$_{i+1,j}$$ for $$(x, y+k)$$, or $$_{i, j+1}$$ for $$(x+h,y)$$. It looks as if the author adds 1 to the subscripts that represents variables to which no constant is added. On the other hand, when a constant is added to a variable, the author does not add 1 to its subscript.

I am not sure if this has anything to do with explicit or implicit methods, but this makes no sense for me. Farlow, unfortunately, doesn't go into detail as to why this would be a convenient notation.

I would like to know why this notation would be convenient and if it has any direct implication with the method of approximation; either explicit or implicit.

Thank you.

• So, is it the particular ordering of the indices that bothers you, i.e. that $i$ corresponds to the $y$-variable and $j$ to the $x$-variable? Aug 20, 2017 at 17:45
• Yes, @ekkilop. Why the index of (x, y+k) is (i+1, j) instead of (i, j+1)? Aug 20, 2017 at 18:10

It's because of a discrepancy between the way that we index matrices vs. the way that we label axes in the plane. In the plane the first coordinate is horizontal, the second is vertical, the first coordinate increases as you move to the right, the second coordinate increases as you move up. For matrices, the first coordinate is vertical, the second is horizontal, the first coordinate increases as you move down, and the second coordinate increases as you move to the right. Thus if you want your visualization of the matrix $U_{ij}$ to match your visualization of the function $u(x,y)$, then you would have $u(x+h,y)$ matching $U_{i,j+1}$ and $u(x,y+k)$ matching $U_{i-1,j}$.