Can the Pair Be Pulled Apart?

entanglement · product state · tensor product · two qubits

A two-qubit state is a list of four amplitudes [a_{00}, a_{01}, a_{10}, a_{11}]: amplitude a_{b_0 b_1} belongs to the basis state |b_0 b_1\rangle, and qubit 0 is the leftmost bit (so |10\rangle is index 2).

Two separate qubits q_0 = [a, b] and q_1 = [c, d] together make the product state

q_0 \otimes q_1 = [\,ac,\; ad,\; bc,\; bd\,]

(kron(q0, q1)). A two-qubit state that can be written this way, for some one-qubit states q_0 and q_1, is a product state: each qubit has a state of its own. A state that cannot be written this way is entangled: the pair has a state, but neither qubit has one by itself.

Write is_entangled(state) that returns True if the normalised two-qubit state is entangled and False if it is a product state.

The amplitudes are floats, so a product state may be off by rounding errors near 1e-16. Every test state is either a product state up to such rounding errors or clearly entangled, and a tolerance of 1e-9 separates the two: never test a float with == 0.

Examples

Input:  state = [0.7071067811865476, 0, 0, 0.7071067811865476]
Output: True
Explanation: (|00> + |11>) / sqrt(2). A product [ac, ad, bc, bd] with ad = 0
needs a = 0 or d = 0, and then ac = 0 or bd = 0 too; but both are 0.707.

Input:  state = [0.5, 0.5j, -0.5, -0.5j]
Output: False
Explanation: it is kron([0.7071, -0.7071], [0.7071, 0.7071j]).

Input:  state = [0, 0.6, 0.8, 0]
Output: True

Goals

  • Recognise a two-qubit product state from its four amplitudes
  • See that a product state's amplitudes form a 2x2 table of rank 1
  • Compare floats with a tolerance instead of ==
Starting Python…