What's the name of this theorem? 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?
 A: This statement actually isn't true in general. Consider the following functions $f,g$ where $f$ is the zero function and we define $g(x) = 0$ for $x \neq 0$ and $g(0)=1.$ Clearly the two functions are not the same, however for any interval $[a,b],$
$$ \int_a^b f(x) \ dx = \int_a^b g(x) dx = 0. $$
Using a similar argument you can construct a counterexample in $\Bbb R^3.$
This statement is true however, if we assume that $f$ and $g$ are continuous. This is because if $f(x) \neq g(x),$ for some $x \in \Bbb R^3,$ then there is an open neighbourhood for which $f$ and $g$ are not equal (and by continuity one is always larger than the other). Integrating over this set gives a contradiction.
I don't know if this result has a name though and I wouldn't be surprised if it didn't. Important theorems are usually given a name as they are common referenced, but smaller results like these usually aren't given one.
Edit: Some conditions for $V$ may also be necessary. A sufficient condition (which my proof sketch uses) if $V$ to be open.
A: 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).
A: Let $(X,\mathcal{E},\mu)$ be a measure space. In general, if $f,g:X\to\mathbb{R}$ are both measurable with respect to $\mathcal{E}$, integrable, and satisfy
$$
\int_A f\,\mathrm d\mu =\int_A g\,\mathrm d\mu,\qquad \text{for all } A\in\mathcal{E},
$$ 
then $f=g$ almost everywhere with respect to $\mu$. In fact, it is enough to require the identity for all $A$ in some $\cap$-stable generator of $\mathcal{E}$.
In particular, if you let $(X,\mathcal{E},\mu)=(\mathbb{R},\mathcal{B}(\mathbb{R}),\lambda)$ where $\lambda$ is the Lebesgue measure, then if $f,g:\mathbb{R}\to\mathbb{R}$ are Borel measurable, integrable, and satisfy
$$
\int_A f\,\mathrm d\lambda=\int_Ag\,\mathrm d\lambda,\qquad\text{for all }A\in\mathcal{B}(\mathbb{R}),
$$
you can conclude that $f=g$ almost-everywhere with respect to $\lambda$. Again, it is enough to require the identity e.g. for all $A$ of the form $[a,b]$, $a<b$. Note that you can never be sure of pointwise identity. 
