Closed and exact differential forms
In mathematics, especially vector calculus and differential topology, a closed form is a differential form α whose exterior derivative is zero (dα = 0), and an exact form is a differential form that is the exterior derivative of another differential form β. Thus, an exact form is in the image of d, and a closed form is in the kernel of d.
For an exact form α, α = dβ for some differential form β of one-lesser degree than α. The form β is called a "potential form" or "primitive" for α. Since d2 = 0, β is not unique, but can be modified by the addition of the differential of a two-step-lower-order form.
Because d2 = 0, any exact form is automatically closed. The question of whether every closed form is exact depends on the topology of the domain of interest. On a contractible domain, every closed form is exact by the Poincaré lemma. More general questions of this kind on an arbitrary differentiable manifold are the subject of de Rham cohomology, that allows one to obtain purely topological information using differential methods.
The simplest example of a form which is closed but not exact is the 1-form "dθ" (quotes because it is not the derivative of a globally defined function), defined on the punctured plane which is locally given as the derivative of the argument - note that argument is locally but not globally defined, since a loop around the origin increases (or decreases, depending on direction) the argument by 2π, which corresponds to the integral:
and for general paths is known as the winding number. The differential of the argument is however globally defined (except at the origin), since differentiation only requires local data and different values of the argument differ by a constant, so the derivatives of different local definitions are equal; this line of thought is generalized in the notion of covering spaces.
Explicitly, the form is given as:
which is not defined at the origin. This can be computed from a formula for the argument, most simply via arctan(y/x) (y/x is the slope of the line passing through (x,y), and arctan converts slope to angle), recognizing 1/(x2+y2) as corresponding to the derivative of arctan, which is 1/(x2+1) (these agree on the line y=1). While the differential is correctly computed by symbolically differentiating this expression, this formula is only strictly correct on the halfplane x>0, and properly one must use a correct formula for the argument.
This form generates the de Rham cohomology group meaning that any closed form is the sum of an exact form and a multiple of where accounts for a non-trivial contour integral around the origin, which is the only obstruction to a closed form on the punctured plane (locally the derivative of a potential function) being the derivative of a globally defined function.
Examples in low dimensions 
Differential forms in R2 and R3 were well known in the mathematical physics of the nineteenth century. In the plane, 0-forms are just functions, and 2-forms are functions times the basic area element dx∧dy, so that it is the 1-forms
that are of real interest. The formula for the exterior derivative d here is
where the subscripts denote partial derivatives. Therefore the condition for α to be closed is
In this case if h(x,y) is a function then
The implication from 'exact' to 'closed' is then a consequence of the symmetry of second derivatives, with respect to x and y.
Vector field analogies 
On a Riemannian manifold, or more generally a pseudo-Riemannian manifold, k-forms correspond to k-vector fields (by duality via the metric), so there is a notion of a vector field corresponding to a closed or exact form.
In 3 dimensions, an exact vector field (thought of as a 1-form) is called a conservative vector field, meaning that it is the derivative (gradient) of a 0-form (function), called the scalar potential. A closed vector field (thought of as a 1-form) is one whose derivative (curl) vanishes, and is called an irrotational vector field.
Conservative and incompressible vector fields generalize to n-dimensions (gradient and divergence generalize to n dimensions); curl and hence irrotational does not generalize in this way.
Poincaré lemma 
The Poincaré lemma states that if X is a contractible open subset of Rn, any smooth closed p-form α defined on X is exact, for any integer p > 0 (this has content only when p ≤ n).
Contractibility means that there is a homotopy Ft : X×[0,1] → X that continuously deforms X to a point. Thus every cycle c in X is the boundary of some "cone"; one may take the cone to be the image of c under the homotopy. A dual version of this gives the Poincaré lemma.
More specifically, we associate to X the cylinder X×[0,1]. Identify the top and bottom of the cylinder with the maps j1(x) = (x, 1) and j0(x) = (x, 0) respectively. On the differential forms, the induced maps j1* and j0* are related by a cochain homotopy K:
Let Ωp(X) denote the p-forms on X. The map K: Ωp + 1( X×[0,1] ) → Ωp(X) is the dual of the cylinder map and defined by
where dxp is a monomial p-form with no dt in it. So if F is a homotopy deforming X to a point Q, then
Inserting these two equations into the cochain homotopy equation proves the Poincaré lemma.
Formulation as cohomology 
When the difference of two closed forms is an exact form, they are said to be cohomologous to each other. That is, if ζ and η are closed forms, and one can find some β such that
then one says that ζ and η are cohomologous to each other. Exact forms are sometimes said to be cohomologous to zero. The set of all forms cohomologous to a given form (and thus to each other) is called a de Rham cohomology class; the general study of such classes is known as cohomology. It makes no real sense to ask whether a 0-form (smooth function) is exact, since d increases degree by 1; but the clues from topology suggest that only the zero function should be called "exact". The cohomology classes are identified with locally constant functions.
A corollary of the Poincaré lemma is that de Rham cohomology is homotopy-invariant. Non-contractible spaces need not have trivial de Rham cohomology. For instance, on the circle S1, parametrized by t in [0, 1], the closed 1-form dt is not exact.
Application in electrodynamics 
In electrodynamics, the case of the magnetic field produced by a stationary electrical current is important. There one deals with the vector potential of this field. This case corresponds to k=2, and the defining region is the full The current-density vector is It corresponds to the current two-form
For the magnetic field one has analogous results: it corresponds to the induction two-form and can be derived from the vector potential , or the corresponding one-form ,
Thereby the vector potential corresponds to the potential one-form
The closedness of the magnetic-induction two-form corresponds to the property of the magnetic field that it is source-free: i.e. there are no magnetic monopoles.
In a special gauge, , this implies for i = 1, 2, 3
(Here is a constant, the magnetic vacuum permeability.)
This equation is remarkable, because it corresponds completely to a well-known formula for the electrical field , namely for the electrostatic Coulomb potential of a charge density . At this place one can already guess that
If the condition of stationarity is left, on the l.h.s. of the above-mentioned equation one must add, in the equations for to the three space coordinates, as a fourth variable also the time t, whereas on the r.h.s., in the so-called "retarded time", must be used, i.e. it is added to the argument of the current-density. Finally, as before, one integrates over the three primed space coordinates. (As usual c is the vacuum velocity of light.)