If there is such a scalar function f, then



Integrate both sides of the first equation with respect to x :

Differentiate both sides with respect to y :


Integrate both sides with respect to y :

Plug this into the equation above with f , then differentiate both sides with respect to z :



Integrate both sides with respect to z :

So we end up with
