The CNOT gate can be represented by the following matrix:
Code: Select all
CNOT = [[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0]]
Control qubit in state |0⟩:
If the target qubit is initially |0⟩, the CNOT gate does not change the state of the control qubit. The resulting state is still |0⟩ for the control qubit.
If the target qubit is initially |1⟩, the CNOT gate flips the state of the control qubit. The resulting state is |1⟩ for the control qubit.
Control qubit in state |1⟩:
If the target qubit is initially |0⟩, the CNOT gate flips the state of the target qubit. The resulting state is |1⟩ for the target qubit.
If the target qubit is initially |1⟩, the CNOT gate flips the state of both the control and target qubits. The resulting state is |0⟩ for the control qubit and |0⟩ for the target qubit.
In summary, the CNOT gate flips the state of the control qubit if the target qubit is initially |1⟩. If the target qubit is initially |0⟩, the CNOT gate does not affect the state of the control qubit. The specific outcome depends on the initial states of the control and target qubits and determines the entanglement and correlation between them.