Derivative of Lattice Laplacian The lattice Laplacian is defined as,
$$
\nabla_L^2x_j \equiv \frac{x_{j+1} - 2x_j + x_{j-1}}{a^2}
$$
where the lattice spacing, $a$, is a constant.
The derivative, with respect to $x_i$, then gives,
$$
\frac{\partial}{\partial x_i} \nabla_L^2x_j = \frac{\delta_{i(j+1)} - 2\delta_{ij} + \delta_{i(j-1)}}{a^2}
=
\begin{cases}
a^{-2}\ &\text{for}\ i=j+1\\
-2a^{-2}\ &\text{for}\ i=j\\
a^{-2}\ &\text{for}\ i=j-1
\end{cases}
$$
I am not sure intuitively why this is the case. I expected the derivative of the laplacian to be a function rather than a piecewise constant?
 A: The discrete Laplacian is a vector valued function of several variables: its argument is $(x_1,\dots,x_n)$, and the output is another vector. 
The function is a linear one (Laplacian is a linear operator), so, its partial derivative with respect to any $x_i$ is a constant vector, specifically the vector in which three entries are  $1/a^2$ or $-2/a^2$, and the rest are zeros. This is no more surprising than the derivative of $g(x)=2x$ being constant.
Informally, this means that changing the value at the $i$th lattice point affects the Laplacian only at that point and its neighbors, and describes how it affects them.
A: $\def\m#1{\left[\begin{array}{r}#1\end{array}\right]}\def\p#1#2{\frac{\partial #1}{\partial #2}}$You
can approach this problem in a purely matrix form using the Up Shift Matrix.
For example, for $\,n=3$
$$U = \m{0&1&0\\0&0&1\\0&0&0}$$
Then the lattice vector could be written as
$$\eqalign{
y &= \left(\frac{U-2I+U^T}{a^2}\right)x \;\doteq\; Lx \\
}$$
This is a linear equation and the gradient with respect to $x$ is simply
$$\eqalign{
\p{y}{x} &= L \\\\
}$$
NB: If your lattice is circulant, then you may want to use a cyclic permutation instead of a shift, i.e.
$$U = \m{0&1&0\\0&0&1\\1&0&0}$$
