Suppose \Omega\subset\mathbb{R}^n is an open set, Y\subset\mathbb{R}^m is a measurable set, and f:\Omega\times Y\to \mathbb{R} some function so that y\mapsto f(x,y) is integrable with all x\in\Omega, and so that x\mapsto f(x,y) has the partial derivative \partial_i f(x,y) with all y\in Y. Now it makes sense to ask if the equation
<br />
\partial_i \int\limits_Y dy\; f(x,y) = \int\limits_{Y} dy\; \partial_i f(x,y)<br />
is correct. If we write down the definition of the derivative, we see that the equation is equivalent with
<br />
\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}.<br />
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 f_n:X\to\mathbb{R}, that converge pointwisely to some function f:X\to\mathbb{R}, on some measure space, is the equation
<br />
\lim_{n\to\infty} \int\limits_X dx\; f_n(x) = \int\limits_X dx\; f(x)<br />
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 g:X\to\mathbb{R} must exist so that
<br />
|f_n(x)| \leq g(x),\quad\quad \forall x\in X,\quad \forall n\in\mathbb{N}<br />
and
<br />
\int\limits_X dx\; g(x) < \infty.<br />
In similar spirit, a following condition gives an answer to the original problem: If there exists a function h:Y\to\mathbb{R} so that |\partial_i f(x,y)| \leq h(y) for all x\in\Omega and y\in Y, and so that
<br />
\int\limits_Y dy\; h(y) < \infty,<br />
then the differentiation and integration can be commuted.
The proof uses the dominated convergence, and the mean value theorem which guarantees the existence of \xi_{x,y,\epsilon}\in\Omega such that
<br />
\frac{f(x + \epsilon e_i, y) - f(x,y)}{\epsilon} = \partial_i f(\xi_{x,y,\epsilon}, y).<br />
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.