# How do we derive the density operator of a subsystem?

The density operator can be used to represent uncertainty of quantum state from some perspective, aka a subsystem of the full quantum system. For example, given a Bell state:

$|\psi\rangle = \frac{|00\rangle + |11\rangle}{\sqrt{2}}$

where Alice has one qbit and Bob has the other, Bob does not know whether Alice has already measured her qbit and thus collapsed his to $|0\rangle$ or $|1\rangle$ (or $|+\rangle$ or $|-\rangle$ or whatever other basis Alice used). Thus we can write a density operator for the subsystem of Bob's qbit, which I believe would just be the maximally-mixed state:

$\rho = \begin{bmatrix} 1/2 & 0 \\ 0 & 1/2 \end{bmatrix}$

Given a multi-qbit system, how do we derive the density operator of some subsystem of those qbits? I'm interested in the answer for both a subsystem consisting of a single qbit and one consisting of some arbitrary subset of the qbits.

Let's say you have some density matrix, $\rho$, over a set of qubits $1,2,\ldots ,n$. (If you have a pure state $|\psi\rangle$, set $\rho=|\psi\rangle\langle\psi|$.) Let's say that the subsystem that we want the reduced density operator of is specified by the set of qubits $S$ (and all the others are $\bar S$). You have that $$\rho_S=\text{Tr}_{\bar S}(\rho),$$ where $\text{Tr}_{\bar S}$ is the partial trace over the set $\bar S$. What does this mean in practice? Pick any orthonormal basis $\{|\phi_i\rangle\}_{i=1}^{|\bar S|}$ over $\bar S$, then you simply calculate $$\text{Tr}_{\bar S}(\rho)=\sum_{i=1}^{|\bar S|}\left(\langle \phi_i|_{\bar S}\otimes\mathbb{I}_S\right)\rho\left(| \phi_i\rangle_{\bar S}\otimes\mathbb{I}_S\right).$$ Usually, you just pick the computational basis. So, in your example of $$\rho=\frac12\left(|00\rangle\langle 00|+|00\rangle\langle 11|+|11\rangle\langle 00|+|11\rangle\langle 11|\right),$$ you pick the basis $\{|0\rangle,|1\rangle\}$, and you calculate $$\rho_A=(\mathbb{I}\otimes\langle 0|)\rho(\mathbb{I}\otimes|0\rangle)+(\mathbb{I}\otimes\langle 1|)\rho(\mathbb{I}\otimes|1\rangle)=\frac12(|0\rangle\langle 0|+|1\rangle\langle 1|)).$$
To make this calculation a bit shorter, then it's worth noting that, over the subsystems $\bar S$ that you're taking the partial trace over, it's permutation invariant. So, you can pick up a ket from the left-hand side, and match it with a bra on the right-hand side (but make sure you always match terms from the same subsystem, and that that subsystem is in $\bar S$): $$\text{Tr}_B(\rho)=\frac12\left(|0\rangle\langle0|\langle0|0\rangle+|1\rangle\langle0|\langle0|1\rangle+|0\rangle\langle1|\langle1|0\rangle+|1\rangle\langle1|\langle1|1\rangle\right),$$ and you can now simply read off this final result. It's always a good check, to make sure you haven't messed up too badly, to make sure that the $\rho_S$ that you output is (i) Hermitian, (ii) has trace 1.
The density operator is defined to be $\rho = \left|\psi\right> \left<\psi\right|$. To get the "reduced" density operator for a subsystem, you have to form the trace (i.e. sum) over all of the qubits not inside your subsystem.
For example, given the Bell state $\left|\psi\right> = \frac{\left|00\right> + \left|11\right>}{\sqrt{2}}$, the density matrix is $\rho = \frac{1}{2} \big( \left|00\right>\left<00\right| + \left|00\right>\left<11\right| + \left|00\right>\left<11\right| + \left|11\right>\left<11\right| \big) = \frac{1}{2} \begin{bmatrix} 1 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 1 & 0 & 0 & 1 \\ \end{bmatrix}$, for either qubit, performing the partial trace over the other qubit results in a reduced density matrix $\rho_1 = \frac{1}{2} \begin{bmatrix} 1 & 0 \\ 0 & 1 \\ \end{bmatrix}$.