I read this research paper.

I have octave and the package running.

This is an example of what I did so far -

octave:3> s1 = state(normalize(ket([1,0])+ket([0,1])))  
s1 =

   0.00000   0.00000   0.00000   0.00000
   0.00000   0.50000   0.50000   0.00000
   0.00000   0.50000   0.50000   0.00000
   0.00000   0.00000   0.00000   0.00000

How would I see whether or not a state is entangled? Are there any examples using octave demonstrating entanglement?

  • 4
    $\begingroup$ It is not clear what you mean by saying that "I did not see any entanglement". The state you have specified is an example of a Bell state, which are entangled states. You can test entanglement of such states by using what is called the Schmidt decomposition. $\endgroup$
    – biryani
    Commented Nov 9, 2018 at 7:59
  • $\begingroup$ OK. I will research Schmidt decompositions. Thanks. $\endgroup$ Commented Nov 9, 2018 at 8:22
  • $\begingroup$ s1 is correct. The program sees the entanglement just fine even if it is not visually obvious to you in this form. $\endgroup$
    – AHusain
    Commented Nov 9, 2018 at 13:15
  • $\begingroup$ Yes I need to research more. I just saw about Julia Labs too. $\endgroup$ Commented Nov 9, 2018 at 15:13
  • 3
    $\begingroup$ You might be interested in How do I show that a two-qubit state is an entangled state? and How to show that an n-level system is entangled?. $\endgroup$ Commented Nov 10, 2018 at 10:23

1 Answer 1


There are a few tests of whether a two qubit state is entangled. One is to perform the so-called 'partial transpose', which can be done with the partialtranspose function in quantum-octave. If the resulting matrix has any negative eigenvalues, you know that your original state was entangled.

Another test works only when your two qubit state is pure (note: a state can be said to be either pure or mixed, depending on whether it has only a single non-zero eigenvalue, or multiple non-zero eigenvalues). To test this you can look at the eigenvalues. Or you can calculate the Von Neumann entropy with vnentropy. This returns a value of zero only for pure states.

Once you have a pure state of two qubits and want to test for entanglement, your next step is to perform a partial trace using ptrace. This will give a description of the state of just one of your qubits. If this state is also pure, your overall two qubit state is not entangled. But if it is mixed, it is entangled. To determine which is true, you can again use vnentropy. The result of this can be regarded as a measure of how entangled the state is.

Another measure of entanglement, and one that works even when your overall state is the concurrence. This can be calculated in quantum-octave with concurrence.

There's also a bunch of other ways. As you learn about entanglement you will learn many concepts, and then you'll find that many of those have an implementation in quantum-octave.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.