Equality of integrals versus equality of integrands

This is a puzzling point for me, and I see it often used in some textbooks when authors switch between differential and integral forms of equations (e.g. in electrodynamics). I wish to know if there is any proven mathematical theorem or lemma that relates to this.

Given the equality between two integrals:

$$\int_{V} f(x,y,z)\, dV =\int_{V} g(x,y,z)\, dV.$$

It is often said that, if this equality holds for an arbitrary domain $V$ (e.g. a volume), then this equality implies equality of the involved integrands too, that is $f=g$.

Now, although I understand that this works because the arbitrariness of $V$ implies that one could choose an infinitesimally small $V$ where the integrands could be considered constants and taken outside the integrals, allowing for the above conclusion to be obtained, I am not sure whether it is a general rule or one that doesn't have other necessary conditions.

For example, would it work if the functions $f$ and $g$ were dependent on $V$ to start with? We could have cases or phenomena where arbitrary $V$ gives different $f$ and $g$ and the equality of integrals still holds, but would it then still imply equality of integrands?

• What is your question exactly? Are $f$ and $g$ given? Is $V$ ranging over a predefined set of domains? At least one of them has to hold otherwise your question makes no sense. – dezdichado Apr 15 '17 at 19:50
• @dez For example, $f$ and $g$ are two field functions derived from the eignefunctions (solutions) for the Helmhotz wave equation within a cavity of volume V and enclosing surface S with some boundary conditions. Thus, $f$ and $g$ can be influenced by the shape of S and its boundary conditions, but (to me at least) they are not entirely independent of its volume. And we can have two physical quanitites (like energies) that are known to be equal: $\int_{V} f dV =\int_{V}g dV$. So can we say here that arbitrary V will result in integrand equality? – user135626 Apr 15 '17 at 20:05
• @dez So, to clarify, the physical rule that we are sure about is that $\int_{V} fdV=\int_{V}gdV$ for any given $V$, for which $f$ and $g$ are calculated (known). What some authors do sometimes to conclude that $f=g$, is to say that the equality $\int_{V} fdV=\int_{V}gdV$ must always hold (from physical laws) for any $V$, and therefore, we get $f=g$. – user135626 Apr 15 '17 at 20:33
• It seems like you are confusing things a little bit. First of all, do the values of functions $f$ and $g$ change when we consider different domains? Yes, absolutely. But that does not mean the functions themselves (viewed as functions) are dependent on $V$. Changing the domain does not change the definition of the functions. With this interpretation, $V\in\mathbb{R}^3$, then the answer is yes - it has to follow that $f = g$. In fact, I believe stronger results are also true. At least in $\mathbb{R^2}$, the conclusion still holds when you only consider all possible rectangles $V$. – dezdichado Apr 15 '17 at 20:47