# Can one always interchange the order of a surface and volume integral?

Consider a continuous charge distribution in volume $$V'$$. Draw a closed surface $$S$$ inside the volume $$V'$$. Consider the following multiple integral:

$$A=\iiint_{V'} \left[ \iint_S \dfrac{\cos(\hat{R},\hat{n})}{R^2} dS \right] \rho'\ dV' =4 \pi\ m_s$$

where

$$R=|\mathbf{r}-\mathbf{r'}|$$

$$\mathbf{r'}=(x',y',z')$$ is coordinates of source points

$$\mathbf{r}=(x,y,z)$$ is coordinates of field points

$$\cos(\hat{R},\hat{n})$$ is the angle between $$R$$ and normal to surface element

$$\rho'$$ is the charge density and is continuous throughout the volume $$V'$$

$$m_s$$ is the total charge inside surface $$S$$

Also consider the following multiple integral:

$$B= \iint_S \left[ \iiint_{V'} \dfrac{\cos(\hat{R},\hat{n})}{R^2} \rho'\ dV' \right] dS$$

where the symbols have the meanings stated above.

\begin{align} B &= \iint_S \left[ \iiint_{V'} \rho' \dfrac{\hat{R} \cdot \hat{n}}{R^2} \ dV' \right] dS\\ &=\iint_S \left[ \iiint_{V'} \rho' \dfrac{\hat{R} }{R^2} \ dV' \right] \cdot \hat{n}\ dS\\ &=\iint_S \mathbf{E} \cdot \hat{n}\ dS \end{align}

Is $$A=B\ ?$$

i.e. Is interchanging the order of surface and volume integration valid? I know it is usually valid but my doubt is due to the following reasons:

1. In the surface integral of equation $$A$$, when $$\mathbf{r'} \in S$$, we can only use spherical coordinate system with origin at point $$\mathbf{r'}$$ (in order to avoid improper integral with limits). So while computing $$A$$, we cannot use only one coordinate system. Instead, we have to use infinitely many coordinate systems.
2. In the volume integral of equation $$B$$, for all $$\mathbf{r}$$, i.e. for all $$\mathbf{r} \in S$$, we can only use spherical coordinate system with origin at point $$\mathbf{r}$$ (in order to avoid improper integral with limits). So while computing $$B$$, we cannot use only one coordinate system. Instead, we have to use infinitely many coordinate systems.

Edit:

I know $$\int \left[\int f(x,y)\,dx \right]dy = \int \left[\int f(x,y)\,dy \right]dx$$ is true usually. Also, if in the diagram, if the volume $$V'$$ is contained within the surface $$S$$, then it is valid to change the order of integration. But here the issue is a little different. The surface $$S$$ is inside the volume $$V'$$ (please have a look at my diagram) and thus improper integral comes into play.

While computing $$A$$, if we need to avoid improper integrals, we have no choice except to work with infinitely many spherical coordinate systems each having their origin at points $$\in V'$$.

Similarly while computing $$B$$, if we need to avoid improper integrals, we have no choice except to work with infinitely many spherical coordinate systems each having their origin at points $$\in S$$.

Then how is it valid to change the order of integration in this situation? That is, how can $$A=B?$$

Yes, it is valid since the once a parametrization/coordinate system is chosen for both the surface and the volume, their integration bounds don't mix, if you treat the $$r$$ and $$r'$$ coordinates as really existing in $$\mathbb{R}^{2n}$$. Hence Fubini's theorem applies, as long as the integrals don't diverge somewhere.
• $(1)$ You said "once a parametrization/coordinate system is chosen for both the surface and the volume..." Please carefully look at the two reasons for my doubt (last two para in my question). I am not using one coordinate system. In order to avoid improper integral with limits and cavities, I am forced to use infinitely many different coordinate systems while computing both $A$ and $B$. – Joe Sep 22 '19 at 15:51
• @Joe your "infinitely many spherical coordinates" comment makes no sense since that's how divergence theorem works on a theoretical level. Really think of this integral taking place in a higher dimensional fictional space, you will see the $r$ and $r'$ coordinates do split. – Ninad Munshi Sep 24 '19 at 9:03
• @Joe Another example: $\int_0^1 \int_0^x f(x,y)dydx$ also integrates over infinitely many coordinate systems where the origin for $x$ changes location if you were to interpret it as two integrals on $\mathbb{R}$ with one dummy variable. But there is no confusion here: as long as the function is locally integrable on $\mathbb{R}^{2n}$, everything works out. In other words, don't overthink your procedure. If there is a simple, equivalent way to think of a problem, run with it. – Ninad Munshi Sep 24 '19 at 9:06