# What is the technique for calculating $\text{Tr}_b[{U(\rho\otimes\rho_b)U^{\dagger}}]$?

I am stuck on calculating $$\mathcal{E}(\rho)=\text{Tr}_b[{U(\rho\otimes\rho_b)U^{\dagger}}]$$. For example, in the case when $$U$$ is the CNOT matrix $$U=\begin{pmatrix} 1 & 0 & 0 & 0\\\ 0 & 1 & 0 & 0\\\ 0 & 0 & 0 & 1\\\ 0 & 0& 1& 0 \end{pmatrix},$$ and $$\rho_b=|0\rangle\langle0|$$ as is shown in figure $$8.4$$ on page 359 in Quantum Computation and Quantum Information by Isaac Chuang and Michael Nielsen.

I calculated the whole matrix multiplication inside the partial trace (assuming that $$\rho=|\psi\rangle\langle\psi|$$). I end up with a 4-by-4 matrix and I cannot find its partial trace. In the textbook it is said that "it is easily seen that" $$\mathcal{E}(\rho) = |0\rangle\langle0|\rho|0\rangle\langle0| + |1\rangle\langle1|\rho|1\rangle\langle1|.$$

I do not understand how to see this easily and find $$\mathcal{E}(\rho)$$ in general.

For example, when we have this:

$$\text{Tr}_b[{e^{-iH}(\rho\otimes\rho_b)e^{iH}}],$$ with $$\rho_b=|0\rangle\langle0|$$ and $$H$$ is of the Ising type $$H=J(X^{(0)}X^{(1)}+Y^{(0)}Y^{(1)})+\alpha(Z^{(0)}+Z^{(1)})$$ and where $$X^{(j)}$$, $$Y^{(j)}$$, and $$Z^{(j)}$$ are the Pauli $$X$$, $$Y$$, and $$Z$$ operators on qubit $$j$$ with $$j=0$$ being the ancillary qubit for the density operator $$\rho_b$$.

The partial trace of a bipartite state $$\sigma_{ab}$$ of two qubits $$a$$ and $$b$$ is $$\mathrm{tr}_b(\sigma_{ab}) = \langle 0_b|\sigma_{ab}|0_b\rangle+\langle 1_b|\sigma_{ab}|1_b\rangle.\tag1$$

Substituting $$\sigma_{ab}:=U(\rho\otimes\rho_b)U^\dagger$$ and $$\rho_b=|0\rangle\langle 0|$$ into $$(1)$$, we obtain

\begin{align} \mathcal{E}(\rho)&=\mathrm{tr}_b(U(\rho\otimes\rho_b)U^\dagger)\\ &= \langle 0_b|U(\rho\otimes|0_b\rangle\langle 0_b|)U^\dagger|0_b\rangle+\langle 1_b|U(\rho\otimes|0_b\rangle\langle 0_b|)U^\dagger|1_b\rangle\\ &= \langle 0_b|U|0_b\rangle\rho\langle 0_b|U^\dagger|0_b\rangle+\langle 1_b|U|0_b\rangle\rho\langle 0_b|U^\dagger|1_b\rangle. \end{align}\tag2

## CNOT gate

Now, if $$U$$ is the CNOT gate, then we calculate

\begin{align} \langle 0_b|U|0_b\rangle=|0_a\rangle\langle 0_a|\\ \langle 1_b|U|0_b\rangle=|1_a\rangle\langle 1_a| \end{align}\tag3

so in this case

$$\mathcal{E}(\rho) = |0_a\rangle\langle 0_a|\rho|0_a\rangle\langle 0_a|+|1_a\rangle\langle 1_a|\rho|1_a\rangle\langle 1_a|\tag4$$

as expected.

## Ising type Hamiltonian

The above procedure works for general $$U$$. In particular, when $$U=e^{-iH}$$ we compute $$\langle 0_b|e^{-iH}|0_b\rangle$$ and $$\langle 1_b|e^{-iH}|0_b\rangle$$ and substitute into $$(2)$$.

• Thank you for your help. Please I need some clarifications on your great answer. First, when you write $\langle0_b|\sigma_{ab}|0_b\rangle$, how do you multiply the matrix $\sigma_{ab}$ with the vector $|0_b\rangle$ when their dimensions do not match? In the CNOT gate case, $\sigma_{ab}$ is of size 4-by-4 but $|0_b\rangle$ is of size 2-by-1. Am I wrong? Second, how did you go from line $(2)$ to the next line? In other words, how did you remove the tensor product in line $(2)$? I would appreciate your help.
– zdm
Feb 7 at 14:46
• Formally, $\langle i_b|U_a\otimes V_b|j_b\rangle=U_a \langle i_b|V_b|j_b\rangle =v_{ij} U_a$ extended by linearity. Alternatively, you can think of a two-qubit operator, such as CNOT or $\sigma_{ab}$, as tensor with four indices: input and output for qubit $a$ and input and output for qubit $b$. To evaluate $\langle\psi_a|\sigma_{ab}|\phi_a\rangle$, we contract the two indices for qubit $a$ and end up with two-index tensor, i.e. a matrix, acting on qubit $b$. If the kets are computational basis then the whole calculation simplifies to "cutting out" a submatrix of $\sigma_{ab}$. Feb 7 at 17:20
• Thanks again. For $U=e^{iH}$, how do we find it? I have so far $H=J\begin{pmatrix}2 & 0\\\ 0 & 2\end{pmatrix}+\alpha\begin{pmatrix}2 & 0\\\ 0 & -2\end{pmatrix}$. I am missing something here. $Z^{(0)}$ is a 2-by-2 matrix but $H$ should be a 4-by-4 matrix right?
– zdm
Feb 7 at 20:37
• You are right that we cannot add matrices of different sizes. However, there is a convention wherein identity operators are made implicit, so the $Z^{(0)}$ term in the Hamiltonian most likely means $Z^{(0)}\otimes I^{(1)}$ etc. Feb 7 at 20:45