# Question about quantum error correction and density matrixs

I am now studying QEC and feel confused. If I have a density matrix before the correction:

The circuit is:

$$\rho = p^0(1-p)^3|\varphi\rangle \langle\varphi|+p^1(1-p)^2\sum_{i=1}^3X_i|\varphi\rangle \langle\varphi|X_i+p^2(1-p)\sum_{i=1}^3(X_3 X_2 X_1)X_i|\varphi\rangle \langle\varphi|X_i(X_1 X_2 X_3)+p^3(X_3 X_2 X_1)|\varphi\rangle \langle\varphi|(X_1 X_2 X_3)$$

My answer is: $$\rho = p^0(1-p)^3|\varphi\rangle \langle\varphi|+3p^1(1-p)^2|\varphi\rangle \langle\varphi|+3p^2(1-p)|\varphi\rangle \langle\varphi|+p^3|\varphi\rangle \langle\varphi|$$

After the circuit works, what is the probability to find the logical qubit in the state $$|ψ\rangle$$ and why the system is not in the state $$|ψ\rangle = α|000\rangle + β |111\rangle$$ with probability 1 after the error correction procedure of random bit flips? It makes me confused.

Hope someone can help me with my problems.

By the way, Nielsen's book has little examples for a newbie to learn, where could I find more exercises and examples?

Sorry about the pictures, I just draw this quick picture by my hand.

• If 0 or 1 $$X$$ errors occur, error correction returns the original state $$|\psi\rangle$$
• If 2 or 3 $$X$$ errors occur, error correction returns the bit-flipped state $$XXX|\psi\rangle$$ ($$XXX|\psi\rangle$$ is a valid state, so error correction should never change it, and a pair of $$X$$ errors are equivalent to a single error on $$XXX|\psi\rangle$$)
Hence, the state that you get after error is (sort of) $$\rho=(1-p)^2(1+2p)|\psi\rangle\langle\psi|+p^2(3-2p)XXX|\psi\rangle\langle\psi|XXX.$$ Why do I say "sort of"? Strictly, you have measured the two ancilla qubits. You know what measurement result you got. For example, if you got the 00 answer, you know that all qubits were the same. Hence, you either had the $$(1-p)^3|\psi\rangle\langle\psi|$$ case or the $$p^3XXX|\psi\rangle\langle\psi|XXX$$. Hence, your density matrix in this case should be $$\rho_{00}=\frac{(1-p)^3|\psi\rangle\langle\psi|+p^3XXX|\psi\rangle\langle\psi|XXX}{(1-p)^3+p^3}$$ If the measurement results were anything else, you're choosing between a one-error case and a two-error case. Hence \begin{align} \rho_{xy}&=\frac{(1-p)^2p|\psi\rangle\langle\psi|+p^2(1-p)XXX|\psi\rangle\langle\psi|XXX}{(1-p)^2p+p^2(1-p)} \\ &=(1-p)|\psi\rangle\langle\psi|+pXXX|\psi\rangle\langle\psi|XXX \end{align}
• Hi, thank you for your answer! However, I don't understand this: a pair of X errors are equivalent to a single error on $XXX|ψ⟩$. could you please explain more about that? – user13341 Nov 25 '20 at 12:09
• $X_1X_3|\psi\rangle=X_2(X_1X_2X_3)|\psi\rangle$ – DaftWullie Nov 25 '20 at 14:10
• I understand it! So, the system is not in the state $|ψ>=α|000>+β|111>$ with probability 1 after the error correction procedure of random bit flips because it has two possible outcomes: $|ψ>=α|000>+β|111>$ and $|ψ>=α|111>+β|000>$. Am I right? I think I understand your words! That makes sense! – user13341 Nov 25 '20 at 14:32
• Yes, exactly right (except that you shouldn't label the two different states both using $|\psi\rangle$). – DaftWullie Nov 25 '20 at 14:56