I'm new in quantum computing, I have this question.

Qubits $x$ and $y$ are in $\mathbb{C}^2$ (column vector) and $A, B$ are unitary matrices ($A$ 8x8 and $B$ 4x4 matrix).

If I'm not wrong the input of $A$ is $x_1 \otimes x_2 \otimes x_3$ which is in $\mathbb{C}^8$ (column vector). Now given the output $z=A(x_1 \otimes x_2 \otimes x_3)$ how can I extract $y_3$ from $z$ to calculate $y_3 \otimes y_4$ ($x_4 = y_4$) which is the input of $B$?

enter image description here

  • $\begingroup$ Suppose the circuit goes on. I don't want to measure y's. I want to how to perform calculation after A matrix-gate. $\endgroup$
    – asv
    Apr 28, 2020 at 15:12
  • $\begingroup$ I want to know how to calculation are peformed. I don't want to use software I want to understand the calculation. $\endgroup$
    – asv
    Apr 28, 2020 at 15:15
  • $\begingroup$ Use the partial trace: en.wikipedia.org/wiki/Partial_trace $\endgroup$
    – draks ...
    Apr 28, 2020 at 15:19
  • $\begingroup$ Thank you for your link $\endgroup$
    – asv
    Apr 29, 2020 at 10:37

1 Answer 1


In general, you cannot just extract the part of the state that corresponds to $y_3$ and $y_4$. Instead, you have to consider the entire state (which you will describe using a 16-element vector), and you apply to it the unitary $I\otimes B$ where $I$ is the $4\times 4$ identity matrix.

  • $\begingroup$ Thank you very much! So this is the way the calculation are made in any quantum circuit? $\endgroup$
    – asv
    Apr 28, 2020 at 15:21
  • 1
    $\begingroup$ It's the general way that you have to perform the calculation if you want to simulate what a quantum circuit does via a classical calculation. That's the whole "problem" with quantum computation - essentially, you have to keep the whole exponentially large vector in memory, which we cannot do classically. $\endgroup$
    – DaftWullie
    Apr 29, 2020 at 8:25

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.