I read here that we use matrices to represent quantum logical gates.

But I don't like this 'point of view' because I want to build (or simulate logically with a real quantum processor, not through abstract models) mathematical structures as Hilbert space when I already have quantum circuits.
I want to understand how to build matrices with quantum logical gates as real quantum circuits.

In other words, we let's start with some physical quantum logical gates and we want to build a matrix with those circuits.

Can you give me some material explaining how to build a Hilbert space with quantum circuits?

  • $\begingroup$ Not quite sure what you're asking, could you try to formalize the question a bit. What do you mean by 'build' a matrix with gates? $\endgroup$ – Rammus Dec 9 '20 at 12:58
  • $\begingroup$ If you are interested in how to approximate any unitary matrix to an arbitrary precision using a fixed set of quantum gates, then section 4.5 "Universal quantum gates" of Nielsen & Chuang explains it. $\endgroup$ – Attila Kun Dec 9 '20 at 13:14
  • $\begingroup$ @AttilaKun yes, it is. Is called "approximation"? I need to understand which quantum building blocks are used to realize any unitary matrix or any bra-ket used to represent a Hilbert space. For example, in classical logic circuits it's not easy to make a binary division also if division is very simple as operation, for example for division in classical logic you need to use a very small CPLD (Altera and Xilinx gives the primitives required for this), something like this circuitlab.com/editor/#?id=f9s285 $\endgroup$ – Jack Rock Dec 9 '20 at 17:55
  • $\begingroup$ I wish to draw circuits for basic operation but for quantum gates and hence every mathematical structure, also a Hilbert space $\endgroup$ – Jack Rock Dec 9 '20 at 17:56

The Hilbert space in quantum computation is used to express quantum states. In particular, they are vectors in $\mathbb{C} ^ {2^n}$, where $n$ is number of qubits the state is composed of. Any mapping from one state to another one is expressed by a unitary matrix. This is (a very rough) description of basics behind mathematical model of quantum computation.

So, if you have a circuit, you can describe its action on different input basis states, i.e. how input is transformed to output. If you express these states as a vectors in a Hilbert space, in the end you come to matrix representation of the circuit. In other words, you can construct a matrix describing the circuit based on its action on different input states.

Hope this helps, as the question is a little bit unclear.

EDIT: An example how to convert circuit into matrix. Let's consider CNOT gate. This gate is two qubit gate. First qubit is called control, second target. The gate performs negation on the target if control is in state $|1\rangle$, so input-output map has this form:

  • $|00\rangle \rightarrow |00\rangle$ (control in state $|1\rangle$, target is not negated)
  • $|01\rangle \rightarrow |01\rangle$ (control in state $|1\rangle$, target is not negated)
  • $|10\rangle \rightarrow |11\rangle$ (control in state $|1\rangle$, target is negated)
  • $|11\rangle \rightarrow |10\rangle$ (control in state $|1\rangle$, target is negated)


$$ |00\rangle = \begin{pmatrix}1 \\ 0 \\ 0 \\ 0 \end{pmatrix} |01\rangle = \begin{pmatrix}0 \\ 1 \\ 0 \\ 0 \end{pmatrix} |10\rangle = \begin{pmatrix}0 \\ 0 \\ 1 \\ 0 \end{pmatrix} |11\rangle = \begin{pmatrix}0 \\ 0 \\ 0 \\ 1 \end{pmatrix} $$

a matrix describing CNOT gate is

$$ \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{pmatrix}, $$

i.e. outputs are simply put one beside another. The first column of the matrix represent reactio of the gate on $|00\rangle$ input, second reaction on $|01\rangle$ etc.

Concerning software, I use IBM Q Experience environment and Qiskit language.

  • $\begingroup$ ok, thank you. Can you show me a (quantum) circuit example of matrix describing the circuit based on its action on different input states? Do you use Circuit Lab or something similar? I wish to understand what software I need to use to build circuits that represent unitary matrices $\endgroup$ – Jack Rock Dec 10 '20 at 21:50
  • $\begingroup$ @AnsgarWiechers: Please find in edited answer. $\endgroup$ – Martin Vesely Dec 11 '20 at 8:21
  • $\begingroup$ Ok, thank you, I accept your answer but you say how convert circuit into matrix. But my request is converse: what quantum circuit (I think that we need to draw technical logical blocks) is needed to generate an unitary matrix (or an operation like division)? For this reason I ask about software. I want to build a matrix starting from a circuit and generate from this circuit a matrix, not convert a circuit into a matrix $\endgroup$ – Jack Rock Dec 11 '20 at 12:49
  • $\begingroup$ @AnsgarWiechers: Any operation (with expections I will discuss later) on quantum computer is depicted by a unitary matrix, hence any circuit generate unitary matrix. The exceptions are measurement and reset as these two operation collapas wave function and thus they are not reversible. As I mentioned, use Qiskit to convert a quantum circuit to a matrix (look for Operators in documentation). $\endgroup$ – Martin Vesely Dec 12 '20 at 7:38
  • $\begingroup$ Qiskit, thank you very much. Now I know what to do $\endgroup$ – Jack Rock Dec 12 '20 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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