TITLE: What's the name of this theorem?
QUESTION [25 upvotes]: It happens very often in physics that we find relations like:
$$\int_V f(x) dx = \int_V g(x) dx$$
for an arbitrary volume $V$. From this we usually say "Since the volume is arbitrary, the integrands have to be equal" and we conclude $f(x) = g(x) $.
Funnily enough, this is often stated without even mentioning the name of the theorem that allows us to do so.
Intuitively, it's clear why is it so; but what's the theorem that formally allows us to do that?

REPLY [3 votes]: I think the type of theorem you would formally need to use depends on type of functions.
If they are continuous you would just prove it by contradiction: assume that there is a point where they are not equal. By continuity there is whole neighbourhood of that point where $f-g$ has constant sign. Integrating $f-g$ on that volume leads to absurd.
If functions you are considering are in $L^p$, $p \in [0, \infty)$ then linear span of characteristic functions of finite volumes are dense in the dual space $L^q$ so $f-g$ must be a zero vector. Since those are just equivalence classes of functions equal a.e. this doesn't contradict example given by ctoi. Note however that when in practice (in physics) we use discontinuous functions, values at any particular points are irrelevant - all action is in open sets (e.g. in QM wave function in specific point is meaningless, it's the integral that matters).