When I build a quantum circuit and my initial state is the one composed only by zeros ($|000\ldots 0\rangle$), I have a final state $|\psi\rangle$ that is the result of the application of the quantum circuit to $|000\ldots 0\rangle$.

My question is: if I have the final state $|\psi\rangle$ (or something similar, like the probability related to each element of the computational basis) and I know that my initial state is $|000\ldots 0\rangle$, is there a way (exact, variational, etc.) to find one of the quantum circuit that applied to $|000\ldots 0\rangle$ give me $|\psi\rangle$?

  • 1
    $\begingroup$ Do you want an analytical algorithm or do you want to use some software e.g. Qiskit? $\endgroup$
    – Mauricio
    Nov 24, 2021 at 17:30
  • $\begingroup$ @Mauricio if there is some documentation about the algorithm used by the software (e.g. qiskit libraries) for me is ok. If it's a black box it would not be really helpful since I would like to know if it is efficient with respect to the number of qubit or not. $\endgroup$
    – stopper
    Nov 24, 2021 at 18:10
  • 1
    $\begingroup$ The paper Synthesis of Quantum Logic Circuits may be what you are looking for $\endgroup$
    – epelaez
    Nov 24, 2021 at 18:42

1 Answer 1


If you initial state is $| 0\dots0\rangle$ and your final state is $|\psi\rangle$, than it is trivial to come up with some unitary matrix $U$, which preforms such transformation (it's first column will be equal to the coeficients of $|\psi\rangle$ in computational basis).

Later $U$ can be decomposed in no more than $n$ unitary matrices $U'_i$, each of which acts non-trivially only on two basis vectors.

Each $U'_i$ can be decomposed in no more than $n$ matrices $U''_i$, each of which acts non-trivially only on two qubits. (see the Gray's encoding)

$U''_i$ is a tensor product of $n-2$ identity matrices and an arbitrary two-qubit gate.

It can be proven that an arbitrary two qubit gate can be constructed with CNOT and arbitrary one-qubit gates.

Any arbitrary one-qubit gate is rotation on the Bloch sphere. It can be approximated with only H, S and T gates.

Disclaimer: I should mention that it is not an optimal solution, for arbitrary $U$ this can lead to $O(2^n)$ number of gates.

  • $\begingroup$ Thank you, what's the state of the art for decomposition of unitaries? Are there algorithms that in some cases do It efficiently? $\endgroup$
    – stopper
    Nov 26, 2021 at 17:38
  • 1
    $\begingroup$ For arbitrary unitaries this is (AFAIK) the state of the art. It is a interesting question, what constrains should we apply to unitary matrix, so it is possible to decompose it effectively. $\endgroup$
    – totikom
    Nov 27, 2021 at 8:44

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.