# Requirements for integration by parts/ Divergence theorem

In order to use the integration by parts formula(or more generally the divergence theorem) for functions of several variables $$\int_{\Omega} \nabla u\cdot v d \Omega = \int_{\partial \Omega}(u(v \cdot \nu))d \Omega - \int_{\Omega}u\nabla \cdot v d\Omega$$

is it required that $\Omega$ is compact or at least just bounded subset of $\mathbb{R}^{n}$? Is it required that $\partial \Omega$ is at least Lipschitz continuous? If not, are there any restrictions on $\Omega$ and $\partial \Omega$?

This question was inspired by the wiki entry 'integration by parts' and 'divergence theorem'. Thanks for any assistance.

Usually, $\Omega$ is an open subset of $\mathbb R^n$. It does not have to be bounded, but maybe we want it to be. To define the normal vector, we may want the boundary to be $C^1$ smooth. Or at least Lipschitz smooth. But not necessarily, another condition may be imposed. In general, $\Omega$ need not be open. And the gradients -- maybe they have to be defined in $\Omega$ and be continuous. Or not. Depends on whether Sobolev spaces were developed.
Theorem. Let $E\subset \mathbb R^n$ have locally finite perimeter. Then for $\mathcal H^{n-1}$-a.e. $x\in\partial_*E$ (the measure-theoretic boundary of $E$) there is a unique measure theoretic unit outer normal $\nu(x)$ such that $$\int_E \operatorname{div} \varphi \,dx = \int_{\partial_* E} \varphi\cdot \nu \,d\mathcal H^{n-1}$$ for all $\varphi\in C^1_c(\mathbb R^n;\mathbb R^n)$.