Introduction

Over several decades, the search for quantum algorithms with efficient quantum circuit implementations has resulted in numerous theoretical and technological advancements1,2,3,4,5,6,7,8,9,10,11,12,13,14. Notable quantum algorithms with the potential to outperform classical algorithms include: the phase estimation algorithm15, Shor’s factorization algorithm16, the Harrow-Hassidim-Lloyd algorithm for linear systems17, the hybrid classical-quantum algorithms18,19, the quantum machine learning algorithms20,21,22, and quantum algorithms for open quantum dynamics23,24,25. Despite the expansive selection of ideas, most existing quantum algorithms are either discovered accidentally or adapted from classical algorithms, and a systematic way to understand and design quantum algorithms with efficient quantum circuit implementation is currently lacking. Considering the enormous search space of quantum circuits, we need a general theory to classify all quantum circuits and states, and then study their behaviors based on the classification. To this end, we have previously proposed a theory to classify all quantum circuits of a given length into finite types based on the “qubit functional configuration”26.

In this work we develop a “unitary dependence theory” to characterize the behaviors of quantum circuits and states in terms of how quantum gates manipulate qubits and determine their measurement probabilities. Any quantum circuit can be decomposed into a sequence of elementary gates that include 1-qubit unitaries and 2-qubit CNOT gates. The initial state is transformed by the circuit into the final state which then undergoes projection measurements in the computational basis \(\{|0\rangle ,|1\rangle \}\). The probability of measuring \(|0\rangle\) versus \(|1\rangle\) on each qubit then determines the measurement statistics of the final state which can be used to characterize the behavior of the quantum circuit and the final state. In this work we study how the probabilities of measuring each qubit are affected by elementary gates. The basic rules are: 1. a 1-qubit unitary \({U}_{k}\) makes the target qubit \({q}_{k}\)’s measurement probabilities depend on \({U}_{k}\); 2. a CNOT gate \(C{X}_{j\to k}\) copies all the control qubit \({q}_{j}\)’s dependences to the target qubit \({q}_{k}\). By these rules, each qubit \({q}_{k}\) at the final state has its own collection of dependences that may be created on itself by some \({U}_{k}\) or copied to it from other qubits by some CNOT gates. While a dependence may be copied from other qubits, it must have been created by some \({U}_{i}\) on another qubit \({q}_{i}\) – i.e., any given dependence can be traced back to the original 1-qubit unitary that has created it in the first place – therefore a complete unitary dependence picture of which qubit depends on which 1-qubit unitaries can be drawn by analyzing the gate sequence of a quantum circuit. The dependence picture carries important information that helps us understand the behaviors of quantum circuits. For example, if two qubits share dependences on some 1-qubit unitaries, then their measurement probabilities must be dependent; while if they do not share any dependence, their measurement probabilities must be independent. From the circuit design perspective, varying the parameters of a 1-qubit unitary shared by multiple qubits allows us to manipulate the measurement probabilities of all involved qubits together; while qubit-specific manipulations have to be implemented with 1-qubit unitaries that are unique to the particular qubit. The dependence picture is a new perspective for characterizing quantum circuits and states because it is distinct from the conventional way of using entanglement as a descriptor of complexity27. Compared to the abstract formalism of multi-qubit entanglement28,29,30, the dependence picture offers more practical information on the measurement and manipulation of qubits, easier generalization to many-qubit systems, and better robustness upon partitioning of the system. Furthermore, in a deeper discussion of the unitary dependence theory, we find that under certain conditions the dependences originated from the same unitary source can cancel when duplicated on the same qubit, which reduces complexity and simplifies the dependence picture. Interestingly, in studying the cancellability of dependences, we find that entanglement can protect the cancellability from getting broken by local 1-qubit unitaries, and thus an intricate relation between the unitary dependence and entanglement exists. Finally the theory has been applied to the widely-used hardware-efficient ansatz31,32,33,34 to demonstrate its ability to characterize the behaviors of different ansatzes in variational quantum algorithms.

In summary, we propose a unitary dependence theory to characterize quantum circuits and states in terms of how quantum gates manipulate qubits and determine their measurement probabilities. A complete unitary dependence picture can be generated by analyzing the gate sequence of a quantum circuit. The theory has several advantages over the conventional entanglement description of quantum circuits and states, and can be applied to systematically understand existing quantum circuits and design new quantum algorithms.

Results and discussion

Basic rules for the creation and copying of unitary dependences

The core idea of quantum computing is to use a small number of qubits to perform computation on the state space of a huge dimension that scales exponentially with the qubit number n. Qubits are therefore the fundamental targets for quantum gates and measurements. Thus to develop a theory to systematically understand quantum circuits we need to focus on how quantum gates affect qubits. Any arbitrary quantum circuit takes in an initial input state, applies a sequence of elementary gates to transform it into a final state, and then measures all or selective qubits in the computational basis. Without loss of generality, we start with the simplest 3-qubit initial state \({|000\rangle }_{123}\) (where the subscripts 123 denote the qubit number identifiers), then all three qubits start with probability 1 for measuring \(|0\rangle\). Now if we apply an arbitrary 1-qubit unitary \({U}_{1}({a}_{1},{a}_{2},\alpha )=(\begin{array}{cc}{a}_{1} & {a}_{2}^{\ast }{e}^{i\alpha }\\ {a}_{2} & -{a}_{1}^{\ast }{e}^{i\alpha }\end{array})\) (with \({|{a}_{1}|}^{2}+{|{a}_{2}|}^{2}=1\)) to \({q}_{1}\) then the state becomes \(({a}_{1}{|0\rangle }_{1}+{a}_{2}{|1\rangle }_{1})\otimes {|00\rangle }_{23}\) and measuring \({q}_{1}\) will yield the probabilities \(p({|0\rangle }_{1})={|{a}_{1}|}^{2}\) and \(p({|1\rangle }_{1})={|{a}_{2}|}^{2}\):

Definition 1: The situation that the probabilities of measuring a qubit \({q}_{k}\) depend on the parameters of a 1-qubit unitary \({U}_{k}\) is defined as “\({q}_{k}\) has acquired the dependence on \({U}_{k}\)” or alternatively “\({U}_{k}\)’s dependence has been created on \({q}_{k}\)”.

By the definition \({q}_{1}\) has acquired the dependence on \({U}_{1}({a}_{1},{a}_{2},\alpha )\) in the above example. Note in this particular example the phase \(\alpha\) has no obvious effect on \(p({|0\rangle }_{1})\) or \(p({|1\rangle }_{1})\), but in general it may affect the probabilities in certain cases. Now if we apply another 1-qubit unitary \({U}_{2}({b}_{1},{b}_{2},\beta )=(\begin{array}{cc}{b}_{1} & {b}_{2}^{\ast }{e}^{i\beta }\\ {b}_{2} & -{b}_{1}^{\ast }{e}^{i\beta }\end{array})\) (with \({|{b}_{1}|}^{2}+{|{b}_{2}|}^{2}=1\)) to \({q}_{2}\) then the state becomes \(({a}_{1}{|0\rangle }_{1}+{a}_{2}{|1\rangle }_{1})\otimes ({b}_{1}{|0\rangle }_{2}+{b}_{2}{|1\rangle }_{2})\otimes {|0\rangle }_{3}\), and \({q}_{2}\) has acquired the dependence on \({U}_{2}({b}_{1},{b}_{2},\beta )\). Now if we apply the CNOT gate \(C{X}_{1\to 2}\) with the subscript \(1\to 2\) meaning \({q}_{1}\) is the control and \({q}_{2}\) is the target, then the state becomes \([{a}_{1}{|0\rangle }_{1}\otimes ({b}_{1}{|0\rangle }_{2}+{b}_{2}{|1\rangle }_{2})+{a}_{2}{|1\rangle }_{1}\otimes ({b}_{2}{|0\rangle }_{2}+{b}_{1}{|1\rangle }_{2})]\otimes {|0\rangle }_{3}\), and now measuring \({q}_{2}\) will yield \(p({|0\rangle }_{2})={|{a}_{1}{b}_{1}|}^{2}+{|{a}_{2}{b}_{2}|}^{2}\): we see that the probabilities of measuring \({q}_{2}\) now depend on \({U}_{1}({a}_{1},{a}_{2},\alpha )\) too and thus \({q}_{2}\) has acquired the dependence on \({U}_{1}({a}_{1},{a}_{2},\alpha )\) through \(C{X}_{1\to 2}\). It is obvious that the control qubit \({q}_{1}\) is unaffected by \(C{X}_{1\to 2}\). Next if we apply another CNOT gate \(C{X}_{2\to 3}\), then the state becomes \(({a}_{1}{b}_{1}{|0\rangle }_{1}+{a}_{2}{b}_{2}{|1\rangle }_{1}){|00\rangle }_{23}+({a}_{1}{b}_{2}{|0\rangle }_{1}+{a}_{2}{b}_{1}{|1\rangle }_{1}){|11\rangle }_{23}\), and measuring \({q}_{3}\) will yield \(p({|0\rangle }_{3})={|{a}_{1}{b}_{1}|}^{2}+{|{a}_{2}{b}_{2}|}^{2}\) such that \({q}_{3}\) has acquired all the dependences on \({q}_{2}\) – both \({U}_{1}({a}_{1},{a}_{2},\alpha )\) and \({U}_{2}({b}_{1},{b}_{2},\beta )\) – through \(C{X}_{2\to 3}\). To summarize the entire process, we started with \({|000\rangle }_{123}\) having no dependence on any 1-qubit unitary for any qubit, created \({U}_{1}({a}_{1},{a}_{2},\alpha )\)’s dependence on \({q}_{1}\), created \({U}_{2}({b}_{1},{b}_{2},\beta )\)’s dependence on \({q}_{2}\), copied \({q}_{1}\)’s dependence to \({q}_{2}\) by \(C{X}_{1\to 2}\), and copied \({q}_{2}\)’s dependences to \({q}_{3}\) by \(C{X}_{2\to 3}\).

Figure 1 shows the entire process of dependence creation by 1-qubit unitaries and copying by CNOT gates. At each step, the dependence picture is illustrated by a Venn diagram that clearly shows how the unitary dependences are shared by the qubits. At the final Step 3 we have \({U}_{2}({b}_{1},{b}_{2},\beta )\) shared by \({q}_{2}\) and \({q}_{3}\), and \({U}_{1}({a}_{1},{a}_{2},\alpha )\) shared by all three qubits. The dependence picture clearly tells us that the probabilities of all three qubits are dependent such that they cannot be considered independent random variables when measured. Furthermore, changing the parameters \({a}_{1}\) and \({a}_{2}\) of \({U}_{1}({a}_{1},{a}_{2},\alpha )\) will modify the probabilities of all three qubits, while changing \({b}_{1}\) and \({b}_{2}\) of \({U}_{2}({b}_{1},{b}_{2},\beta )\) will modify only \({q}_{2}\) and \({q}_{3}\). As there is no 1-qubit unitary unique to any qubit, in this circuit we cannot specifically modify a single qubit by changing the parameters of either \({U}_{1}({a}_{1},{a}_{2},\alpha )\) or \({U}_{2}({b}_{1},{b}_{2},\beta )\).

Fig. 1: The creation and copying of unitary dependences.
figure 1

The figure shows the unitary dependence creation by 1-qubit unitaries and copying by CNOT gates. The state at each step is described by a Venn diagram that shows how unitary dependences are shared among the qubits. The unitary dependences are created by the 1-qubit unitaries \({U}_{1}={U}_{1}({a}_{1},{a}_{2},\alpha )=(\begin{array}{cc}{a}_{1} & {a}_{2}^{\ast }{e}^{i\alpha }\\ {a}_{2} & -{a}_{1}^{\ast }{e}^{i\alpha }\end{array})\) (with \({|{a}_{1}|}^{2}+{|{a}_{2}|}^{2}=1\)) and \({U}_{2}={U}_{2}({b}_{1},{b}_{2},\beta )=(\begin{array}{cc}{b}_{1} & {b}_{2}^{\ast }{e}^{i\beta }\\ {b}_{2} & -{b}_{1}^{\ast }{e}^{i\beta }\end{array})\) (with \({|{b}_{1}|}^{2}+{|{b}_{2}|}^{2}=1\)). Then the dependences are copied by the CNOT gates \(C{X}_{1\to 2}\) and \(C{X}_{2\to 3}\) to the appropriate qubits. At the final Step 3 we have \({U}_{2}\) shared by \({q}_{2}\) and \({q}_{3}\), and \({U}_{1}\) shared by all three qubits.

Having seen a simple 3-qubit example, next we propose the rules for a general n-qubit system that:

Rule 1: A 1-qubit unitary \({U}_{k}\) applied to the qubit \({q}_{k}\) creates its dependence on \({q}_{k}\) only;

Rule 2: A CNOT gate \(C{X}_{j\to k}\) copies all the control qubit \({q}_{j}\)’s dependences to the target qubit \({q}_{k}\).

A special case of Rule 1 has been proven in Theorem 1 of our previous quantum encryption study35 for real parameters in unitaries and states. Below we generalize the proof to complex parameters:

Proof for Rule 1: An arbitrary n-qubit state can be written as the Schmidt decomposition form with respect to any given \({q}_{k}\):

$$|{\phi }^{(n)}\rangle ={C}_{1}|{\phi }_{1}^{(n-1)}\rangle ({a}_{1}{|0\rangle }_{k}+{a}_{2}{|1\rangle }_{k})+{C}_{2}|{\phi }_{2}^{(n-1)}\rangle ({a}_{2}^{\ast }{|0\rangle }_{k}-{a}_{1}^{\ast }{|1\rangle }_{k}){e}^{i\alpha }$$
(1)

where \(|{\phi }_{1}^{(n-1)}\rangle\) and \(|{\phi }_{2}^{(n-1)}\rangle\) are orthogonal \((n-1)\)-qubit states that exclude \({q}_{k}\), \({C}_{1}\) and \({C}_{2}\) are non-negative real numbers satisfying \({|{C}_{1}|}^{2}+{|{C}_{2}|}^{2}=1\), \({a}_{1}\) and \({a}_{2}\) are complex numbers satisfying \({|{a}_{1}|}^{2}+{|{a}_{2}|}^{2}=1\). Clearly the probability of measuring \(|0\rangle\) on \({q}_{k}\) is \(p({|0\rangle }_{k})={|{C}_{1}{a}_{1}|}^{2}+{|{C}_{2}{a}_{2}|}^{2}\) and thus we may generalize the definition of unitary dependence to say that \({q}_{k}\) has the dependences on the two pairs of coefficients \(({C}_{1},{C}_{2})\) and \(({a}_{1},{a}_{2})\). Both \(({C}_{1},{C}_{2})\) and \(({a}_{1},{a}_{2})\) can include the dependences of many 1-qubit unitaries that were used to create \(|{\phi }^{n}\rangle\). However, because \(|{\psi }_{1}\rangle ={a}_{1}{|0\rangle }_{k}+{a}_{2}{|1\rangle }_{k}\) and \(|{\psi }_{2}\rangle =({a}_{2}^{\ast }{|0\rangle }_{k}-{a}_{1}^{\ast }{|1\rangle }_{k}){e}^{i\alpha }\) are orthogonal, \(({a}_{1},{a}_{2})\) is a “local dependence” that only applies to \({q}_{k}\) while \(({C}_{1},{C}_{2})\) is a “shared dependence” that \({q}_{k}\) may share with other qubits. Now if we apply \({U}_{k}=(\begin{array}{cc}{u}_{1} & {u}_{2}^{\ast }{e}^{i\theta }\\ {u}_{2} & -{u}_{1}^{\ast }{e}^{i\theta }\end{array})\) on \({q}_{k}\), as \(|{U}_{k}{\psi }_{1}\rangle\) is always orthogonal to \(|{U}_{k}{\psi }_{2}\rangle\), the dependence on \({U}_{k}\) will be added to the local dependence and thus only \({q}_{k}\) will acquire it. This proves Rule 1 that a 1-qubit unitary \({U}_{k}\) applied to the qubit \({q}_{k}\) creates its dependence on \({q}_{k}\) only.

Proof for Rule 2: The action of a CNOT gate \(C{X}_{j\to k}\) is to keep \({q}_{k}\) intact when \({q}_{j}=|0\rangle\) and bit-flip \({q}_{k}\) if \({q}_{j}=|1\rangle\) – this effectively calculates the binary sum \({q}_{k}\oplus {q}_{j}\) and stores its value on \({q}_{k}\)26,36,37,38,39. When we measure \({q}_{k}\) after \(C{X}_{j\to k}\), the probabilities of getting \(|0\rangle\) and \(|1\rangle\) are actually the probabilities of getting \({q}_{k}\oplus {q}_{j}=0\) and \({q}_{k}\oplus {q}_{j}=1\), thus all the 1-qubit unitaries that affect \({q}_{j}\)’s measurement probabilities will now also affect \({q}_{k}\)’s probabilities after \(C{X}_{j\to k}\). In the meanwhile, it is obvious that \({q}_{j}\)’s measurement probabilities are not affected by \(C{X}_{j\to k}\). Therefore Rule 2 has been proven that “A CNOT gate \(C{X}_{j\to k}\) copies all the control qubit \({q}_{j}\)’s dependences to the target qubit \({q}_{k}\)”.

The unitary dependence theory allows us to generate dependence pictures as illustrated by the Venn diagrams in Fig. 1. The dependence picture of a quantum circuit or state provides two important pieces of information that characterize its behaviors. The first piece is how the measurement probabilities of qubits depend on each other in the output state. If multiple qubits share dependences on a certain collection of 1-qubit unitaries, their measurement results will behave as dependent random variables; if multiple qubits do not share any unitary dependences, their measurement results will behave as independent random variables. The dependence picture thus allows us to characterize the measurement statistics of the output state, which is an important property of a quantum circuit or state9. The second piece is how the qubits can be manipulated together by varying parameters of the shared 1-qubit unitaries. If a 1-qubit unitary is shared by multiple qubits, varying its parameters can change the measurement probabilities of all involved qubits together, thus allowing collective manipulations of subgroups of qubits. On the other hand, if the manipulation of an individual qubit is needed, then the qubit must have 1-qubit unitaries not shared by any other qubits. This is a design principle that can guide the development of e.g., parameterized quantum circuits18,27,40,41 where circuits and ansatz states are tested by varying gate parameters.

Advantages over the entanglement description of quantum circuits and states

The unitary dependence theory and the dependence picture are distinct from the conventional way of using entanglement to understand quantum circuits and states. In this section we detail the differences between the two theories and show the advantages of the dependence picture over the entanglement description.

Entanglement is an important subject in quantum physics that demonstrates quantum-only features that have no classical equivalent. However, from the perspective of quantum circuit design, entanglement is too abstract and not easily connected to the practicalities discussed above on how qubits are related in manipulations and measurement probabilities. To see this, consider the state:

$$|\psi \rangle =({a}_{1}{|00\rangle }_{12}+{a}_{2}{|11\rangle }_{12})\otimes {b}_{1}{|0\rangle }_{3}+({a}_{1}{|01\rangle }_{12}+{a}_{2}{|10\rangle }_{12})\otimes {b}_{2}{|1\rangle }_{3}$$
(2)

where \({a}_{1}\), \({a}_{2}\), \({b}_{1}\), \({b}_{2}\) are complex numbers satisfying \({|{a}_{1}|}^{2}+{|{a}_{2}|}^{2}=1\) and \({|{b}_{1}|}^{2}+{|{b}_{2}|}^{2}=1\). In \(|\psi \rangle\), \({q}_{1}\) and \({q}_{3}\) are considered entangled because there is no separable way to write the two qubits as a product state. However, by simple inspection we have \(p({|0\rangle }_{1})={|{a}_{1}|}^{2}\) and \(p({|0\rangle }_{3})={|{b}_{1}|}^{2}\) – i.e., \({q}_{1}\) only has dependence on the pair \(({a}_{1},{a}_{2})\) while \({q}_{3}\) only has dependence on the pair \(({b}_{1},{b}_{2})\) – which means \({q}_{1}\) and \({q}_{3}\) have independent measurement probabilities and can be manipulated separately. So the entanglement picture fails to characterize the relation between \({q}_{1}\) and \({q}_{3}\). In the meanwhile, by the unitary dependence theory, \(|\psi \rangle\) is created by the process shown in Fig. 2 and the relation between \({q}_{1}\) and \({q}_{3}\) can be easily seen in the Venn diagram.

Fig. 2: The case of entangled qubits not sharing any unitary dependence.
figure 2

The figure shows the creation process of \(|\psi \rangle\) and the final unitary dependence picture represented by a Venn diagram. \({U}_{1}={U}_{1}({a}_{1},{a}_{2},\alpha )=(\begin{array}{cc}{a}_{1} & {a}_{2}^{\ast }{e}^{i\alpha }\\ {a}_{2} & -{a}_{1}^{\ast }{e}^{i\alpha }\end{array})\) (with \({|{a}_{1}|}^{2}+{|{a}_{2}|}^{2}=1\)) and \({U}_{3}={U}_{3}({b}_{1},{b}_{2},\beta )=(\begin{array}{cc}{b}_{1} & {b}_{2}^{\ast }{e}^{i\beta }\\ {b}_{2} & -{b}_{1}^{\ast }{e}^{i\beta }\end{array})\) (with \({|{b}_{1}|}^{2}+{|{b}_{2}|}^{2}=1\)) are 1-qubit unitaries applied to \({q}_{1}\) and \({q}_{3}\) respectively. From the final unitary dependence picture we see \({q}_{1}\) and \({q}_{3}\) do not share any 1-qubit unitaries and thus are independent in measurement probabilities. However \({q}_{1}\) and \({q}_{3}\) are entangled, thus the unitary dependence picture provides a different perspective from the entanglement description.

In Fig. 2, we have \({U}_{1}({a}_{1},{a}_{2},\alpha )\) shared by \({q}_{1}\) and \({q}_{2}\), and \({U}_{3}({b}_{1},{b}_{2},\beta )\) shared by \({q}_{2}\) and \({q}_{3}\), therefore \({q}_{1}\) and \({q}_{3}\) share no 1-qubit unitaries and are independent for both measurement and manipulation. This example clearly shows the dependence picture is fundamentally different from the entanglement picture because two entangled qubits may have no shared dependence and thus are considered to be independent by the dependence theory.

Using entanglement to describe quantum circuits and states can become more confusing when considering multiple-qubit systems where many different measures and theories for multipartite entanglement exist28,29,30. For example, for a 3-qubit system there are the Greenberger–Horne–Zeilinger (GHZ) state \(|GHZ\rangle =\frac{1}{\sqrt{2}}(|000\rangle +|111\rangle )\) and the W state \(|W\rangle =\frac{1}{\sqrt{3}}(|001\rangle +|010\rangle +|100\rangle )\), which are well-known to be different and can be explained by various multipartite entanglement measures28,29,30. However, most multipartite entanglement measures generate some numbers for fixed values of parameters and thus cannot characterize parameterized quantum circuits and states: e.g., \({a}_{1}|000\rangle +{a}_{2}|111\rangle\) will produce different values of the von Neumann entropy, given different values for \({a}_{1}\) and \({a}_{2}\). In the meanwhile the dependence picture is naturally suited to the ideas of using finite structures with varying parameters to characterize large collections of quantum circuits and states together:26,42 e.g., \({a}_{1}|000\rangle +{a}_{2}|111\rangle\) can be described by one simple Venn diagram in Fig. 3.

Fig. 3: The dependence picture of the GHZ-like state.
figure 3

The figure shows the creation circuit of the GHZ-like state and the Venn diagram of the unitary dependence picture. \({U}_{1}={U}_{1}({a}_{1},{a}_{2},\alpha )=(\begin{array}{cc}{a}_{1} & {a}_{2}^{\ast }{e}^{i\alpha }\\ {a}_{2} & -{a}_{1}^{\ast }{e}^{i\alpha }\end{array})\) is a 1-qubit unitary applied to \({q}_{1}\). When the parameters satisfy \({a}_{1}={a}_{2}=\frac{1}{\sqrt{2}}\) the state becomes the GHZ state.

Although there is a theory to generalize the GHZ state and W state into the GHZ class and W class29, the process of determining the class for an arbitrary state involves calculating the determinants of all the possible bipartite reduced density matrices and then the 3-tangle:28,29 this is a very complex process and more importantly not describing the qubit relation in measurement and manipulation. For example, it is not obvious whether the state \(|\psi \rangle\) in Eq. (2) belongs to the GHZ or W class, and even if we can determine its class, it has a dependence picture (see Fig. 2) distinct from both the GHZ and W classes in Figs. 3 and 4 such that the entanglement class does not describe the qubit relation of interest in the current study. On the other hand the dependence pictures in Figs. 2, 3, and  4 clearly show the differences between the three states by illustrating the relation of qubits in manipulation and measurement. Furthermore, when the number of qubits increases beyond 3, the number of possible entanglement classes becomes infinite and there is no practical way to determine the class for an arbitrary state29. On the other hand, no matter how many qubits there are, the dependence picture can always be easily generated by going through the gate sequence associated with any quantum circuit or state, one gate at a time. So as long as the gate count is polynomial the process of determining the dependence picture is polynomial. When the number of qubits increases it may be difficult to draw the Venn diagram, but the dependence picture can still be easily described by listing the qubits with the unitary dependences they have, and listing the 1-qubit unitaries with the qubits they belong to. For example, the W state dependence picture in Fig. 4 can be alternatively described by

$$\begin{array}{cc} & {{{{{\rm{The}}}}}}\,{{{{{\rm{W}}}}}}\,{{{{{\rm{state}}}}}}\,{{{{{\rm{unitary}}}}}}\,{{{{{\rm{dependence}}}}}}\,{{{{{\rm{description}}}}}}\hfill\\ {{{{{\rm{by}}}}}}\,{{{{{\rm{qubits}}}}}} \hfill& \left(\right.{q}_{1}:\{{R}_{y}({\theta }_{1}),X\},\,{q}_{2}:\{{R}_{y}({\theta }_{1}),{R}_{y}({\theta }_{2}),{R}_{y}({\theta }_{3})\},\hfill\\ &\;{q}_{3}:\{{R}_{y}({\theta }_{1}),{R}_{y}({\theta }_{2}),{R}_{y}({\theta }_{3})\}\left.\right)\hfill\\ {{{{{\rm{by}}}}}}\,1-{{{{{\rm{qubit}}}}}}\,{{{{{\rm{unitaries}}}}}} & \left(\right.{R}_{y}({\theta }_{1}):\{{q}_{1},{q}_{2},{q}_{3}\},\,{R}_{y}({\theta }_{2}):\{{q}_{2},{q}_{3}\},\,X:\{{q}_{1}\},\\ &\;\,{R}_{y}({\theta }_{3}):\{{q}_{2},{q}_{3}\}\left.\right)\hfill\end{array}$$
(3)

and this description always works for systems with more qubits.

Fig. 4: The dependence picture of the W state.
figure 4

The figure shows the creation circuit of the W state and the Venn diagram of the dependence picture. The gates and the parameters are defined as: \({R}_{y}(\theta )=(\begin{array}{cc}\cos \frac{\theta }{2} & -\,\sin \frac{\theta }{2}\\ \sin \frac{\theta }{2} & \cos \frac{\theta }{2}\end{array})\), \({\theta }_{1}=2\arccos (\frac{1}{\sqrt{3}})\), \({\theta }_{2}=-{\theta }_{3}=\frac{\pi }{4}\).

When studying the behavior of quantum circuits and states involving many qubits, there are often cases where we want to temporarily focus on a subset of qubits and treat the other qubits as an averaging background. For entanglement, the qubits that are considered entangled in the total system may become unentangled in the subsystem. For example, the GHZ-like entangled state \({a}_{1}|000\rangle +{a}_{2}|111\rangle\) will become the reduced density matrix \(\rho ={a}_{1}|00\rangle \langle 00|+{a}_{2}|11\rangle \langle 11|\) when any one of the qubits is removed, and this is clearly an unentangled (separable) mixed state43. This shows that entanglement is sensitive to how we partition the space into subsets of qubits. On the other hand, the dependence picture is robust regardless how we partition the space as we can take the Venn diagrams or the descriptions like in Eq. (3), remove all the unwanted qubits, and the remaining parts will describe the correct relations among the qubits of interest. Again using the example of \({a}_{1}|000\rangle +{a}_{2}|111\rangle\) shown in Fig. 3, removing any one of the qubits will remove one circle from the Venn diagram, which does not change the relation between the two remaining circles: sharing \({U}_{1}\), therefore the relation between the two remaining qubits stays the same in the absence of the removed qubit. This illustrates the fact that the dependences of qubits on 1-qubit unitaries are more robust physical properties that are invariant upon partitioning of the system, while the concept of entanglement is less robust that may change upon partitioning of the system.

The dependence canceling rule and the application to analyzing the hardware-efficient ansatzes

Having seen the basic rules of dependence creation and copying in the “Basic rules for the creation and copying of unitary dependences” subsection in the “Results and Discussion”, next we discuss the situation where dependences originated from the same unitary source can cancel when duplicated on the same qubit. In the simplest case, \(C{X}_{1\to 2}\) copies all dependences of \({q}_{1}\) to \({q}_{2}\), and another \(C{X}_{1\to 2}\) will attempt to copy all the same dependences again from \({q}_{1}\) to \({q}_{2}\). As \(C{X}_{1\to 2}\) is its own inverse, the 2nd \(C{X}_{1\to 2}\) thus cancels all dependences copied by the 1st \(C{X}_{1\to 2}\). A more interesting case happens when the dependence originated from the same unitary source is received from different qubits. For example, consider the 3-qubit state:

$$({a}_{1}{|0\rangle }_{1}+{a}_{2}{|1\rangle }_{1})\otimes ({b}_{1}{|0\rangle }_{2}+{b}_{2}{|1\rangle }_{2})\otimes ({c}_{1}{|0\rangle }_{3}+{c}_{2}{|1\rangle }_{3})$$
(4)

which starts with \({q}_{1}\) depending on \(({a}_{1},{a}_{2})\), \({q}_{2}\) depending on \(({b}_{1},{b}_{2})\), \({q}_{3}\) depending on \(({c}_{1},{c}_{2})\). Now if we apply \(C{X}_{2\to 1}\) and \(C{X}_{2\to 3}\), it becomes:

$$({a}_{1}{|0\rangle }_{1}+{a}_{2}{|1\rangle }_{1})\otimes {b}_{1}{|0\rangle }_{2}\otimes ({c}_{1}{|0\rangle }_{3}+{c}_{2}{|1\rangle }_{3})+({a}_{2}{|0\rangle }_{1} \\ + {a}_{1}{|1\rangle }_{1})\otimes {b}_{2}{|1\rangle }_{2}\otimes ({c}_{2}{|0\rangle }_{3}+{c}_{1}{|1\rangle }_{3})$$
(5)

where \({q}_{1}\) and \({q}_{3}\) have both acquired dependence on \(({b}_{1},{b}_{2})\). Now if we apply \(C{X}_{1\to 3}\), then the state becomes:

$$\begin{array}{c}{|0\rangle }_{1}\otimes [{a}_{1}{b}_{1}{|0\rangle }_{2}\otimes ({c}_{1}{|0\rangle }_{3}+{c}_{2}{|1\rangle }_{3})+{a}_{2}{b}_{2}{|1\rangle }_{2}\otimes ({c}_{2}{|0\rangle }_{3}+{c}_{1}{|1\rangle }_{3})]\\ +{|1\rangle }_{1}\otimes [{a}_{2}{b}_{1}{|0\rangle }_{2}\otimes ({c}_{2}{|0\rangle }_{3}+{c}_{1}{|1\rangle }_{3})+{a}_{1}{b}_{2}{|1\rangle }_{2}\otimes ({c}_{1}{|0\rangle }_{3}+{c}_{2}{|1\rangle }_{3})]\end{array}$$
(6)

where \({q}_{3}\) has lost the dependence on \(({b}_{1},{b}_{2})\) because after some algebra we find that \(p({|0\rangle }_{3})={|{a}_{1}{c}_{1}|}^{2}+{|{a}_{2}{c}_{2}|}^{2}\). Here the effect of \(C{X}_{1\to 3}\) is attempting to copy both \(({a}_{1},{a}_{2})\) and \(({b}_{1},{b}_{2})\) dependences from \({q}_{1}\) to \({q}_{3}\), however because \({q}_{3}\) has already received \(({b}_{1},{b}_{2})\) from \({q}_{2}\), receiving the same dependence again from \({q}_{1}\) will duplicate and cancel it on \({q}_{3}\). Here we propose the general canceling rule of unitary dependences.

Definition 2: Multiple dependences are considered “the same” if they are copied from the same qubit \({q}_{i}\) by some CNOT gates and there are no 1-qubit unitaries in between these CNOT gates. Furthermore, these dependences stay the same no matter how many times they are copied by more CNOT gates and which qubits they are on, as long as there are no 1-qubit unitaries applied.

Rule 3: If a qubit \({q}_{k}\) receives the same dependence twice, it will lose (cancel) that dependence.

Proof for Rule 3: As discussed in the proof for Rule 2, \(C{X}_{i\to j}\) calculates the binary sum \({q}_{i}\oplus {q}_{j}\) and stores its value on \({q}_{j}\), and if we next apply e.g., \(C{X}_{j\to k}\) then it calculates the binary sum \({q}_{i}\oplus {q}_{j}\oplus {q}_{k}\) and stores its value on \({q}_{k}\). Note as long as there are no 1-qubit unitaries and only CNOTs, we can continue to perform such binary additions with more CNOT gates, so as to update the current “configuration” represented by an account of the current value held by each qubit. This process can be clearly described by the “qubit functional configuration” (QFC) where we start with the initial QFC (for details of the QFC theory please see the original study26):

$$({f}_{1}={q}_{1},{f}_{2}={q}_{2},{f}_{3}={q}_{3}{{{{\mathrm{..}}}}}.,{f}_{n}={q}_{n})$$
(7)

for which each \({f}_{k}\) (i.e., the qubit functional on \({q}_{k}\)) represents the current value stored on the corresponding qubit \({q}_{k}\). Now if we apply e.g., \(C{X}_{1\to 2}\), we update \({f}_{2}\) to be \({f}_{2}={q}_{1}\oplus {q}_{2}\) with other \({f}_{k}\) intact so the QFC becomes:

$$({f}_{1}={q}_{1},{f}_{2}={q}_{1}\oplus {q}_{2},{f}_{3}={q}_{3}{{{{\mathrm{..}}}}}.,{f}_{n}={q}_{n})$$
(8)

Now if we apply another CNOT gate e.g., \(C{X}_{2\to 3}\), we update \({f}_{3}\) to be \({f}_{3}={q}_{1}\oplus {q}_{2}\oplus {q}_{3}\) and the QFC becomes:

$$({f}_{1}={q}_{1},{f}_{2}={q}_{1}\oplus {q}_{2},{f}_{3}={q}_{1}\oplus {q}_{2}\oplus {q}_{3}{{{{\mathrm{..}}}}}.,{f}_{n}={q}_{n})$$
(9)

where we see that although \({q}_{1}\) has not directly interacted with \({q}_{3}\), it has nonetheless been connected to \({q}_{3}\) by the two CNOT gates and the connection is clear from the QFC where \({f}_{1}\) and \({f}_{3}\) share the same component of \({q}_{1}\). Here we notice the interesting fact that, the connection of \({f}_{1}\) and \({f}_{3}\) sharing the same component of \({q}_{1}\) also means \({q}_{1}\) and \({q}_{3}\) sharing the dependences that already exist on \({q}_{1}\) before the \(C{X}_{1\to 2}\) gate. This is clear because by Rule 2 above, \(C{X}_{1\to 2}\) copies all dependence from \({q}_{1}\) to \({q}_{2}\), and then \(C{X}_{2\to 3}\) copies all dependence from \({q}_{2}\) to \({q}_{3}\) – we see that the process of the qubit functionals getting updated by some CNOT gates is essentially the same as the process of the unitary dependences getting copied by the same CNOT gates. In other words, take Eq. (9) as an example, \({f}_{2}={q}_{1}\oplus {q}_{2}\) means \({q}_{2}\) shares the dependences initially on \({q}_{1}\), while \({f}_{3}={q}_{1}\oplus {q}_{2}\oplus {q}_{3}\) means \({q}_{3}\) shares the dependences initially on \({q}_{1}\) and \({q}_{2}\). With the equivalence between the two processes understood, it becomes clear why duplicated dependences get canceled: no matter from which qubit \({q}_{k}\) receives the 1st copy of \({q}_{i}\)’s initial dependences, its corresponding functional \({f}_{k}\) now has \({q}_{i}\) as a component, and then the attempt to add a 2nd copy of \({q}_{i}\)’s initial dependences will add \({q}_{i}\) to \({f}_{k}\) again, and this cancels \({q}_{i}\) on \({f}_{k}\) because \({q}_{i}\oplus {q}_{i}=0\). In addition, it also becomes clear why the canceling requires the condition of no 1-qubit unitaries, because only then can we stay in the same QFC addition process or as described in the original QFC study26 “in the same QFC layer”, while any 1-qubit unitary will require the QFC getting reset to the initial configuration. In terms of the unitary dependence theory, if \({q}_{k}\) receives the 1st copy of \({q}_{i}\)’s dependences from \({q}_{j}\) after a 1-qubit unitary \({U}_{j}\) on \({q}_{j}\), the dependences could be modified by \({U}_{j}\) such that they are no longer the same as the initial ones. Now when \({q}_{k}\) receives the 2nd copy from \({q}_{h}\) before any 1-qubit unitary \({U}_{h}\) on \({q}_{h}\), then this copy stays the same as the initial one, thus the two copies of dependences are not the same and may not cancel. This concludes the proof for Rule 3.

The QFC description of quantum circuits and states not only helps us prove Rule 3, but can also be useful for identifying connections between qubits with no apparent interactions. In Definition 2 we have the fact that “dependences stay the same no matter how many times they are copied by more CNOT gates and which qubits they are on, as long as there are no 1-qubit unitaries applied”. This means two qubits may acquire the same dependences without ever interacting directly and they will be dependent when manipulated or measured. In addition, canceling of those dependences will happen when sometime later the two qubits directly interact with a CNOT gate.

To illustrate the application of all three rules working together to obtain the complete unitary dependence picture, here we consider the hardware-efficient ansatz that is widely used in variational quantum algorithms31,32,33,34. The main feature of the hardware-efficient ansatz is that each ansatz layer includes two sub-layers: one sub-layer of parameterized 1-qubit unitaries and one sub-layer of two-qubit entanglers. When the two-qubit entanglers are all CNOT gates, there is no 1-qubit unitary in between the entanglers and the entangler sub-layer can be considered as a single layer of the qubit functional configuration (QFC) as described above—this means the canceling rule works perfectly within one entangler sub-layer and we can easily obtain the unitary dependence picture of each ansatz layer. In two examples, the ansatzes used in the original studies33,34 are shown in Figs. 5 and 6, respectively, and the unitary dependence pictures (in Eq. (3)’s description form of the picture) are shown in Eqs. (10) and (11), respectively.

The unitary dependence picture of the ansatz in ref. 33.

$$ ({q}_{1}:\{{U}_{2}\sim {U}_{6}\},\,{q}_{2}:\{{U}_{1},{U}_{2}\},\,{q}_{3}:\{{U}_{1}\sim {U}_{3}\},\,{q}_{4}:\{{U}_{1}\sim {U}_{4}\},\\ {q}_{5}:\{{U}_{1}\sim {U}_{5}\},\,{q}_{6}:\{{U}_{1}\sim {U}_{6}\})\\ ({U}_{1}:\{{q}_{2}\sim {q}_{6}\},\,{U}_{2}:\{{q}_{1}\sim {q}_{6}\},\,{U}_{3}:\{{q}_{1},{q}_{3}\sim {q}_{6}\},\,{U}_{4}:\{{q}_{1},{q}_{4}\sim {q}_{6}\},\\ {U}_{5}:\{{q}_{1},{q}_{5},{q}_{6}\},{U}_{6}:\{{q}_{1},{q}_{6}\})$$
(10)

The unitary dependence picture of the ansatz in ref. 34:

$$ ({q}_{1}:\{{U}_{1},{U}_{2}\},\,{q}_{2}:\{{U}_{2}\},\,{q}_{3}:\{{U}_{1}\sim {U}_{3}\},\,{q}_{4}:\{{U}_{2},{U}_{4}\},\,{q}_{5}:\{{U}_{4}\sim {U}_{6}\},\,{q}_{6}:\{{U}_{6}\})\\ ({U}_{1}:\{{q}_{1},{q}_{3}\},\,{U}_{2}:\{{q}_{1}\sim {q}_{4}\},\,{U}_{3}:\{{q}_{3}\},\,{U}_{4}:\{{q}_{4},{q}_{5}\},\,{U}_{5}:\{{q}_{5}\},{U}_{6}:\{{q}_{5},{q}_{6}\})$$
(11)
Fig. 5: The 1st example of the hardware-efficient ansatz.
figure 5

The figure shows the quantum circuit of one layer of the hardware-efficient ansatz in ref. 33 \({U}_{1}\) through \({U}_{6}\) are 1-qubit unitaries applied to the qubits \({q}_{1}\) through \({q}_{6}\), respectively. The CNOT gate layer then copies the unitary dependencies around the qubits. The final unitary dependence picture as described in Eq. (10) shows the qubits are highly-dependent on manipulations and measurement statistics.

Fig. 6: The 2nd example of the hardware-efficient ansatz.
figure 6

The figure shows the quantum circuit of one layer of the hardware-efficient ansatz in ref. 34 \({U}_{1}\) through \({U}_{6}\) are 1-qubit unitaries applied to the qubits \({q}_{1}\) through \({q}_{6}\), respectively. The CNOT gate layer then copies the unitary dependencies around the qubits. The final unitary dependence picture as described in Eq. (11) shows the qubits are more independent in manipulations and measurement statistics.

Here the unitary dependence pictures of both ansatzes are generated by following the quantum gates one by one while considering Rules 1 to 3 to determine what each gate does to the evolving unitary dependence picture. A basic example of this process can be found in Fig. 1 where the Venn diagram is generated by three steps (with the two 1-qubit unitaries combined into one step). For the current example of the ansatz in Fig. 5, by Rule 1 the six 1-qubit unitaries create one dependence on each qubit; then by Rule 2 \(C{X}_{1\to 2}\) copies \({U}_{1}\) to \({q}_{2}\), \(C{X}_{2\to 3}\) copies \({U}_{1}\) and \({U}_{2}\) to \({q}_{3}\), and so on …; then by Rules 2 and 3, \(C{X}_{6\to 1}\) copies all unitaries to \({q}_{1}\) and \({U}_{1}\) is canceled—the final result is the unitary dependence picture in Eq. (10). This example shows the process of generating the unitary dependence picture is directly related to the process of building the ansatz itself, so the complexity of generating the unitary dependence picture is the same as the complexity of the ansatz, which in the current case of “hardware-efficient ansatzes” is linear in the qubit number.

Now what useful information is provided by the unitary dependence pictures of these ansatzes? Firstly, the unitary dependence pictures provide both intuitive and precise descriptions of the unitary dependences assigned to each qubit: we can see exactly which qubits depend on which unitaries. Some information available from the unitary dependence picture may not be obvious by inspecting the circuit alone: one example is the fact of \({q}_{1}\) not depending on \({U}_{1}\) in Fig. 5, which can be deduced by applying Rules 2 and 3: \({U}_{1}\) has been copied to \({q}_{6}\) by a series of CNOT gates and then canceled on \({q}_{1}\) by \(C{X}_{6\to 1}\); another example is the fact of \({q}_{3}\) depending on \({U}_{2}\) in Fig. 6, which can be deduced by applying Rule 2: \({U}_{2}\) has been copied to \({q}_{1}\) by \(C{X}_{2\to 1}\), and then to \({q}_{3}\) by \(C{X}_{1\to 3}\). The precise description of exactly which qubits depend on which unitaries makes the unitary dependence theory advantageous over existing descriptions such as the “causal cone” approach44,45,46 that only identifies rough correlations between subgroups of qubits and quantum gates.

Secondly, the unitary dependence pictures show the practical connections among the qubits in manipulations and measurement statistics, which are also not obvious by inspecting the circuits alone. For example, inspecting the circuits in Fig. 5 and Fig. 6, we can say in either ansatz all the qubits are entangled to each other, but the difference between the two ansatzes is not obvious. However, the top line of the unitary dependence picture in Eq. (11) clearly shows that \({q}_{2}\) only depends on \({U}_{2}\) and \({q}_{6}\) only depends on \({U}_{6}\), which means the measurement statistics of these two qubits are independent from other qubits. Additionally on the bottom line in Eq. (11), \({U}_{3}\) only affects \({q}_{3}\) and \({U}_{5}\) only affects \({q}_{5}\), which means these two qubits can be individually manipulated without modifying other qubits. On the other hand, in the unitary dependence picture in Eq. (10) the qubits are more connected in the sense that all qubits depend on multiple unitaries and all unitaries affect multiple qubits. Therefore by the unitary dependence pictures we immediately know that the measurement and manipulation of the qubits are more connected in Fig. 5 and more disconnected in Fig. 6 —thus the two ansatzes can behave very differently during a variational process when the parameters of the unitaries are optimized.

Using the useful information provided by the unitary dependence pictures, next we propose an idea for a systematic study to improve the performances of ansatzes. Suppose we are using a variational quantum algorithm31,32,33,34 to find the minimum of an optimization problem: e.g., the ground energy of a molecular Hamiltonian. The two ansatzes in Figs. 5 and 6 are likely to have different convergence rates or even converge to different values if the iteration numbers are limited—these can be used to evaluate the performances of the ansatzes. Now if for a particular problem the ansatz in Fig. 5 does better, it may imply the problem prefers the ansatz to have more connected qubits, or vice versa. We can then add more CNOT gates to increase the connectivity or remove some CNOT gates to reduce the connectivity and see if the performance improves or worsens. This way we may be able to systematically find better ansatzes and understand why some ansatzes perform badly for a particular problem. Going through the same process for a variety of problems, we may even see the problems themselves separate into one group that prefers disconnected ansatzes and the other that prefers connected ansatzes – thus the ansatz properties described by the unitary dependence pictures may be used to characterize not only the ansatzes, but also the problems.

Note if two copies of dependences are not considered the same by Definition 2, they may or may not cancel when copied to the same qubit. Consider the simple example of a 2-qubit state:

$$|\phi \rangle =({a}_{1}{|0\rangle }_{1}+{a}_{2}{|1\rangle }_{1})\otimes ({b}_{1}{|0\rangle }_{2}+{b}_{2}{|1\rangle }_{2})$$
(12)

with \({q}_{1}\) depending on \(({a}_{1},{a}_{2})\) and \({q}_{2}\) depending on \(({b}_{1},{b}_{2})\). Now applying \(C{X}_{1\to 2}\) we have:

$$|C{X}_{1\to 2}\phi \rangle ={a}_{1}{|0\rangle }_{1}\otimes ({b}_{1}{|0\rangle }_{2}+{b}_{2}{|1\rangle }_{2})+{a}_{2}{|1\rangle }_{1}\otimes ({b}_{2}{|0\rangle }_{2}+{b}_{1}{|1\rangle }_{2})$$
(13)

and by Rule 2, \({q}_{2}\) now depends on both \(({b}_{1},{b}_{2})\) and \(({a}_{1},{a}_{2})\) with \(p({|0\rangle }_{2})={|{a}_{1}{b}_{1}|}^{2}+{|{a}_{2}{b}_{2}|}^{2}\). By Rule 3, if we apply \(C{X}_{1\to 2}\) again then \(({a}_{1},{a}_{2})\) will be canceled from \({q}_{2}\), but if we apply a 1-qubit unitary \({U}_{2}=(\begin{array}{cc}{u}_{1} & {u}_{2}^{\ast }\\ {u}_{2} & -{u}_{1}^{\ast }\end{array})\) on \({q}_{2}\) first, then \(C{X}_{1\to 2}\), we have:

$$|C{X}_{1\to 2}\cdot {U}_{2}\cdot C{X}_{1\to 2}\phi \rangle =\, {a}_{1}{|0\rangle }_{1}\otimes [({u}_{1}{b}_{1}+{u}_{2}^{\ast }{b}_{2}){|0\rangle }_{2}+({u}_{2}{b}_{1}-{u}_{1}^{\ast }{b}_{2}){|1\rangle }_{2}]\\ +{a}_{2}{|1\rangle }_{1}\otimes [({u}_{2}{b}_{2}-{u}_{1}^{\ast }{b}_{1}){|0\rangle }_{2}+({u}_{1}{b}_{2}+{u}_{2}^{\ast }{b}_{1}){|1\rangle }_{2}]$$
(14)

and the probability of measuring \(|0\rangle\) for \({q}_{2}\) is:

$$p({|0\rangle }_{2})={|{a}_{1}|}^{2}{|{u}_{1}{b}_{1}+{u}_{2}^{\ast }{b}_{2}|}^{2}+{|{a}_{2}|}^{2}{|{u}_{2}{b}_{2}-{u}_{1}^{\ast }{b}_{1}|}^{2}$$
(15)

which still has dependence on \(({a}_{1},{a}_{2})\), i.e., canceling did not happen. This is clearly due to \({U}_{2}\)’s modification of the 1st copy of \(({a}_{1},{a}_{2})\) received by \({q}_{2}\).

However, a more intriguing scenario happens if we entangle a 3rd qubit \({q}_{3}={|0\rangle }_{3}\) to \({q}_{2}\) by applying \(C{X}_{2\to 3}\) to the state \(|C{X}_{1\to 2}\phi \rangle\) as in Eq. (13), we have:

$$|C{X}_{2\to 3}\cdot C{X}_{1\to 2}\phi \rangle ={a}_{1}{|0\rangle }_{1}\otimes ({b}_{1}{|00\rangle }_{23}+{b}_{2}{|11\rangle }_{23})+{a}_{2}{|1\rangle }_{1}\otimes ({b}_{2}{|00\rangle }_{23}+{b}_{1}{|11\rangle }_{23})$$
(16)

where by Rule 2 we have copied \({q}_{2}\)’s dependences to, while there is no apparent change to \({q}_{1}\) and \({q}_{2}\). If we now apply \({U}_{2}=(\begin{array}{cc}{u}_{1} & {u}_{2}^{\ast }\\ {u}_{2} & -{u}_{1}^{\ast }\end{array})\) on \({q}_{2}\) and then \(C{X}_{1\to 2}\), we have:

$$ |C{X}_{1\to 2}\cdot {U}_{2}\cdot C{X}_{2\to 3}\cdot C{X}_{1\to 2}\phi \rangle \\ = {a}_{1}{|0\rangle }_{1}\otimes [{b}_{1}({u}_{1}{|0\rangle }_{2}+{u}_{2}{|1\rangle }_{2})\otimes {|0\rangle }_{3}+{b}_{2}({u}_{2}^{\ast }{|0\rangle }_{2}-{u}_{1}^{\ast }{|1\rangle }_{2})\otimes {|1\rangle }_{3}]\\ \,+{a}_{2}{|1\rangle }_{1}\otimes [{b}_{2}({u}_{2}{|0\rangle }_{2}+{u}_{1}{|1\rangle }_{2})\otimes {|0\rangle }_{3}+{b}_{1}(-{u}_{1}^{\ast }{|0\rangle }_{2}+{u}_{2}^{\ast }{|1\rangle }_{2})\otimes {|1\rangle }_{3}]$$
(17)

and the probability of measuring \(|0\rangle\) for \({q}_{2}\) is:

$$p({|0\rangle }_{2}) ={|{a}_{1}|}^{2}({|{u}_{1}{b}_{1}|}^{2}+{|{u}_{2}^{\ast }{b}_{2}|}^{2})+{|{a}_{2}|}^{2}({|{u}_{2}{b}_{2}|}^{2}+{|{u}_{1}^{\ast }{b}_{1}|}^{2})\\ ={|{u}_{1}{b}_{1}|}^{2}+{|{u}_{2}{b}_{2}|}^{2}$$
(18)

which has no dependence on \(({a}_{1},{a}_{2})\). So although Rule 3’s condition is violated by \({U}_{2}\) before the 2nd \(C{X}_{1\to 2}\), canceling still happens! By comparing Eq. (13) with (16), (14), with (17), we see the only difference between the two is, in the 2nd case, \({q}_{2}\) is entangled to \({q}_{3}\) before \({U}_{2}\), and this suggests that entanglement can protect the cancellability from getting broken by local 1-qubit unitaries. To understand this interesting phenomenon, we observe the state in Eq. (13) \({q}_{1}\) and \({q}_{2}\) are entangled, such that a local unitary \({U}_{2}\) on \({q}_{2}\) may affect the dependence on \(({a}_{1},{a}_{2})\) that is shared by the two qubits. On the other hand, if we trace out \({q}_{3}\) in Eq. (16) to get the reduced density matrix of \({q}_{1}\) and \({q}_{2}\), we have:

$$\begin{array}{cc}\begin{array}{c}T{r}_{3}(\rho )=T{r}_{3}(|C{X}_{2\to 3}\cdot C{X}_{1\to 2}\phi \rangle \langle C{X}_{2\to 3}\cdot C{X}_{1\to 2}\phi |)\\ \,=({|{a}_{1}{b}_{1}|}^{2}+{|{a}_{2}{b}_{2}|}^{2})|{\varphi }_{1}\rangle \langle {\varphi }_{1}|+({|{a}_{1}{b}_{2}|}^{2}+{|{a}_{2}{b}_{1}|}^{2})|{\varphi }_{2}\rangle \langle {\varphi }_{2}|\end{array} & \\ |{\varphi }_{1}\rangle =\frac{({a}_{1}{b}_{1}{|0\rangle }_{1}+{a}_{2}{b}_{2}{|1\rangle }_{1})}{\sqrt{{|{a}_{1}{b}_{1}|}^{2}+{|{a}_{2}{b}_{2}|}^{2}}}\otimes {|0\rangle }_{2} & |{\varphi }_{2}\rangle =\frac{({a}_{1}{b}_{2}{|0\rangle }_{1}+{a}_{2}{b}_{1}{|1\rangle }_{1})}{\sqrt{{|{a}_{1}{b}_{2}|}^{2}+{|{a}_{2}{b}_{1}|}^{2}}}\otimes {|1\rangle }_{2}\end{array}$$
(19)

where the reduced density matrix of \({q}_{1}\) and \({q}_{2}\) is a mixture of two pure product states \(|{\varphi }_{1}\rangle\) and \(|{\varphi }_{2}\rangle\), and the shared dependence on \(({a}_{1},{a}_{2})\) only affects \({q}_{2}\) through the pure state probabilities \({p}_{1}={|{a}_{1}{b}_{1}|}^{2}+{|{a}_{2}{b}_{2}|}^{2}\) and \({p}_{2}={|{a}_{1}{b}_{2}|}^{2}+{|{a}_{2}{b}_{1}|}^{2}\). Clearly, any 1-qubit unitaries on \({q}_{2}\) will only affect the qubit locally and will not affect the pure state probabilities, and this is the reason why canceling holds even after \({U}_{2}\). The effect of entanglement is to break the entangled state in Eq. (13) into product states in the 2-qubit reduced system in Eq. (19), and this causes the canceling of dependences to happen even when local 1-qubit unitaries are applied to \({q}_{2}\). This example may suggest a mechanism for using entanglement with additional qubits to protect certain properties of the system against local disturbances.

Conclusions

In this work, we develop a unitary dependence theory to characterize the behaviors of quantum circuits and states in terms of how 1-qubit unitaries and CNOT gates affect qubits and determine their measurement probabilities. In particular, we define the basic rules of dependence creation by 1-qubit unitaries and copying by CNOT gates: 1. a 1-qubit unitary \({U}_{k}\) makes the qubit \({q}_{k}\)’s measurement probabilities depend on \({U}_{k}\); 2. a CNOT gate \(C{X}_{j\to k}\) copies all the control qubit \({q}_{j}\)’s dependences to the target qubit \({q}_{k}\). By these rules, after a gate sequence of a quantum circuit, the final state can be described by a complete dependence picture that shows which qubits depend on which 1-qubit unitaries. The dependence picture carries important information of whether the measurement results of qubits are dependent or independent, and whether multiple qubits can be manipulated together or separately. Compared to the abstract formalism of multi-qubit entanglement, the dependence picture is more directly connected to the practicalities of using parameterized quantum gates to manipulate qubits and create desirable measurement statistics in the output states. In addition, the dependence picture is easier to use for many-qubit systems and more robust upon system partitioning. Under certain conditions, the dependences originated from the same unitary source can cancel when duplicated on the same qubit, which reduces complexity and simplifies the dependence picture. A particularly interesting case arises when studying the cancellability of dependences is that entanglement with an additional qubit may protect the cancellability from getting broken by local 1-qubit unitaries. This may suggest a mechanism for using entanglement with additional qubits to protect certain properties of the system against local disturbances. Finally, the theory has been applied to the widely-used hardware-efficient ansatz to demonstrate its ability to characterize the behaviors of different ansatzes in variational quantum algorithms.