Landau's derivation of polarization In "Electrodynamics of Continuous Media" Landau writes the following:

The total charge in the volume of the dielectric is zero; even if it is placed in an electric field we have $\int\bar{\rho}dV=0$. This integral equation, which must be valid for a body of any shape, means that the average density can be written as the divergence of a certain vector, which is usually denoted by $-\mathbf{P}$: $$\bar{\rho}=-\nabla \cdot \mathbf{P}$$
while outside the body $\mathbf{P}=0$. For, on integrating over the volume bounded by a surface which encloses the body but nowhere enters it, we find $$\int\bar{\rho}dV=-\int\nabla \cdot \mathbf{P}dV=-\oint \mathbf{P} \cdot d\mathbf{f}=0$$

However I don't quite understand how the vanishing of $\int\bar{\rho}dV=0$ for every volume guarantees that $\bar{\rho}$ can be written as the divergence of some vector field. In fact, it seems like a convenient ad hoc assumption used to employ the divergence theorem. I wasn't able to find any mathematical theorem that states that "if $\int_V f dV=0$ for every $V$ then $f=\nabla \cdot \mathbf{F}$ where $\mathbf{F}$ is some vector field".
He later uses a similar argument to derive the magnetization vector. He states that because the surface integral $\int \mathbf{j} \cdot d\mathbf{f} = 0$ for all cross-sectional areas in a dielectric it means that $\mathbf{j}$ can be written as a rotor of some vector field $\mathbf{M}$.
So is this a physical argument or a mathematical trick? And if it's the latter, how can it be justified?
 A: You are correct, this is one of the weaker parts of L&L where they know the result and pretend it is obvious, or that it is the only possibility, and provide some verbal introduction without really showing the genesis of the concept.
Mathematically, any scalar function $\bar{\rho}$ of position can always be expressed as divergence of some vector field, so the L&L narrative that integral of $\bar{\rho}$ being zero is somehow important property for this field $\mathbf P$ to exist is incorrect. We know this because

*

*we already know from Maxwell's equations that for arbitrary charge density $\rho$ there is a field $\mathbf E$ that obeys

$$
\rho = \epsilon_0 \nabla \cdot \mathbf E;
$$


*for any function $\bar{\rho}$, we can define the Coulomb field
$$
\mathbf E_C(\mathbf x) = \int K\bar{\rho}(\mathbf x') \frac{\mathbf x- \mathbf x'}{|\mathbf x- \mathbf x'|^3}d^3\mathbf x'
$$
which obeys
$$
\bar{\rho} = \epsilon_0 \nabla \cdot \mathbf E_C.
$$
So if we wanted just the relation $\bar{\rho} = - \nabla\cdot \mathbf P$, and did not care for physical meaning of polarization (such as it has to be zero outside the body), we could define
$$
\mathbf P = -\epsilon_0 \mathbf E_C.
$$
This is just mathematics, not physics.

A much more instructive way to introduce polarization and magnetization in EM theory is the standard way: they are average electric and magnetic moment per unit volume.
Using this definition and some pictures and vector analysis, one can show that for neutral dielectric body and volume/surface entirely inside this body $V'/S'$, we have
$$
\oint_{S'} \mathbf P \cdot d\mathbf S' = - \int_{V'}\bar{\rho} ~dV'
$$
and we can derive the relation between charge and divergence of $\mathbf P$: using the Gauss-Ostrogradskii theorem, we can transform the above equation into
$$
\int_{V'} \nabla \cdot \mathbf P dV' = -\int_{V'}\bar{\rho} ~dV'
$$
and since this is valid for arbitrarily small volume element of the body, due to definition of divergence, we have also
$$\nabla \cdot \mathbf P = -\bar{\rho}.
$$
