Introduction

The development of quantum algorithms with efficient quantum circuits has been a central part of quantum computation, which has seen enormous progress in the last 30 years in both the theoretical and experimental fronts1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22. Over the years, numerous quantum algorithms have been developed targeting a great variety of applications: these include the phase estimation algorithm23, Shor’s factorization algorithm24, the Harrow-Hassidim-Lloyd algorithm for linear systems25, the hybrid classical-quantum algorithms26,27,28,29, the quantum machine learning algorithms30,31, and quantum algorithms for open quantum dynamics32,33,34,35,36,37.

Despite the success, the design of efficient quantum circuits to implement new quantum algorithms remains an accidental process, and a systematic way38,39 to understand how quantum circuits work may lead to improvements in existing algorithms and discovery of new ones. To achieve decisive advantage over classical algorithms, quantum circuits must have the complexity that scales polynomially, not exponentially, with the number of qubits. Mathematically, if we consider all possible quantum circuits without any constraint, then the overwhelming majority of the quantum circuits have exponential scaling40. Consequently, designing quantum circuits that can demonstrate the advantage of quantum computation is essentially a process of characterizing and identifying the special cases with polynomial scaling out of the ocean of general cases with exponential scaling. To achieve this we need a systematic framework to classify large numbers of quantum circuits with finite mathematical structures: in this work we develop such a theory based on the “qubit functional configuration”. The qubit functionals are first introduced in our previous work41,42 as objects living in the dual space of the linear space formed by the basis states of the qubit state space. In this work we relate the qubit functionals to how the state vector entries are collectively modified by quantum gates. In particular, any arbitrary quantum circuit can be decomposed into alternating sequences of 1-qubit unitary gates and CNOT gates. Each CNOT sequence prepares the current quantum state into a layer of qubit functional configuration to specify the rule for the next 1-qubit gate sequence on how to collectively modify the state vector entries. All the layers together form a sequence of qubit functional configurations that defines a unique type of quantum circuits with great variety. Characterizing quantum circuits by these qubit functional configuration types has several major benefits: 1. all quantum circuits can be characterized by the corresponding functional configuration types; 2. each type characterizes important properties (such as the circuit complexity) of the quantum circuits belonging to it; 3. each type contains a huge collection of possible quantum circuits allowing systematic investigation of their common properties.

In addition, we demonstrate an application of the theory to the hardware-efficient ansatzes of variational quantum algorithms43,44,45,46 by comparing the qubit functional configurations of two ansatzes used in Refs.45 and 46. We also propose a systematic process of creating any arbitrary functional configuration with the help of ancilla qubits.

For potential applications, the functional configuration picture may allow us to systematically find a minimal gate decomposition sequence of any given quantum circuit. The qubit functional configuration theory is so far as we know the first of its kind that can characterize huge numbers of quantum circuits together by finite mathematical structures—this may allow systematic understanding of quantum algorithms based on their quantum circuit types and thus benefit the development of new algorithms.

Theory of the qubit functional configuration

The qubit functionals

An n-qubit quantum state vector can be written as \(\left| \varphi \right\rangle = \sum\limits_{i = 0}^{{2^{n} - 1}} {a_{i} \left| i \right\rangle }\), where the basis states \(\left| i \right\rangle\) can be associated with the bit strings \(\left( i \right)\) with i in the binary form. For example a 3-qubit state vector has 8 basis states corresponding to 8 bit strings: \(\left( {000} \right)\), \(\left( {001} \right)\), \(\left( {010} \right)\), …, \(\left( {111} \right)\). As discussed in Ref.41 the collection of all these bit strings can be considered as a 3-dimensional linear space V over the binary field \(\left\{ {0,1} \right\}\) and any bit string can be expressed as a linear combination of the three basis vectors (100), (010), and (001): \({\mathbf{v}} = \left( {q_{1} ,q_{2} ,q_{3} } \right) = q_{1} \left( {100} \right) + q_{2} \left( {010} \right) + q_{3} \left( {001} \right)\), where the coefficients \(q_{i}\)’s take values 0 or 1, and the addition “ + ” is bit-wise addition modulo 2. Now by the theory of linear vector spaces, the dual space \(V^{*}\) of V is formed by the linear functionals over V: \(f\left( {\mathbf{v}} \right) = f\left( {\left( {q_{1} ,q_{2} ,q_{3} } \right)} \right) = g_{1} q_{1} \oplus g_{2} q_{2} \oplus g_{3} q_{3}\). Here the three basis functionals are \(f^{\left( 1 \right)} \left( {\left( {q_{1} ,q_{2} ,q_{3} } \right)} \right) = q_{1}\), \(f^{\left( 2 \right)} \left( {\left( {q_{1} ,q_{2} ,q_{3} } \right)} \right) = q_{2}\), \(f^{\left( 3 \right)} \left( {\left( {q_{1} ,q_{2} ,q_{3} } \right)} \right) = q_{3}\), the coefficients \(g_{i}\)’s take values 0 or 1, and the “\(\oplus\)” is addition modulo 2. In Ref.41 we have associated each functional with a “0” condition that specifies a half-set of the bit strings and studied the quantum condition space generated by these “0” conditions. In this work we call these functionals “qubit functionals” (because they are functionals on the qubit values) and focus on their roles in how the entries of the quantum state vectors are modified collectively by quantum gates.

Roles of elementary gates in modifying state vector entries

The universality of quantum circuits says that any unitary operation can be decomposed into a sequence of 1-qubit unitaries and CNOT gates. Consider an arbitrary n-qubit quantum state \(\left| {\varphi_{1} } \right\rangle = \sum\limits_{i = 0}^{{2^{n} - 1}} {a_{i} \left| i \right\rangle }\) as the starting point, if we apply 1-qubit unitaries \(U_{k}\) only without CNOT gates, then at most one \(U_{k}\) can be applied on each qubit \(q_{k}\) without redundancy. This is because \(U_{k}\)’s on different \(q_{k}\)’s all commute, so if e.g. \(U_{1}\) has already been applied to \(q_{1}\), then any additional unitary \(V_{1}\) applied to \(q_{1}\) at any point after \(U_{1}\) will be equivalent to a single gate \(W_{1} = V_{1} U_{1}\) applied to \(q_{1}\), thus applying more than one gates on the same qubit is redundant and can be reduced to just one gate. Next to examine the actual effects of 1-qubit unitaries, we study a 3-qubit state \(\left| {\varphi_{1} } \right\rangle = \sum\limits_{i = 0}^{7} {a_{i} \left| i \right\rangle }\) without loss of generality:

$$\varphi_{1} = \begin{array}{*{20}c} {000} \\ {001} \\ {010} \\ {011} \\ {100} \\ {101} \\ {110} \\ {111} \\ \end{array} \left( {\begin{array}{*{20}c} {a_{0} } \\ {a_{1} } \\ {a_{2} } \\ {a_{3} } \\ {a_{4} } \\ {a_{5} } \\ {a_{6} } \\ {a_{7} } \\ \end{array} } \right) \to U_{1} \varphi_{1} = \left( {\begin{array}{*{20}c} {u_{1} a_{0} + u_{2} a_{4} } \\ {u_{1} a_{1} + u_{2} a_{5} } \\ {u_{1} a_{2} + u_{2} a_{6} } \\ {u_{1} a_{3} + u_{2} a_{7} } \\ {u_{2} a_{0} - u_{1} a_{4} } \\ {u_{2} a_{1} - u_{1} a_{5} } \\ {u_{2} a_{2} - u_{1} a_{6} } \\ {u_{2} a_{3} - u_{1} a_{7} } \\ \end{array} } \right){;}\quad U_{2} \varphi_{1} = \left( {\begin{array}{*{20}c} {u_{1} a_{0} + u_{2} a_{2} } \\ {u_{1} a_{1} + u_{2} a_{3} } \\ {u_{2} a_{0} - u_{1} a_{2} } \\ {u_{2} a_{1} - u_{1} a_{3} } \\ {u_{1} a_{4} + u_{2} a_{6} } \\ {u_{1} a_{5} + u_{2} a_{7} } \\ {u_{2} a_{4} - u_{1} a_{6} } \\ {u_{2} a_{5} - u_{1} a_{7} } \\ \end{array} } \right){;}\quad U_{3} \varphi_{1} = \left( {\begin{array}{*{20}c} {u_{1} a_{0} + u_{2} a_{1} } \\ {u_{2} a_{0} - u_{1} a_{1} } \\ {u_{1} a_{2} + u_{2} a_{3} } \\ {u_{2} a_{2} - u_{1} a_{3} } \\ {u_{1} a_{4} + u_{2} a_{5} } \\ {u_{2} a_{4} - u_{1} a_{5} } \\ {u_{1} a_{6} + u_{2} a_{7} } \\ {u_{2} a_{6} - u_{1} a_{7} } \\ \end{array} } \right)$$
(1)

where the 1-qubit unitary \(U_{k}\) has the same basic form \(U = \left( {\begin{array}{*{20}c} {u_{1} } & {u_{2} } \\ {u_{2} } & { - u_{1} } \\ \end{array} } \right)\) applied to the \(k\)th qubit \(q_{k}\): that is \(U_{1} = U \otimes I \otimes I\), \(U_{2} = I \otimes U \otimes I\), and \(U_{3} = I \otimes I \otimes U\) (\(u_{1}\), \(u_{2}\) are assumed real for cleaner notations; this assumption does not cause any reasoning or results below to lose generality as compared to using complex numbers; \(u_{1}^{2} + u_{2}^{2} = 1\)). Here we see that \(U_{1}\) pairs \(a_{0}\) with \(a_{4}\), \(a_{1}\) with \(a_{5}\), \(a_{2}\) with \(a_{6}\), and \(a_{3}\) with \(a_{7}\). When we focus on one pair e.g. \(a_{0}\) and \(a_{4}\), the effect of \(U_{1}\) is equivalent to \(U\left( {\begin{array}{*{20}c} {a_{0} } \\ {a_{4} } \\ \end{array} } \right) = \left( {\begin{array}{*{20}c} {u_{1} a_{0} + u_{2} a_{4} } \\ {u_{2} a_{0} - u_{1} a_{4} } \\ \end{array} } \right)\), thus we can say \(a_{0}\) plays the role of “0” in this 2-dimensional subspace while \(a_{4}\) plays the role of “1”. Now we see the effect of \(U_{1}\) is dividing the total space into four 2-dimensional subspaces and then modifying the entries in pairs of \(\left[ {\left( {a_{0} ,a_{4} } \right),\left( {a_{1} ,a_{5} } \right),\left( {a_{2} ,a_{6} } \right),\left( {a_{3} ,a_{7} } \right)} \right]\) where the 1st entry in each parenthesis is considered “0” and the 2nd entry is considered “1”. Similarly, the effect of \(U_{2}\) can be represented by \(\left[ {\left( {a_{0} ,a_{2} } \right),\left( {a_{1} ,a_{3} } \right),\left( {a_{4} ,a_{6} } \right),\left( {a_{5} ,a_{7} } \right)} \right]\), and that of \(U_{3}\) can be represented by \(\left[ {\left( {a_{0} ,a_{1} } \right),\left( {a_{2} ,a_{3} } \right),\left( {a_{4} ,a_{5} } \right),\left( {a_{6} ,a_{7} } \right)} \right]\). Note that \(U_{1}\), \(U_{2}\), and \(U_{3}\) may be applied simultaneously but they keep the individual effects when considering a single gate alone. Now for \(U_{1}\), \(\left[ {\left( {a_{0} ,a_{4} } \right),\left( {a_{1} ,a_{5} } \right),\left( {a_{2} ,a_{6} } \right),\left( {a_{3} ,a_{7} } \right)} \right]\) means that we have separated the total space into two half-spaces spanned by basis states with \(q_{1} = 0\): {\(\left| {000} \right\rangle \sim a_{0}\), \(\left| {001} \right\rangle \sim a_{1}\), \(\left| {010} \right\rangle \sim a_{2}\), \(\left| {011} \right\rangle \sim a_{3}\)} versus \(q_{1} = 1\): {\(\left| {100} \right\rangle \sim a_{4}\), \(\left| {101} \right\rangle \sim a_{5}\), \(\left| {110} \right\rangle \sim a_{6}\), \(\left| {111} \right\rangle \sim a_{7}\)}; we then pair each \(q_{1} = 0\) term with a unique \(q_{1} = 1\) term and mix them to produce e.g. \(U\left( {\begin{array}{*{20}c} {a_{0} } \\ {a_{4} } \\ \end{array} } \right) = \left( {\begin{array}{*{20}c} {u_{1} a_{0} + u_{2} a_{4} } \\ {u_{2} a_{0} - u_{1} a_{4} } \\ \end{array} } \right)\) or \(U\left( {\begin{array}{*{20}c} {a_{1} } \\ {a_{5} } \\ \end{array} } \right) = \left( {\begin{array}{*{20}c} {u_{1} a_{1} + u_{2} a_{5} } \\ {u_{2} a_{1} - u_{1} a_{5} } \\ \end{array} } \right)\). Finally putting all these pairs back to the proper locations in the total vector, we obtain the vector result of \(U_{1} \varphi_{1}\) as in Eq. (1). Similarly, \(U_{2}\) separates the total space into two half-spaces spanned by basis states with \(q_{2} = 0\) versus \(q_{2} = 1\), while \(U_{3}\) separates into half-spaces with \(q_{3} = 0\) versus \(q_{3} = 1\).

Now what happens if we apply some CNOT gates before the 1-qubit \(U_{k}\)’s?

$$\varphi_{1} = \begin{array}{*{20}c} {000} \\ {001} \\ {010} \\ {011} \\ {100} \\ {101} \\ {110} \\ {111} \\ \end{array} \left( {\begin{array}{*{20}c} {a_{0} } \\ {a_{1} } \\ {a_{2} } \\ {a_{3} } \\ {a_{4} } \\ {a_{5} } \\ {a_{6} } \\ {a_{7} } \\ \end{array} } \right)\mathop{\longrightarrow}\limits^{{{\text{CNOT}}_{1 \to 2} }}\begin{array}{*{20}c} {000} \\ {001} \\ {010} \\ {011} \\ {100} \\ {101} \\ {110} \\ {111} \\ \end{array} \left( {\begin{array}{*{20}c} {a_{0} } \\ {a_{1} } \\ {a_{2} } \\ {a_{3} } \\ {a_{6} } \\ {a_{7} } \\ {a_{4} } \\ {a_{5} } \\ \end{array} } \right)\mathop{\longrightarrow}\limits^{{{\text{CNOT}}_{2 \to 3} }}\varphi_{1}^{\prime } = \begin{array}{*{20}c} {000} \\ {001} \\ {010} \\ {011} \\ {100} \\ {101} \\ {110} \\ {111} \\ \end{array} \left( {\begin{array}{*{20}c} {a_{0} } \\ {a_{1} } \\ {a_{3} } \\ {a_{2} } \\ {a_{6} } \\ {a_{7} } \\ {a_{5} } \\ {a_{4} } \\ \end{array} } \right)$$
(2)

In Eq. (2) we apply \({\text{CNOT}}_{1 \to 2}\) and then \({\text{CNOT}}_{2 \to 3}\) to produce \(\varphi_{1}^{\prime }\), where \(i \to j\) in the subscripts means \(q_{i}\) is the control and \(q_{j}\) is the target. By studying either the truth table of the CNOT gates or the results from previous works41,47,48, the \({\text{CNOT}}_{1 \to 2}\) calculates \(q_{1} \oplus q_{2}\) and stores its value on \(q_{2}\), and afterwards the \({\text{CNOT}}_{2 \to 3}\) calculates \(q_{1} \oplus q_{2} \oplus q_{3}\) and stores its value on \(q_{3}\). In other words, after \({\text{CNOT}}_{1 \to 2}\) and \({\text{CNOT}}_{2 \to 3}\) have been applied, the value on \(q_{2}\) now represents the value of \(q_{1} \oplus q_{2}\), and the value on \(q_{3}\) now represents the value of \(q_{1} \oplus q_{2} \oplus q_{3}\), as compared to the state \(\varphi_{1}\) before the two CNOT gates are applied. Since both \(q_{1} \oplus q_{2}\) and \(q_{1} \oplus q_{2} \oplus q_{3}\) are linear functionals in \(V^{*}\), we can understand the vector \(\varphi_{1}^{\prime }\) as having a functional configuration of \(\left( {f_{1} = q_{1} ,f_{2} = q_{1} \oplus q_{2} ,f_{3} = q_{1} \oplus q_{2} \oplus q_{3} } \right)\) as compared to \(\varphi_{1}\) having \(\left( {f_{1} = q_{1} ,f_{2} = q_{2} ,f_{3} = q_{3} } \right)\). Now by the same reasoning as the previous paragraph we predict that, if we apply 1-qubit unitaries to \(\varphi ^{\prime}_{1}\) now, \(U_{1}\) will still separate the total space into two half-spaces spanned by basis states with \(q_{1} = 0\) versus \(q_{1} = 1\), but exactly which “0” term is paired with which “1” term will be different. \(U_{2}\) now will separate into two half-spaces with \(q_{1} \oplus q_{2} = 0\) versus \(q_{1} \oplus q_{2} = 1\), and \(U_{3}\) will separate into two half-spaces with \(q_{1} \oplus q_{2} \oplus q_{3} = 0\) versus \(q_{1} \oplus q_{2} \oplus q_{3} = 1\). Indeed this prediction is verified by carrying out the algebra on \(\varphi_{1}^{\prime }\) in the same manner as in Eq. (1):

$$\varphi_{1}^{\prime } = \left( {\begin{array}{*{20}c} {a_{0} } \\ {a_{1} } \\ {a_{3} } \\ {a_{2} } \\ {a_{6} } \\ {a_{7} } \\ {a_{5} } \\ {a_{4} } \\ \end{array} } \right) \to U_{1} \varphi_{1}^{\prime } = \left( {\begin{array}{*{20}c} {u_{1} a_{0} + u_{2} a_{6} } \\ {u_{1} a_{1} + u_{2} a_{7} } \\ {u_{1} a_{3} + u_{2} a_{5} } \\ {u_{1} a_{2} + u_{2} a_{4} } \\ {u_{2} a_{0} - u_{1} a_{6} } \\ {u_{2} a_{1} - u_{1} a_{7} } \\ {u_{2} a_{3} - u_{1} a_{5} } \\ {u_{2} a_{2} - u_{1} a_{4} } \\ \end{array} } \right){;}\quad U_{2} \varphi_{1}^{\prime } = \left( {\begin{array}{*{20}c} {u_{1} a_{0} + u_{2} a_{3} } \\ {u_{1} a_{1} + u_{2} a_{2} } \\ {u_{2} a_{0} - u_{1} a_{3} } \\ {u_{2} a_{1} - u_{1} a_{2} } \\ {u_{1} a_{6} + u_{2} a_{5} } \\ {u_{1} a_{7} + u_{2} a_{4} } \\ {u_{2} a_{6} - u_{1} a_{5} } \\ {u_{2} a_{7} - u_{1} a_{4} } \\ \end{array} } \right){;}\quad \, U_{3} \varphi_{1}^{\prime } = \left( {\begin{array}{*{20}c} {u_{1} a_{0} + u_{2} a_{1} } \\ {u_{2} a_{0} - u_{1} a_{1} } \\ {u_{1} a_{3} + u_{2} a_{2} } \\ {u_{2} a_{3} - u_{1} a_{2} } \\ {u_{1} a_{6} + u_{2} a_{7} } \\ {u_{2} a_{6} - u_{1} a_{7} } \\ {u_{1} a_{5} + u_{2} a_{4} } \\ {u_{2} a_{5} - u_{1} a_{4} } \\ \end{array} } \right)$$
(3)

In Eq. (3) we see the effect of \(U_{1}\) is \(\left[ {\left( {a_{0} ,a_{6} } \right),\left( {a_{1} ,a_{7} } \right),\left( {a_{2} ,a_{4} } \right),\left( {a_{3} ,a_{5} } \right)} \right]\) with the same “0” entries and “1” entries but different pairing from the previous \(\left[ {\left( {a_{0} ,a_{4} } \right),\left( {a_{1} ,a_{5} } \right),\left( {a_{2} ,a_{6} } \right),\left( {a_{3} ,a_{7} } \right)} \right]\). On the other hand, the effect of \(U_{2}\) is \(\left[ {\left( {a_{0} ,a_{3} } \right),\left( {a_{1} ,a_{2} } \right),\left( {a_{6} ,a_{5} } \right),\left( {a_{7} ,a_{4} } \right)} \right]\) where the “0” entries are now {\(a_{0}\), \(a_{1}\), \(a_{6}\), \(a_{7}\)}—these entries in the original \(\varphi_{1}\) vector (not \(\varphi_{1}^{\prime }\)) correspond to {\(\left| {000} \right\rangle \sim a_{0}\), \(\left| {001} \right\rangle \sim a_{1}\), \(\left| {110} \right\rangle \sim a_{6}\), \(\left| {111} \right\rangle \sim a_{7}\)}—so indeed for these entries \(q_{1} \oplus q_{2} = 0\). Similarly the effect of \(U_{3}\) is \(\left[ {\left( {a_{0} ,a_{1} } \right),\left( {a_{3} ,a_{2} } \right),\left( {a_{6} ,a_{7} } \right),\left( {a_{5} ,a_{4} } \right)} \right]\) where the “0” entries are {\(a_{0}\), \(a_{3}\), \(a_{6}\), \(a_{5}\)} which correspond to \(q_{1} \oplus q_{2} \oplus q_{3} = 0\) in the original \(\varphi_{1}\) vector.

Characterizing quantum circuits with functional configurations

With these results we are now ready to introduce the idea of using qubit functional configurations to characterize quantum circuits. Starting with an arbitrary initial state \(\left| {\varphi_{1} } \right\rangle = \sum\limits_{i = 0}^{7} {a_{i} \left| i \right\rangle }\), we can consider the qubits as functional holders with the initial qubit functional configuration of \(\left( {f_{1} = q_{1} ,f_{2} = q_{2} ,f_{3} = q_{3} } \right)\). As long as there is no CNOT gate applied, this functional configuration remains in place and specifies a unique rule for all possible 1-qubit unitaries: which entries are considered “0”, which are considered “1”, and how the “0” and “1” entries are paired for each \(U_{k}\). As long as the configuration stays in place, a maximum number of \(n = 3\) \(U_{k}\)’s can be applied with one unitary on each qubit, and any additional 1-qubit unitary would be redundant. After the last \(U_{k}\) under this configuration has been applied and before the first CNOT happens, the state changes to \(\left| {\varphi_{2} } \right\rangle = \sum\limits_{i = 0}^{7} {b_{i} \left| i \right\rangle }\) with new entries in the state vector. Now suppose a sequence of CNOT gates are applied without any 1-qubit unitary in between, right before the next \(U_{k}\) happens, the entries are not modified but only shuffled, and this creates a new layer of functional configuration such as \(\left( {f_{1} = q_{1} ,f_{2} = q_{1} \oplus q_{2} ,f_{3} = q_{1} \oplus q_{2} \oplus q_{3} } \right)\) discussed above. This second layer of functional configuration now in place specifies its own unique rule for all possible 1-qubit unitaries that happen after, before the next CNOT gate is applied. Repeating this process we can analyze any arbitrary quantum circuits as follows:

In Fig. 1 an arbitrary quantum circuit can be decomposed into alternating sequences of 1-qubit \(U_{k}\) and CNOT gates. Each CNOT sequence prepares the current quantum state into a new layer of qubit functional configuration to specify the rule for the next \(U_{k}\) sequence on how the total space should be separated into “0” entries and “1” entries and how the “0” and “1” entries are paired. In particular, any \(U_{k}\) finds the appropriate “0” and “1” entries according to the \(k\)th functional \(f_{k}\) and the pairing pattern is defined by the entire functional configuration. After this \(U_{k}\) sequence is completed, right before the next CNOT sequence begins, a quantum state with new entries is created, which can then be used as the initial state for the next iteration. This process can be repeated many times until the end of the circuit where the last layer of functional configuration specifies the rule for the final \(U_{k}\) sequence to create the final state. Together, all the layers of functional configurations form a sequence of configurations that allows us to define a type of quantum circuits.

Figure 1
figure 1

Graphical illustration of an arbitrary quantum circuit analyzed with multiple layers of qubit functional configurations. Note here we use the symbol \(U_{k}\) to mean “any 1-qubit gate on the \(k^{th}\) qubit”, thus \(U_{k}\) is not a particular gate and may represent different 1-qubit gates across different layers.

Note that the decomposition of an arbitrary quantum circuit into 1-qubit gates and CNOT gates is for generating the qubit functional configurations—i.e. it is for theoretical analysis only and thus does not increase the burden of implementing the circuits. In addition, it is well known that40 such a decomposition will only increase the depth of the sequence polynomially, i.e. if the original quantum circuit length is polynomially scaled with the number of qubits, then the decomposition sequence is also polynomially scaled. This means we can classify and characterize any polynomial quantum circuit efficiently with our qubit functional configuration method.

Next we demonstrate the application of the functional configuration picture in Fig. 1 to analyzing the hardware-efficient ansatzes that are widely used in variational quantum algorithms43,44,45,46. A critical step in a variational quantum algorithm is to select the best ansatzes that are essential to the convergence rate and the quality of final results. Ansatzes are commonly specified by a general structure of quantum circuits and allow multiple continuous parameters to change in the process of variation. The ansatzes can be readily analyzed by our theory because their general structures can be described by the qubit functional configurations which allow the continuous variation of the parameters. To see how this works, the hardware-efficient ansatzes commonly include many identical layers, and within each layer there are two sub-layers: one sub-layer of parameterized 1-qubit unitaries and one sub-layer of two-qubit entanglers. The two-qubit entanglers are usually all CNOT gates with no 1-qubit unitaries in between, such that each entangler sub-layer can be considered as a single layer of qubit functional configuration as described above—this makes the hardware-efficient ansatzes natural application candidates for the qubit functional configuration theory. In the following examples, the ansatzes used in Ref.45. and Ref.46. are shown in Figs. 2 and 3 respectively, and the corresponding qubit functional configurations are shown in Eqs. (4) and (5) respectively.

Figure 2
figure 2

The quantum circuit of one layer of the hardware-efficient ansatz in Ref.45.

Figure 3
figure 3

The quantum circuit of one layer of the hardware-efficient ansatz in Ref.46.

The qubit functional configuration of the ansatz in Ref.45

$$\begin{aligned} f_{1} & = q_{2} \oplus q_{3} \oplus q_{4} \oplus q_{5} \oplus q_{6} ,\quad f_{2} = q_{1} \oplus q_{2} {, }\quad \, f_{3} = q_{1} \oplus q_{2} \oplus q_{3} ,\quad \, f_{4} = q_{1} \oplus q_{2} \oplus q_{3} \oplus q_{4} \\ f_{5} & = q_{1} \oplus q_{2} \oplus q_{3} \oplus q_{4} \oplus q_{5} ,\quad \, f_{6} = q_{1} \oplus q_{2} \oplus q_{3} \oplus q_{4} \oplus q_{5} \oplus q_{6} \\ \end{aligned}$$
(4)

The qubit functional configuration of the ansatz in Ref.46

$$\, f_{1} = q_{1} \oplus q_{2} ,\quad \, f_{2} = q_{2} {, }\quad \, f_{3} = q_{1} \oplus q_{2} \oplus q_{3} ,\quad \, f_{4} = q_{2} \oplus q_{4} ,\quad \, f_{5} = q_{4} \oplus q_{5} \oplus q_{6} ,\quad \, f_{6} = q_{6}$$
(5)

In Eqs. (4) and (5) the differences between the two ansatzes in Figs. 2 and 3 are clearly shown by the corresponding qubit functional configurations. For example, in Eq. (5) \(f_{2}\) and \(f_{6}\) still keep their initial values \(q_{2}\) and \(q_{6}\), while in Eq. (4) all the qubit functionals have been changed. In general, the qubit functionals in Eq. (4) contain more qubit terms than those in Eq. (5), thus we should expect the qubits of the circuit in Fig. 2 to be more interconnected than those in Fig. 3. In this particular case, the ansatzes will repeat the same functional configuration for all the following layers; however, if we apply the theory to other types of quantum circuits, such as the quantum Fourier transform circuit studied in the Supplementary Information (SI) Section S1, each layer may have a different functional configuration and the whole sequence of configuration layers characterize the circuit’s properties. So far the comparison of Eqs. (4) and (5) focuses on the structural differences between the two qubit functional configurations. In the SI Section S4 we discuss how such differences would translate into circuit properties when used in conjunction with the “unitary dependence theory” proposed in our recent study39.

As can be seen from the procedure described in and around Fig. 1, given any quantum circuit, we can generate its qubit functional configuration layers by analyzing the quantum gates one by one. This means the cost of applying the method to a given quantum circuit should be comparable to the circuit length, which can be polynomial or exponential in the number of qubits. Indeed, the qubit functional configuration describes the characteristic properties of a quantum circuit and thus should have the same complexity scaling as the circuit itself.

Studying quantum circuits in terms of the qubit functional configuration types has various benefits:

  1. 1.

    Because the process in Fig. 1 is entirely general, any arbitrary quantum circuit can be analyzed by this picture and thus belongs to one of the types defined by the functional configuration sequence.

  2. 2.

    As explained earlier, for any particular layer of functional configuration, a maximum number of n 1-qubit unitaries can be applied without redundancy, with one unitary for each qubit. In addition, the number of CNOT gates required to achieve any given functional configuration is also bounded. Therefore the total length L of a quantum circuit is closely related to the total number N of functional configuration layers in the circuit. In other words, the functional configuration picture captures the important property of circuit complexity. The exact relation between L and N will be derived in section "Circuit length in relation to the number of layers of functional configurations".

  3. 3.

    More importantly, any particular sequence of the functional configurations contains the characteristic information of how the state vector entries are collectively modified by 1-qubit unitaries, while not fixing the actual \(U_{k}\) sequences—this allows us to group a large collection of quantum circuits together to be classified under a single type defined by the functional configuration sequence. In fact, as the parameters of any 1-qubit unitary can be varied continuously in the complex number domain, there are uncountably infinite number of possible quantum circuits with a given length. However, for a functional configuration sequence of a given length, there are only finite number of possible sequences, thus by this picture we are able to classify an uncountably infinite collection with finite number of types.

Any particular type of quantum circuits has its unique sequence of functional configurations, and each layer of functional configuration defines a unique way by which 1-qubit unitaries work on the state vector entries. As detailed in Ref.41, the duality between the linear functional space \(V^{*}\) and the bit string space V leads to a one-to-one correspondence between each functional and a unique partition of the bit strings—defined by two half-sets specified by setting “0” and “1” for the functional value respectively. When \(U_{k}\) acts on \(q_{k}\), the partition of \(f_{k}\) specifies which entries are “0” and which are “1”, while the partitions of all other functionals define how the “0” entries are paired with the “1” entries. Consequently if a particular functional \(f_{k}\) appears in one configuration but not in another, then the 1-qubit unitaries will behave differently in the two configurations and thus two quantum circuits of different configuration types have different characteristics. Even if two configurations contain the same collection of functionals, two different permutations of these functionals will in general produce different quantum circuits. As detailed in the Supplementary Information (SI) Section S2, if there is only one layer, then e.g. the configuration \(\left( {f_{1} ,f_{2} ,f_{3} } \right)\) can be considered somewhat equivalent to \(\left( {f_{3} ,f_{1} ,f_{2} } \right)\) because \(U_{k}\) in \(\left( {f_{1} ,f_{2} ,f_{3} } \right)\) obeys the same rules as \(U_{k + 1}\) in \(\left( {f_{3} ,f_{1} ,f_{2} } \right)\) with \(U_{3 + 1} = U_{1}\). However, when multiple layers of configurations are present, then each corresponding configuration must permute in the same way for this equivalence to hold: e.g. \(\left( {f_{1} ,f_{2} ,f_{3} } \right) \to \left( {f_{4} ,f_{5} ,f_{6} } \right)\) is equivalent to \(\left( {f_{3} ,f_{1} ,f_{2} } \right) \to \left( {f_{6} ,f_{4} ,f_{5} } \right)\) but not to \(\left( {f_{3} ,f_{1} ,f_{2} } \right) \to \left( {f_{4} ,f_{6} ,f_{5} } \right)\). Hence we can conclude that the types of quantum circuits as defined by different sequences of functional configurations do not in general overlap with each other. When studying properties of quantum circuits with the gate decomposition sequence one often encounters the problem of having multiple gate sequences that produce the same total unitary operation, which means that gate sequences do not uniquely characterize quantum circuits. In the functional configuration picture however, all these “equivalent” gate sequences must produce the same functional configuration sequence, and the types defined by the functional configuration sequences uniquely characterize quantum circuits. This is another benefit offered by the functional configuration picture. A detailed example of how different gate sequences can produce the same functional configuration is presented in the SI Section S3.

Number of possible functional configuration types

Now a natural question is to ask how many possible functional configuration types there are for a single layer and over a fixed number of layers. For a single layer, because the functional space is the dual of the bit string space with \(2^{n}\) elements, there are \(2^{n}\) functionals (for details see Ref.41). Excluding the “0” functional, there are \(2^{n} - 1\) to choose from, and n locations to allocate them. The most naïve count would be \((2^{n} - 1)^{n}\), but not all of these are valid configurations. To see this first note that it is impossible for duplicate functionals to appear in two or more different locations. This is because e.g. if we have a configuration of \(\left( {f_{1} ,f_{2} = f_{1} ,f_{3} ...,f_{n} } \right)\) then the state vector will only have entries associated with the basis states \(\left| {00...} \right\rangle\) and \(\left| {11...} \right\rangle\) but not \(\left| {01...} \right\rangle\) and \(\left| {10...} \right\rangle\) (half of all dimensions have been lost for the state vector), and this cannot be always satisfied when the initial state are chosen arbitrarily. It turns out this non-duplication rule is a special example of a more general condition for valid configurations: for a configuration of \(\left( {f_{1} ,f_{2} ,f_{3} ...,f_{n} } \right)\), none of the \(f_{k}\)’s for \(k = 1,2, \, ..., \, n\) can be the sum of any number of other functionals. This is because otherwise if e.g. \(f_{7} = f_{1} + f_{2} + f_{5}\) then the value of \(f_{7}\) is no longer free such that the subspace defined by \(\left( {f_{1} ,f_{2} ,f_{5} ,f_{7} } \right)\) becomes \(\left( {f_{1} ,f_{2} ,f_{5} } \right)\) and half of the dimensions have been lost for the state vector. When we view the functionals as members of the linear space \(V^{*}\), then requiring any \(f_{k}\) is not the sum of any number of other functionals is the same as requiring linear independence for all \(f_{k}\)’s for \(k = 1,2, \, ..., \, n\) such that \(\sum\limits_{k = 1}^{n} {c_{k} f_{k} } = 0\) has only the trivial solution of all \(c_{k}\)’s being 0. Note that this linear independence is automatically enforced by using CNOT gates to create functional configurations. To see this start with any configuration of \(\left( {f_{1} ,f_{2} ,f_{3} ...,f_{n} } \right)\) with all functionals linearly independent, then applying \({\text{CNOT}}_{j \to h}\) will replace \(f_{h}\) with \(f_{j} + f_{h}\) which is still linearly independent from all other functionals. So any CNOT gate cannot break the linear independence when starting with linear independence. The initial configuration of any quantum circuit is \(\left( {f_{1} = q_{1} ,f_{2} = q_{2} ,f_{3} = q_{3} ...,f_{n} = q_{n} } \right)\) which has linear independence for all functionals, so indeed any CNOT sequence will automatically enforce the linear independence.

Now back to counting the possible configurations for a single layer, considering linear independence there are \(2^{n} - 1\) choices for \(f_{1}\), \(2^{n} - 2\) for \(f_{2}\), …, for \(f_{k}\) there are \(N_{f}\) number of choices:

$$N_{f} \left( {k,n} \right) = 2^{n} - 1 - \sum\limits_{i = 1}^{k - 1} {C\left( {k - 1,i} \right)} = 2^{n} - 2^{k - 1}$$
(6)

So the total possible number of configurations for one layer is:

$$N_{c} \left( n \right) = \prod\limits_{k = 1}^{n} {N_{f} \left( {k,n} \right)} = \prod\limits_{k = 1}^{n} {\left( {2^{n} - 2^{k - 1} } \right)}$$
(7)

Now over multiple layers, for clarity we reinforce the definition of layers of functional configurations. Referring to Fig. 1, start with the initial state \(\varphi_{1}\) and the initial configuration \(\left( {f_{1} = q_{1} ,f_{2} = q_{2} ,f_{3} = q_{3} \ldots ,f_{n} = q_{n} } \right)\), if the first gate applied is a 1-qubit unitary (i.e. the case in Fig. 1), we consider the initial configuration as the first layer; if the first gate is a CNOT gate (i.e. the case obtained by removing the first \(U_{k}\) sequence and combining the first two blocks in Fig. 1), we consider the configuration created by the first CNOT sequence as the first layer. After the first layer has been established, a sequence of 1-qubit unitaries can be applied according to the rule set by this configuration, and as long as there is no CNOT gate, the system stays in the first layer. Right before the next CNOT sequence happens, the state changes to \(\varphi_{2}\), and the configuration is reset to \(\left( {f_{1} = q_{1} ,f_{2} = q_{2} ,f_{3} = q_{3} \ldots ,f_{n} = q_{n} } \right)\). Now the next CNOT sequence applies, and right before the next 1-qubit unitary sequence we create the configuration of the second layer, which stays in place until the next CNOT sequence. Subsequent layers can be defined accordingly. We require that all layers after the first one cannot be the initial configuration \(\left( {f_{1} = q_{1} ,f_{2} = q_{2} ,f_{3} = q_{3} \ldots ,f_{n} = q_{n} } \right)\)—because otherwise no CNOT gate is applied after the reset and we can combine this layer with the previous one—then the total possible number of types defined by N layers of functional configurations is:

$$N_{t} \left( {n,N} \right) = \frac{{N_{c} \left( n \right)\left( {N_{c} \left( n \right) - 1} \right)^{N - 1} }}{n!} = \frac{{\prod\limits_{k = 1}^{n} {\left( {2^{n} - 2^{k - 1} } \right)} \left[ {\prod\limits_{k = 1}^{n} {\left( {2^{n} - 2^{k - 1} } \right)} - 1} \right]^{N - 1} }}{n!}$$
(8)

where the \(\left( {N_{c} \left( n \right) - 1} \right)^{N - 1}\) accounts for “all layers after the first one cannot be the initial configuration”, and \(n!\) accounts for the equivalence due to permutation of functionals in the first layer. To get a concrete idea of \(N_{t}\), for a 5-qubit system (like the simplest IBM quantum devices49 but with unlimited connectivity between qubits) over 1 layer of functional configuration, there are:

$$N_{t} (5,1) = \frac{{\prod\limits_{k = 1}^{5} {\left( {2^{5} - 2^{k - 1} } \right)} }}{5!} = 83328$$
(9)

Over 3 layers of functional configurations, there are:

$$N_{t} (5,3) = \frac{{\prod\limits_{k = 1}^{5} {\left( {2^{5} - 2^{k - 1} } \right)} \left[ {\prod\limits_{k = 1}^{5} {\left( {2^{5} - 2^{k - 1} } \right)} - 1} \right]^{2} }}{5!} = 8.3317318 \times 10^{18}$$
(10)

So the number of types \(N_{t}\) can be a gigantic number even with quite small values for n and N, but this is reasonable because we are considering all quantum circuits that are ever possible on n qubits and N layers with a finite number of types. In fact, the gigantic number \(N_{t}\) illustrates the immense potential of quantum computation as a small number of qubits can support such an enormous variety of quantum circuits over few layers. In addition, as detailed in the next section (section "Circuit length in relation to the number of layers of functional configurations"), the total number of gates required to realize any one of the \(N_{t}\) possible functional configurations is polynomial in both the qubit number n and the layer number N. This means all of the \(N_{t}\) functional configurations can be reached efficiently with a polynomial circuit if the layer number N is polynomial in n—consequently, although \(N_{t}\) is gigantic, as long as N is polynomial, we are indeed classifying all polynomial circuits that are possible with Eq. (8), such that the classification is relevant to our practical need in quantum computing to design polynomial circuits that can be efficiently implemented.

Circuit length in relation to the number of layers of functional configurations

How does the number N of layers relate to the length of the quantum circuit? As explained earlier, for any particular layer of functional configuration, a maximum number of n 1-qubit unitaries can be applied without redundancy, with one unitary for each qubit. So for any quantum circuit with N layers of functional configurations, the total number \(N_{U}\) of 1-qubit unitaries is \(N \le N_{U} \le nN\) (at least one unitary for each layer). This means that once the circuit type defined by the sequence of functional configurations has been fixed, the length of the circuit can only vary by up to \(nN\). Now if more generally the circuit type is not fixed but the number of layers is fixed, to evaluate how many CNOT gates are possible for one layer, we need to study how many CNOT gates are required to reach an arbitrary functional configuration. Starting with any functional configuration \(\left( {f_{1} ,f_{2} ,f_{3} ...,f_{n} } \right)\), applying \({\text{CNOT}}_{j \to h}\) will replace \(f_{h}\) with \(f_{j} + f_{h}\) such that the process of creating functional configurations is dynamical and it is difficult to exactly evaluate how many CNOT gates are required. However, we can calculate an upper bound for the number of CNOT gates by storing the initial configuration of \(\left( {f_{1} = q_{1} ,f_{2} = q_{2} ,f_{3} = q_{3} \ldots ,f_{n} = q_{n} } \right)\) on n ancilla qubits. To do this we start with the initial configuration \(\left( {f_{1} = q_{1} ,f_{2} = q_{2} ,f_{3} = q_{3} \ldots ,f_{n} = q_{n} } \right)\) on the computational qubits, prepare the ancilla qubits as \(q_{{a_{1} }} = \left| 0 \right\rangle\), \(q_{{a_{2} }} = \left| 0 \right\rangle\), …, \(q_{{a_{n} }} = \left| 0 \right\rangle\) and apply the gates \({\text{CNOT}}_{{k \to a_{k} }}\) for \(k = 1, \ldots ,n\) with the computational qubits as controls and the ancilla qubits as targets, such to copy the configuration \(\left( {f_{{a_{1} }} = q_{1} ,f_{{a_{2} }} = q_{2} ,f_{{a_{3} }} = q_{3} \ldots ,f_{{a_{n} }} = q_{n} } \right)\) on the ancilla qubits. This way when we modify the configuration on the computational qubits, the ancilla qubits still retain the initial configuration. After this we can create the wanted functionals one by one, e.g. if for the next layer the wanted configuration requires \(f_{1} = q_{2} \oplus q_{3} \oplus q_{5}\), then we can use the corresponding ancilla qubits as controls and the 1st computational qubit as target such as \({\text{CNOT}}_{{a_{1} \to 1}}\), \({\text{CNOT}}_{{a_{2} \to 1}}\), \({\text{CNOT}}_{{a_{3} \to 1}}\), \({\text{CNOT}}_{{a_{5} \to 1}}\) (order does not matter), and we will create \(q_{2} \oplus q_{3} \oplus q_{5}\) on the 1st functional location. Note here \({\text{CNOT}}_{{a_{1} \to 1}}\) is to remove \(q_{1}\) from \(f_{1}\). As the ancilla configuration is never changed in this process, we can repeat the same procedure when creating \(f_{2}\), \(f_{3}\), and all the way to \(f_{n}\). This systematic process of creating any functional configuration is illustrated in Fig. 4 with a 3-qubit example.

Figure 4
figure 4

A 3-qubit example of systematically creating any functional configuration by first storing the initial configuration on 3 ancilla qubits and then creating the functionals one by one without changing the ancilla qubits.

With this process, for each \(f_{k}\), the functional that requires the most CNOT gates is the sum of all qubits except \(q_{k}\), e.g. \(f_{1} = q_{2} \oplus q_{3} \oplus ... \oplus q_{n}\), which requires n CNOT gates. Therefore the number of CNOT gates required to reach any functional configuration cannot exceed \(n \times n = n^{2}\). The situation is similar for all subsequent layers, hence the number of CNOT gates over N layers cannot exceed \(n^{2} N\). In practice this upper bound may not be reached due to the linear independence constraint. Overall to achieve any single layer of configuration we need at most n \({\text{CNOT}}_{{k \to a_{k} }}\) gates and \(n^{2}\) \({\text{CNOT}}_{{a_{j} \to k}}\) gates, and the total over N layers is \(\left( {n^{2} + n} \right)N\) CNOT gates. The least number we need is one CNOT for all the layers after the first one, so it is \(\left( {N - 1} \right)\) gates, and we have \(N - 1 \le N_{{{\text{CNOT}}}} \le \left( {n^{2} + n} \right)N\), with the right equality not necessarily achievable. Now we see that even with just 5 qubits and a single layer \(N = 1\), the possible length of the quantum circuits is \(1 \le N_{U} \le 5\) 1-qubit unitaries and \(0 \le N_{{{\text{CNOT}}}} \le 30\) CNOT gates, so the number of types at 83,328 in Eq. (9) becomes more reasonable. Here we remark that on a case-by-case basis, the procedure to create functional configurations by ancilla qubits may be far less efficient compared to working with the computational qubits only. For example, the configuration \(\left( {f_{1} = q_{1} ,f_{2} = q_{1} \oplus q_{2} ,f_{3} = q_{1} \oplus q_{2} \oplus q_{3} } \right)\) can be easily reached by \({\text{CNOT}}_{1 \to 2}\) and then \({\text{CNOT}}_{2 \to 3}\); while using ancilla qubits we first need three \({\text{CNOT}}_{{k \to a_{k} }}\) gates and then \({\text{CNOT}}_{{a_{1} \to 2}}\), \({\text{CNOT}}_{{a_{1} \to 3}}\), and \({\text{CNOT}}_{{a_{2} \to 3}}\), requiring 6 CNOT gates in total. However the ancilla method is more systematic thus to allow us to bound the maximum number of CNOT gates needed. Even with this inefficiency, the upper bound of \(nN\) and \(\left( {n^{2} + n} \right)N\) are both polynomial in n and N such that if N is polynomial in n then the maximum length of the quantum circuits classified by N layers of functional configurations is also polynomial in n: this means that not only the quantum circuits belonging to the same type are either all polynomial or all exponential, but also the quantum circuits of types with the same number of layers are either all polynomial or all exponential. In other words, the functional configuration picture captures the important property of circuit complexity.

Potential applications

The qubit functional configuration picture described in section "Theory of the qubit functional configuration" provides a systematic framework for characterizing quantum circuits. As discussed in section "Characterizing quantum circuits with functional configurations", the framework assigns all possible quantum circuits of a given length into finite types that in general do not overlap. In addition, the characteristic information of how the state vector entries are collectively modified by 1-qubit unitaries is described by the functional configuration sequence. In the following we discuss potential applications provided by this new theory.

Quantum algorithm development

The classification of quantum circuits will allow us to systematically study circuits of the same type or similar types. Numerous quantum algorithms with diverse mechanisms and functionalities have been proposed in the past 30 years, yet these discoveries are mostly made on a case-by-case basis. A systematic study of these algorithms based on the functional configuration types will potentially help us understand why they work, and such knowledge may lead to improvements on existing algorithms and discovery of new algorithms. As demonstrated by the application examples in section "Characterizing quantum circuits with functional configurations", The ansatzes used in variational quantum algorithms43,43,44,46 are natural candidates for classification studies using the qubit functional configuration theory. The hybrid classical-quantum platform of the variational quantum algorithms has led to successful applications such as the variational quantum eigensolver (VQE)26 and the quantum approximate optimization algorithm (QAOA)28. The properties and capabilities of variational quantum algorithms have been studied by descriptors such as expressibility and entangling capability50 that describe how much of the solution space can be explored by varying the parameters. On the other hand, our qubit functional configuration theory provides a different perspective by classifying various ansatzes into finite mathematical structures such that their behaviors and properties can be studied collectively. In other words, the qubit functional configuration picture may allow us to systematically understand why certain ansatzes have better (or worse) performances when treating different kinds of problems.

The minimal gate decomposition of a quantum circuit

The qubit functional configuration picture may allow us to systematically find a minimal gate decomposition sequence of any given quantum circuit. Without the picture, the gate decomposition of a given quantum circuit is not unique (see section "Characterizing quantum circuits with functional configurations" and the SI Section S3), and there is no systematic approach to find the minimal gate sequence or verify that a known gate sequence is minimal. With the picture, for any given quantum circuit, if one gate decomposition sequence (non-minimal) is known, we will then find the functional configuration sequence that defines the type for the circuit. Now for each layer of functional configuration, the minimal CNOT gate sequence to create this configuration is a well-defined sequence. Joining the minimal CNOT sequence for each configuration layer together and inserting the appropriate 1-qubit unitaries, we will have the minimal overall gate sequence for the quantum circuit. A worked-out example of how this may work is found in the SI SectionS2. Even further, as in Eq. (7) there are only finite number of possible functional configurations for a single layer, thus for small numbers n of qubits, we could even construct a complete dictionary of all possible functional configurations with the corresponding minimal gate sequences, such that the minimal gate sequence for any arbitrary quantum circuit can be retrieved by searching the functional configuration index.

Conclusion

In this work we have developed a theory of characterizing all quantum circuits with qubit functional configurations. In particular, an arbitrary quantum circuit can be decomposed into alternating sequences of 1-qubit unitary \(U_{k}\) gates and CNOT gates. Each CNOT sequence prepares the current quantum state into a layer of qubit functional configuration to specify the rule for the next \(U_{k}\) sequence on how to collectively modify the state vector entries. All the layers together form a sequence of functional configurations that defines a unique type of quantum circuits with great variety. For uncountably infinite possible quantum circuits, there are only finite number of functional configuration types for a given length, and this number has been evaluated in detail. More importantly, these types uniquely characterize properties of the corresponding quantum circuits. We have demonstrated an application of the theory to the hardware-efficient ansatzes used in variational quantum algorithms by analyzing them in terms of the functional configurations. We have also proposed a systematic procedure of creating any arbitrary functional configuration by storing the initial configuration on ancilla qubits. For potential applications, the functional configuration picture captures the important property of circuit complexity of any given quantum circuit and may allow us to define a minimal sequence for it. So far as we know, the qubit functional configuration theory is the first of its kind that can characterize huge numbers of quantum circuits by finite mathematical structures, and thus may lead to systematic development of efficient quantum circuits that scale polynomially with the qubit number.