Suppose [tex]\Omega\subset\mathbb{R}^n[/tex] is an open set, [tex]Y\subset\mathbb{R}^m[/tex] is a measurable set, and [tex]f:\Omega\times Y\to \mathbb{R}[/tex] some function so that [tex]y\mapsto f(x,y)[/tex] is integrable with all [tex]x\in\Omega[/tex], and so that [tex]x\mapsto f(x,y)[/tex] has the partial derivative [tex]\partial_i f(x,y)[/tex] with all [tex]y\in Y[/tex]. Now it makes sense to ask if the equation
[tex]
\partial_i \int\limits_Y dy\; f(x,y) = \int\limits_{Y} dy\; \partial_i f(x,y)[/tex]
is correct. If we write down the definition of the derivative, we see that the equation is equivalent with
[tex]
\lim_{\epsilon\to 0} \int\limits_Y dy\; \frac{f(x+\epsilon e_i, y) - f(x,y)}{\epsilon} = \int\limits_Y dy\; \lim_{\epsilon\to 0} \frac{f(x+\epsilon e_i, y) - f(x,y)}{\epsilon}.[/tex]
So actually the question is that can you change the order of the limit and the integration.
This is a basic problem in the integration theory: Given a sequence of integrable functions [tex]f_n:X\to\mathbb{R}[/tex], that converge pointwisely to some function [tex]f:X\to\mathbb{R}[/tex], on some measure space, is the equation
[tex]
\lim_{n\to\infty} \int\limits_X dx\; f_n(x) = \int\limits_X dx\; f(x)[/tex]
true? The answer is that it is not always true, but the Lebesgue's dominated convergence theorem,
http://en.wikipedia.org/wiki/Dominated_convergence_theorem, describes a sufficient and useful condition that guarantees that the limit and integration can be commuted. The condition is that a dominating function [tex]g:X\to\mathbb{R}[/tex] must exist so that
[tex]
|f_n(x)| \leq g(x),\quad\quad \forall x\in X,\quad \forall n\in\mathbb{N}[/tex]
and
[tex]
\int\limits_X dx\; g(x) < \infty.[/tex]
In similar spirit, a following condition gives an answer to the original problem: If there exists a function [tex]h:Y\to\mathbb{R}[/tex] so that [tex]|\partial_i f(x,y)| \leq h(y)[/tex] for all [tex]x\in\Omega[/tex] and [tex]y\in Y[/tex], and so that
[tex]
\int\limits_Y dy\; h(y) < \infty,[/tex]
then the differentiation and integration can be commuted.
The proof uses the dominated convergence, and the mean value theorem which guarantees the existence of [tex]\xi_{x,y,\epsilon}\in\Omega[/tex] such that
[tex]
\frac{f(x + \epsilon e_i, y) - f(x,y)}{\epsilon} = \partial_i f(\xi_{x,y,\epsilon}, y).[/tex]
So if you want to commute differentiation and integration rigorously, the ready formula for it is that you must prove the existence of this dominating function.