So where does gradient come into electromagnetism?

The infinitesimal change in electric potential \( dV \) is defined as the work done per unit positive charge moving an infinitesimal displacement \( d\vec{l} \) within an electric field \( \vec{E} \). It is given by the familiar force times displacement relationship, and the minus sign is simply a convention to make the work done positive when moving in a direction anti-parallel to the electric field $$ dV = - \vec{E} \circ d\vec{l} \nonumber $$ $$ dV = -(E_x \hat{i} + E_y \hat{j} + E_z \hat{k}) \circ (dx \hat{i} + dy \hat {j} + dz \hat {k} ) \nonumber $$ $$ dV = -E_x dx -E_y dy -E_z dz $$ \( dV \) can also be written as $$ dV = \frac{\partial V}{\partial x} dx + \frac{\partial V}{\partial y} dy + \frac{\partial V}{\partial z} dz $$ So comparing equations (1) and (2) for \( dV \) we find, $$ E_x = -\frac{\partial V}{\partial x}, E_y = -\frac{\partial V}{\partial y}, E_z = -\frac{\partial V}{\partial z} \nonumber $$ So now we can write \( \vec{E} \) in terms of \( V \) as, $$ \vec{E} = - \Bigg(\frac{\partial V}{\partial x} \hat{i} + \frac{\partial V}{\partial y} \hat{j} + \frac{\partial V}{\partial y} \hat{k} \Bigg) $$ $$ \vec{E} = -\vec{\nabla}V $$ The electric potential, a scalar field, determines the direction and magnitude of the electric field, a vector field!