Do you remember your exercise in the tutorial section, where you have shown that the divergence of the curl of any 3d-vector function f is zero?
Similar to electrostatics, this time we make use of this relation. This time, we have a Maxwell equation: nabla . B = 0
This means, it is always possible to write B = nabla x A. Here, A is the vector potential, as we will discuss in the following.