Calculate the Derivative of Gradient Field of an Image
Consider the expansion of the term below
$$\|\nabla x -p\|_2^2 = (\nabla x -p)^T(\nabla x -p)$$
$$\|\nabla x -p\|_2^2 = (x^T\nabla^T -p^T)(\nabla x -p)$$
 $$\|\nabla x -p\|_2^2 = (x^T\nabla^T\nabla x - x^T\nabla^T p  - p^T\nabla x +p^Tp)$$

Now consider the following basic definition: 

$$\frac{\partial(A x)}{\partial x} = A^T$$
$$\frac{\partial(x^TA)}{\partial x} = A$$

Now applying the above two definitions together with the expansion of the objective above to differentiate the objective we have

$$\frac{\partial\|\nabla x -p\|_2^2}{\partial x} = 2\nabla^T\nabla x - 2\nabla^Tp$$

$$\frac{\partial\|\nabla x -p\|_2^2}{\partial x} = 2\nabla^T(\nabla x - p)$$

since $\nabla^T = \nabla$, therefore we have 

$$\frac{\partial\|\nabla x -p\|_2^2}{\partial x} = 2\nabla(\nabla x - p)$$ the constant 2 is just a constant, so the result we have is consistent with the ones that authors are using, its simply a consequence of vector differentiation