# Does integrating w.r.t. the Haar measure commute with taking partial trace?

Consider a density matrix $$\rho(U)$$ which depends on $$U \in SU(2^n)$$, corresponding to a state of a composite, finite-dimensional Hilbert space $$\mathcal{H} \cong \bigotimes_{i=1}^{2^n} \mathbb{C}^2$$ where the first factor is designated system $$\mathcal{H}_S$$ and the rest of the factors is designated environment $$\mathcal{H}_\mathcal{E}$$. Let $$dU$$ denote the Haar measure (together with the infinitesimal).

Does $$\int dU \ \text{Tr}_\mathcal{E}(\rho(U)) = \text{Tr}_\mathcal{E}(\int dU \ \rho(U))?$$

Yes. We can check this explicitly as follows. $$\int dU \ \text{Tr}_\mathcal{E}(\rho(U)) = \int dU \ \sum_i (\mathbb{I} \otimes \langle i \lvert) \rho(U) (\lvert i \rangle \otimes \mathbb{I})\\ = \sum_i \int dU \ (\mathbb{I} \otimes \langle i \lvert) \rho(U) (\lvert i \rangle \otimes \mathbb{I})\\ = \sum_i (\mathbb{I} \otimes \langle i \lvert) \int dU \ \left( \rho(U) (\lvert i \rangle \otimes \mathbb{I}) \right)\\ = \sum_i (\mathbb{I} \otimes \langle i \lvert) \left(\int dU \ \rho(U) \right)(\lvert i \rangle \otimes \mathbb{I})\\ = \text{Tr}_\mathcal{E}(\int dU \ \rho(U)). \ \square$$