# Can I partially collapse the wavefunction in Qiskit?

I'm trying to do something similar to this question, where I want to partially measure the system before getting the output. In particular, say I have 4 qubits. I want to measure two of them, and then get the state vector associated with the other two. I know that I can do this the following way:

1. Measure the 2 qubits.
2. Perform a partial trace on those two qubits (so that my output vector only has $$2^2$$ components instead of $$2^4$$).
3. Call the statevector function to get the state on my other 2 qubits.

The problem is that I need to actually get the statevector in Step 2 before performing the partial trace. This means the system has to produce the statevector, taking up a lot of memory and limiting the number of qubits I can scale to.

My question is: Is there a way to collapse the wavefunction and then get the statevector out on only the remaining qubits without having the system calculate the whole statevector beforehand?

I don't know if this is a reasonable question, but I was wondering if it could be done.

• Saying "Measure the 2 qubits" without specifying basis IMO means single-qubit measurements in computational basis. Is it what you mean? Apr 9, 2021 at 2:12

Long answer: I think a lot of mystery about quantum mechanics has the possibility to disappear when we do simulations, like the ones you are suggesting.

For my answer, I will assume that whatever you are going to do with your 4 (or larger) qubit system, it will be at least 'entangled', in the sense that the final state is not a product state (not interesting, in simple words).

The fundamental limitation of using a quantum mechanical description of reality is that one has to use all 2^4 complex numbers to represent the state.

Now, there are multiple ways to answer your question. One would be to call for a no-go sort of argument like this. If what you suggest was possible, we would not require a 2^4 complex numbers representation, which implies that we have an equivalent description of reality that does not require quantum mechanics. But since quantum mechanics is the ultimate theory of the univer..., I would say no-go to this argument.

The other way to answer your question is to ask: Can you represent (and scale it up) all the information stored in 2^N complex numbers, in <2^N complex numbers? I would guess, in general, 'no'.

• Thanks for the response @quantumdip. I guess what I was thinking about more is the fact that, if I have a quantum state like $|a\rangle |b\rangle |c\rangle$ and I measure the third qubit in the computational basis, I will get a quantum state like $|a\rangle |b\rangle |0/1\rangle$. I could then just look at the first two qubits, which gives me $|a\rangle |b\rangle$. This only requires $2^2$ complex numbers to specify. This was the sort of thing I had in mind. I know you can do things with matrix product states that require less parameters for some states, so that could be an option.
– Germ
Apr 8, 2021 at 20:50
• Yes, if you are using a product state as you mention, you can in principle do what you are suggesting. However, perhaps it is imminent to ask: what is your motivation or end goal with this undertaking? Because product states descriptions are within the realm of 'classical' and may not require quantum mechanics at all. Apr 9, 2021 at 10:33
• My problem does indeed require entangled states, so I do need the machinery of quantum theory to do this. Fortunately, I was able to implement this with tensor networks, so it seems like my problem isn't one anymore.
– Germ
Apr 14, 2021 at 18:10