The unitary dependence theory for characterizing quantum circuits and states

Most existing quantum algorithms are discovered accidentally or adapted from classical algorithms, and there is the need for a systematic theory to understand and design quantum circuits. Here 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. Compared to the conventional entanglement description of quantum circuits and states, the unitary 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. The unitary dependence theory can be applied to systematically understand existing quantum circuits and design new quantum algorithms.

O ver several decades, the search for quantum algorithms with efficient quantum circuit implementations has resulted in numerous theoretical and technological advancements [1][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 algorithm 15 , Shor's factorization algorithm 16 , the Harrow-Hassidim-Lloyd algorithm for linear systems 17 , the hybrid classical-quantum algorithms 18,19 , the quantum machine learning algorithms [20][21][22] , and quantum algorithms for open quantum dynamics [23][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 fj0i; j1ig. The probability of measuring j0i versus j1i 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 CX j!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 ii.e., any given dependence can be traced back to the original 1-qubit unitary that has created it in the first placetherefore 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 complexity 27 . Compared to the abstract formalism of multiqubit entanglement [28][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 widelyused hardware-efficient ansatz [31][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 j000i 123 (where the subscripts 123 denote the qubit number identifiers), then all three qubits start with probability 1 for measuring j0i. Now if we apply an arbitrary 1-qubit unitary U 1 ða 1 ; a 2 ; αÞ ¼ ð a 1 a * 2 e iα a 2 Àa * 1 e iα Þ (with ja 1 j 2 þ ja 2 j 2 ¼ 1) to q 1 then the state becomes ða 1 j0i 1 þ a 2 j1i 1 Þ j00i 23 and measuring q 1 will yield the probabilities pðj0i 1 Þ ¼ ja 1 j 2 and pðj1i 1 Þ ¼ ja 2 j 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 ; αÞ in the above example. Note in this particular example the phase α has no obvious effect on pðj0i 1 Þ or pðj1i 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 ; βÞ ¼ ð b 1 b * 2 e iβ b 2 Àb * 1 e iβ Þ (with jb 1 j 2 þ jb 2 j 2 ¼ 1) to q 2 then the state becomes ða 1 j0i 1 þ a 2 j1i 1 Þ ðb 1 j0i 2 þ b 2 j1i 2 Þ j0i 3 , and q 2 has acquired the dependence on U 2 ðb 1 ; b 2 ; βÞ. Now if we apply the CNOT gate CX 1!2 with the subscript 1 ! 2 meaning q 1 is the control and q 2 is the target, then the state becomes ½a 1 j0i 1 ðb 1 j0i 2 þ b 2 j1i 2 Þ þ a 2 j1i 1 ðb 2 j0i 2 þ b 1 j1i 2 Þ j0i 3 , and now measuring q 2 will yield pðj0i 2 Þ ¼ ja 1 b 1 j 2 þ ja 2 b 2 j 2 : we see that the probabilities of measuring q 2 now depend on U 1 ða 1 ; a 2 ; αÞ too and thus q 2 has acquired the dependence on U 1 ða 1 ; a 2 ; αÞ through CX 1!2 . It is obvious that the control qubit q 1 is unaffected by CX 1!2 . Next if we apply another CNOT gate CX 2!3 , then the state becomes ða 1 b 1 j0i 1 þ a 2 b 2 j1i 1 Þj00i 23 þ ða 1 b 2 j0i 1 þ a 2 b 1 j1i 1 Þj11i 23 , and measuring q 3 will yield pðj0i 3 Þ ¼ ja 1 b 1 j 2 þ ja 2 b 2 j 2 such that q 3 has acquired all the dependences on q 2both U 1 ða 1 ; a 2 ; αÞ and U 2 ðb 1 ; b 2 ; βÞthrough CX 2!3 . To summarize the entire process, we started with j000i 123 having no dependence on any 1-qubit unitary for any qubit, created U 1 ða 1 ; a 2 ; αÞ's dependence on q 1 , created U 2 ðb 1 ; b 2 ; βÞ's dependence on q 2 , copied q 1 's dependence to q 2 by CX 1!2 , and copied q 2 's dependences to q 3 by CX 2!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 ; βÞ shared by q 2 and q 3 , and U 1 ða 1 ; a 2 ; αÞ 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 ; αÞ will modify the probabilities of all three qubits, while changing b 1 and b 2 of U 2 ðb 1 ; b 2 ; βÞ 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 ; αÞ or U 2 ðb 1 ; b 2 ; βÞ.
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 CX j!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 study 35 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 : where jϕ ðnÀ1Þ 1 i and jϕ ðnÀ1Þ 2 i are orthogonal ðn À 1Þ-qubit states that exclude q k , C 1 and C 2 are non-negative real numbers satisfying jC 1 j 2 þ jC 2 j 2 ¼ 1, a 1 and a 2 are complex numbers satisfying ja 1 j 2 þ ja 2 j 2 ¼ 1. Clearly the probability of measuring j0i on q k is pðj0i k Þ ¼ jC 1 a 1 j 2 þ jC 2 a 2 j 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 jϕ n i. However, because jψ 1 i ¼ a 1 j0i k þ a 2 j1i k and jψ 2 i ¼ ða * 2 j0i k À a * 1 j1i k Þe iα 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 ¼ ð u 1 u * 2 e iθ u 2 Àu * 1 e iθ Þ on q k , as jU k ψ 1 i is always orthogonal to jU k ψ 2 i, 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 CX j!k is to keep q k intact when q j ¼ j0i and bit-flip q k if q j ¼ j1ithis effectively calculates the binary sum q k È q j and stores its value on q k 26,36-39 . When we measure q k after CX j!k , the probabilities of getting j0i and j1i are actually the probabilities of getting q k È q j ¼ 0 and q k È 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 CX j!k . In the meanwhile, it is obvious that q j 's measurement probabilities are not affected by CX j!k . Therefore Rule 2 has been proven that "A CNOT gate CX j!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 Then the dependences are copied by the CNOT gates CX 1!2 and CX 2!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. 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 state 9 . 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 circuits 18,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: where a 1 , a 2 , b 1 , b 2 are complex numbers satisfying ja 1 j 2 þ ja 2 j 2 ¼ 1 and jb 1 j 2 þ jb 2 j 2 ¼ 1. In jψi, 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ðj0i 1 Þ ¼ ja 1 j 2 and pðj0i 3 Þ ¼ jb 1 j 2i.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, jψi 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.
In Fig. 2, we have U 1 ða 1 ; a 2 ; αÞ shared by q 1 and q 2 , and U 3 ðb 1 ; b 2 ; βÞ 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 exist [28][29][30] . For example, for a 3-qubit system there are the Greenberger-Horne-Zeilinger (GHZ) state jGHZi ¼ 1 ffiffi 2 p ðj000i þ j111iÞ and the W state jWi ¼ 1 ffiffi 3 p ðj001i þ j010i þ j100iÞ, which are well-known to be different and can be explained by various multipartite entanglement measures [28][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 j000i þ a 2 j111i 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 j000i þ a 2 j111i can be described by one simple Venn diagram in Fig. 3.
Although there is a theory to generalize the GHZ state and W state into the GHZ class and W class 29 , 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 jψi 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 state 29 . 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 The W state unitary dependence description by qubits ðq 1 : fR y ðθ 1 Þ; Xg; q 2 : fR y ðθ 1 Þ; R y ðθ 2 Þ; R y ðθ 3 Þg; q 3 : fR y ðθ 1 Þ; R y ðθ 2 Þ; R y ðθ 3 ÞgÞ by 1 À qubit unitaries ðR y ðθ 1 Þ : fq 1 ; q 2 ; q 3 g; R y ðθ 2 Þ : fq 2 ; q 3 g; X : fq 1 g; R y ðθ 3 Þ : fq 2 ; q 3 gÞ ð3Þ and this description always works for systems with more qubits. 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 j000i þ a 2 j111i will become the reduced density matrix ρ ¼ a 1 j00ih00j þ a 2 j11ih11j when any one of the qubits is removed, and this is clearly an unentangled (separable) mixed state 43 . 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 j000i þ a 2 j111i 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, CX 1!2 copies all dependences of q 1 to q 2 , and another CX 1!2 will attempt to copy all the same dependences again from q 1 to q 2 . As CX 1!2 is its own inverse, the 2nd CX 1!2 thus cancels all dependences copied by the 1st CX 1!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: 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 CX 2!1 and CX 2!3 , it becomes: where q 1 and q 3 have both acquired dependence on ðb 1 ; b 2 Þ. Now if we apply CX 1!3 , then the state becomes: where q 3 has lost the dependence on ðb 1 ; b 2 Þ because after some algebra we find that pðj0i 3 Þ ¼ ja 1 c 1 j 2 þ ja 2 c 2 j 2 . Here the effect of CX 1!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, CX i!j calculates the binary sum q i È q j and stores its value on q j , and if we next apply e.g., CX j!k then it calculates the binary sum q i È q j È 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 study 26 ): 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., CX 1!2 , we update f 2 to be f 2 ¼ q 1 È q 2 with other f k intact so the QFC becomes: Now if we apply another CNOT gate e.g., CX 2!3 , we update f 3 to be f 3 ¼ q 1 È q 2 È q 3 and the QFC becomes: 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 CX 1!2 gate. This is clear because by Rule 2 above, CX 1!2 copies all dependence from q 1 to q 2 , and then CX 2!3 copies all dependence from q 2 to q 3we 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 È q 2 means q 2 shares the dependences initially on q 1 , while f 3 ¼ q 1 È q 2 È 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 È 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 study 26 "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 1 e iβ Þ (with jb 1 j 2 þ jb 2 j 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.
COMMUNICATIONS PHYSICS | https://doi.org/10.1038/s42005-023-01188-y ARTICLE COMMUNICATIONS PHYSICS | (2023) 6:68 | https://doi.org/10.1038/s42005-023-01188-y | www.nature.com/commsphys 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 algorithms [31][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 studies 33,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 : fU 2 $ U 6 g; q 2 : fU 1 ; U 2 g; q 3 : fU 1 $ U 3 g; q 4 : fU 1 $ U 4 g; q 5 : fU 1 $ U 5 g; q 6 : fU 1 $ U 6 gÞ ðU 1 : fq 2 $ q 6 g; U 2 : fq 1 $ q 6 g; U 3 : fq 1 ; q 3 $ q 6 g; U 4 : fq 1 ; q 4 $ q 6 g; The unitary dependence picture of the ansatz in ref. 34 : ðq 1 : fU 1 ; U 2 g; q 2 : fU 2 g; q 3 : fU 1 $ U 3 g; q 4 : fU 2 ; U 4 g; q 5 : fU 4 $ U 6 g; q 6 : fU 6 gÞ ðU 1 : fq 1 ; q 3 g; U 2 : fq 1 $ q 4 g; U 3 : fq 3 g; U 4 : fq 4 ; q 5 g; U 5 : fq 5 g; U 6 : fq 5 ; q 6 gÞ ð11Þ 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 CX 1!2 copies U 1 to q 2 , CX 2!3 copies U 1 and U 2 to q 3 , and so on …; then by Rules 2 and 3, CX 6!1 copies Fig. 6 The 2nd example of the hardware-efficient ansatz. 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. Fig. 4 The dependence picture of the W state. 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:  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 CX 6!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 CX 2!1 , and then to q 3 by CX 1!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" approach 44-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 algorithm [31][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 ansatzesthus 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: with q 1 depending on ða 1 ; a 2 Þ and q 2 depending on ðb 1 ; b 2 Þ. Now applying CX 1!2 we have: and by Rule 2, q 2 now depends on both ðb 1 ; b 2 Þ and ða 1 ; a 2 Þ with pðj0i 2 Þ ¼ ja 1 b 1 j 2 þ ja 2 b 2 j 2 . By Rule 3, if we apply CX 1!2 again then ða 1 ; a 2 Þ will be canceled from q 2 , but if we apply a 1-qubit Þ on q 2 first, then CX 1!2 , we have: and the probability of measuring j0i for q 2 is: 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 ¼ j0i 3 to q 2 by applying CX 2!3 to the state jCX 1!2 ϕi as in Eq. (13), we have: 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 ¼ ð u 1 u * 2 u 2 Àu * 1 Þ on q 2 and then CX 1!2 , we have: and the probability of measuring j0i for q 2 is: which has no dependence on ða 1 ; a 2 Þ. So although Rule 3's condition is violated by U 2 before the 2nd CX 1!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: Tr 3 ðρÞ ¼ Tr 3 ðjCX 2!3 Á CX 1!2 ϕihCX 2!3 Á CX 1!2 ϕjÞ ¼ ðja 1 b 1 j 2 þ ja 2 b 2 j 2 Þjφ 1 ihφ 1 j þ ðja 1 b 2 j 2 þ ja 2 b 1 j 2 Þjφ 2 ihφ 2 j jφ 1 i ¼ ða 1 b 1 j0i 1 þa 2 b 2 j1i 1 Þ ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi where the reduced density matrix of q 1 and q 2 is a mixture of two pure product states jφ 1 i and jφ 2 i, and the shared dependence on ða 1 ; a 2 Þ only affects q 2 through the pure state probabilities p 1 ¼ ja 1 b 1 j 2 þ ja 2 b 2 j 2 and p 2 ¼ ja 1 b 2 j 2 þ ja 2 b 1 j 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 CX j!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 widelyused hardware-efficient ansatz to demonstrate its ability to characterize the behaviors of different ansatzes in variational quantum algorithms.

Data availability
Data sharing is not applicable to this article as no datasets were generated or analyzed during the current study.