For gradient fields it is necessary to account for the Maxwell terms. That is, fields that exist in addition to the desired gradient of due to the fact that . Once is found, then is proportional to .
For example, if an x-gradient in the z field is desired, , then (up to a constant). Consequently, , which already satisfies . However, for , then cannot be used as . Consequently, (or some other equivalent using and in the second term) must be used instead.