Integral in commutator Let's assume I have an expression like,
$$
\left[\int\! \mathrm dt ~\hat{H}_1(t),\int \! \mathrm dt^{\prime}~\hat{H}_2(t^{\prime})\right].
$$
When would I be allowed to write the integrals in front of the commutator, when not?
 A: I am not sure about this but it is to long for a comment, so please give some feedback on this answer.
First, assuming those integrals converge, let me define:
\begin{align}
\int\! \mathrm dt ~\hat{H}_1(t)&\equiv \hat{I}_1,\\\\
\int\! \mathrm dt ~\hat{H}_2(t)&\equiv \hat{I}_2.
\end{align}
With that we can rewrite the commutator as:
\begin{align}
\left[\int\! \mathrm dt ~\hat{H}_1(t),\int \! \mathrm dt^{\prime}~\hat{H}_2(t^{\prime})\right]
&=\hat{I}_1\int \! \mathrm dt^{\prime}~\hat{H}_2(t^{\prime})-\hat{I}_2\int \! \mathrm dt~\hat{H}_1(t)\\\\
&=\int \! \mathrm dt^{\prime}\hat{I}_1~\hat{H}_2(t^{\prime})-\int \! \mathrm dt~\hat{I}_2\hat{H}_1(t).
\end{align}
If I understand the integral as basically a Riemann sum, then the Integral is linear. If I multiply a sum of operators by an operator it is the same as the sum over all summands multiplied by the operator. Note I did not commute any operators.
If one puts the defintions of $\hat{I}_1$ and $\hat{I}_2$ back in we get:
\begin{align}
\int \! \mathrm dt^{\prime}\hat{I}_1~\hat{H}_2(t^{\prime})-\int \! \mathrm dt~\hat{I}_2\hat{H}_1(t)&=\int\int\mathrm dt'~\mathrm dt ~\hat{H}_1(t)\hat{H}_2(t')-\int\int  \!\mathrm dt~\mathrm dt' ~\hat{H}_2(t')\hat{H}_1(t)\\\\&=\int\int\mathrm dt~\mathrm dt' ~\hat{H}_1(t)\hat{H}_2(t')-\int\int  \!\mathrm dt~\mathrm dt' ~\hat{H}_2(t')\hat{H}_1(t)\\\\
&=\int\int  \!\mathrm dt~\mathrm dt'\left[\hat{H}_1(t),\hat{H}_2(t')\right].
\end{align}
Where we changed the order of integration (swapped the differentials) in the first term. If one understands the integral as a Riemann sum and especially if the integration domains are equal this should be valid.
I edited this post: in my first version I only relabeled $t$ and $t'$ which resulted in a different expression not the commutator. But even looking at that expression under the integral would be equal to the commutator. I think picking out the integrand and looking at it isolated was not right.
