0
$\begingroup$

I've been trying to find a way to analytically find the unitary matrix of a circuit, but I cant find the resources to do so. How can I do so?

$\endgroup$
2
  • $\begingroup$ mathematically, or programmatically? If the latter, using which package? $\endgroup$
    – ryanhill1
    Commented Apr 7, 2023 at 16:30
  • $\begingroup$ Mathematically. $\endgroup$ Commented Apr 7, 2023 at 16:57

1 Answer 1

0
$\begingroup$

I will provide a short, incomplete answer on how to do it, but also refer you to resources that I would highly recommend you look at for a more complete picture. This will be an important skill for you to learn, so I would recommend taking your time to master it.

How to compute the unitary matrix of a circuit

Suppose a quantum circuit of $n$ qubits has $g$ unitary gates. Label these gates by $U_1, U_2, \dots, U_g$, in the order they occur in the circuit (if some gates occur simultaneously, it doesn't matter how you order those ones). Each of these gates has a representation as a $2^n \times 2^n$ unitary. To get $U$, just multiply these in reverse order: $U = U_g U_{g-1} \dots U_1$. The reversal comes from the way functions are ordered in standard math notation.

So how do you get the matrices $U_i$ in the first place? If it's a single-qubit gate, you could take the tensor product of the matrix for the single qubit with the identity on the rest of them, minding the ordering. Or, for any gate you could looking at how it acts on computational basis states.

Resources

If any of the above seems confusing or leave you with further questions, I would recommend the following resources to develop a strong foundation:

$\endgroup$

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.