1 Introduction

Interest in quantum computing has increased with finding its great potential in solving specific problems, such as database search and factorization [1,2,3,4,5,6,7]. The theory of quantum computing is getting more and more mature since it was introduced by Feynman and Deutsch in the 1980s [8, 9]. Compared with classical computing, quantum computing has distinguished advantages in terms of the speed of computing. Quantum computation has revolutionized computer science, showing that the processing of quantum states can lead to a tremendous speed-up in solving a class of problems compared to traditional algorithms that process classical bits [2, 3].

In practice, a large-scale quantum computer is needed to solve complex problems at higher speeds. However, there are some problems to implement it, such as quantum decoherence. Its reason is the interaction of qubits with the environment and together, leading to more sensitivity to errors [10,11,12]. One reasonable solution to overcome the mentioned problem is reducing the number of qubits used in processing information using a distributed quantum computer. A distributed quantum computer can be built using two or more low-capacity quantum computers with fewer qubits similar to distributed nodes or subsystems in a network of a quantum system for solving a single problem [13, 14]. In this structure, a quantum (classical) communication protocol is needed to communicate between separate nodes.

Distributed quantum computation first had been proposed by Grover [15], Cleve and Buhrman [16], and Cirac et al. [17]. Later, Ying and Feng [11] defined an algebraic language for describing distributed quantum circuits. After that, Van Meter et al. [18] proposed a VBE carry-ripple adder structure in a distributed quantum circuit. In the meantime, some of the works in this field focus on the communication part. In 2001, Yepez [19] suggested two types of quantum computers. In a type-I quantum computer, quantum communication is used for interconnecting the subsystems of a distributed quantum computer. In type-II quantum computers, classical communication is used instead of quantum communication to interconnect the subsystems or nodes of distributed quantum computers.

In quantum communication, one of the well-known methods for transmitting qubits between nodes of the network is quantum teleportation (QT) [20,21,22,23]. In teleportation, qubits are transmitted between two users or nodes without physically moving them. Then, computations are locally performed on qubits; this method is also known as teledata. There are also some works with a focus on optimizing the communication cost of a distributed quantum circuit. Assuming qubit teleportation as a costly resource, such works try to reduce such teledata [24,25,26]. In [24], the authors considered consecutive CNOT gates with common control or target qubits. They showed that such structures are led to just one teleportation for executing both gates. In [25] and [26], this idea has been expanded, and algorithms have been suggested to reduce the number of required teleportation. All possible configurations that could result in such communication reductions were considered. Optimizing the number of teleportation using heuristic methods, dynamic programming approach, and evolutionary algorithm have also been considered in [27,28,29], respectively. An alternative approach is called telegate that executes gates remotely and directly using the quantum entanglement when nodes are in a long distance. One of the challenges of telegate approach is to establish optimal implementations of \(n\)-qubit controlled-quantum gates between qubits that are located in different nodes of the distributed quantum computer. According to the considered library (Such as NCV, NCT, Clifford + T, etc.), different controlled gates can be used in synthesizing a transformation matrix of a quantum circuit. One of the well-known reversible and quantum gates is the Toffoli gate. Toffoli gate together with Hadamard gate constitutes a universal set for quantum computation. Also, multi-control Toffoli gates with more than two control qubits are widely used in quantum computing. So, it is crucial to implement a protocol for applying n-qubit remote Toffoli gate (controlled-NOT gate) between separate nodes of the network.

Only a few papers [30,31,32] have focused on implementing remote quantum gates in recent decades. Paper [30] presented a method for implementing remote n-qubit Toffoli gate. Also in [31], a method for implementing a remote three-qubit Toffoli gate using an auxiliary 4-dimensional quantum system is presented. In the paper, by synthesizing \(n\)-qubit Toffoli gates into three-qubit Toffoli gates, an implementation for \(n\)-qubit remote Toffoli gate is presented. These methods are not optimal in terms of quantum resources consumption when there are some qubits in one node or subsystem of the network.

Interconnection of multiple quantum subsystems using quantum internet through a network which is able to share qubits among remote subsystems have been considered in some recent works [33, 34]. The authors have considered teleportation as the key strategy which enables distributed quantum computing.

Many studies have been done on the implementation of non-local quantum gates. For example, in [35], the authors demonstrated a deterministic approach to teleporting a Toffoli gate among three distributed electron spin qubits with quantum dots in optical microcavities using an auxiliary electron spin performing measurements on the photons. They demonstrated the feasibility of their scheme with current technology as a way for distributed quantum computing. In [36], authors have implemented a Fredkin gate via the virtual excitation of the atoms, -cavity mode, and -fiber mode by controlling the non-local state-swap of two distant atoms. Their scheme can be useful in distributed quantum computation and remote quantum information processing. An all-optical non-local quantum nondemolition sum gate has been experimentally demonstrated in [37] applicable to physically separated quantum states connected by classical communication channels.

In this paper, we presented a general protocol for implementing the remote n-controlled-U gate using at least resources. Besides, compared to the previous works (for Toffoli gate’s case), this method is especially optimal when many qubits belong to one part, or subsystem.

The rest of the paper is organized as follows: Sect. 2 presents some related background about quantum computation and distributed quantum circuits. In Sect. 3, the proposed method is introduced in detail. Section 4 presents a comparison and discussion about the proposed method. Finally, Sect. 5 concludes the paper.

2 Basic concepts

Quantum states can be represented by vectors or a more famous notation of Dirac Bra-Ket. Kets (shown as \(|x\rangle\)) display column vectors and are generally used to describe quantum states. The Bra notation (shown as \(\langle x|\)) displays a transpose conjugate of x vector (\(|x\rangle\)). Basic states of \(|1\rangle\) and \(|0\rangle\) can be stated as vectors of \(\left[ {0{ }1} \right]^{T}\) and \(\left[ {1{ }0} \right]^{T}\), respectively. Any combination of \(|1\rangle\) and \(|0\rangle\) states (\(\alpha \left| 0 \right. + \beta |1\rangle\)) can be represented as \(\left[ {\alpha \beta } \right]^{T} \varepsilon C^{2}\), in which \(C\) denotes the set of complex numbers.

A qubit is a unit vector in a complex two-dimensional space. The specific basis vectors with the notation of \(|0\rangle\) and \(|1\rangle\) have been selected for this space. The base vectors of \(|0\rangle\) and \(|1\rangle\) are quantum counterparts of classical bits of 0 and 1, respectively. Unlike classical bits, qubits can be in any superposition of \(|0\rangle\) and \(|1\rangle\) like \(\alpha \left| 0 \right. + \beta |1\rangle\) where α and β are the complex numbers such that \(\left| \alpha \right|^{2} + \left| b \right|^{2} = 1\). In such a superposition, \(\left| \alpha \right|^{2}\) and \(\left| \beta \right|^{2}\) show the probability of observations with the base of \(|0\rangle\) and \(|1\rangle\), respectively.

2.1 Quantum and reversible gates

Quantum logic is inherently reversible [1]. Quantum computation can be synthesized from the transformation matrix of a quantum operation to a network of library gates usually in the circuit model form. Each quantum gate is a linear transformation defined on the n-qubit Hilbert space by the unitary matrix. The matrix U is unitary if \(UU^{\dag } = 1{ }\) where \(U^{\dag }\) is the conjugate transpose of matrix U. In the following, a definition of well-known quantum and reversible gates used in the proposed method are presented. The first one is \(n\)-qubit Toffoli gate [38], which is also represented as \(TOF\left( {C, T} \right)\), where \(C = \left\{ {x_{{i_{1} }} ,x_{{i_{2} }} , \ldots ,x_{{i_{m} }} } \right\} \subset X\) is a set of control lines, and \(T = \left\{ {x_{j} } \right\}\) with \(C \cap T = 0\) is the target line. If all the control lines have value 1, the target line is inverted; otherwise, the value on the target line is passed through unchanged. Especially, for m = 0, m = 1, and m = 2 the gates are called NOT, CNOT, and C2NOT (Toffoli), respectively. Other operations used in the proposed method are Hadamard, Z (\(\sigma_{Z}\)) and X operations that can be defined as the following:

$$ H = \frac{1}{\sqrt 2 }\left[ {\begin{array}{*{20}c} 1 & 1 \\ 1 & { - 1} \\ \end{array} } \right], Z = \left[ {\begin{array}{*{20}c} 1 & 0 \\ 0 & { - 1} \\ \end{array} } \right], X = \left[ {\begin{array}{*{20}c} 0 & 1 \\ 1 & 0 \\ \end{array} } \right] $$
(1)

Figure 1a–d shows schematics of Hadamard, CNOT, Toffoli, and controlled-Z, respectively.

Fig. 1
figure 1

Schematic of a Hadamard, b CNOT, c Toffoli, and d controlled-Z

2.2 Distributed quantum computation

A Distributed Quantum Circuit (DQC) is a network consisting of limited-capacity Quantum Circuits (QCs), known as partitions or nodes of the network. These nodes are located at a certain from each other and in overall emulate a quantum system's functionality. These nodes are connected via a specific quantum communication channel such as teleportation or a classical channel and send their qubits or measurement results to each other. In quantum communication protocols, entanglement is the main resource for linking two separate parts. In this paper, we focus on improving this quantum resource.

There are two kinds of quantum gates in the DQC, namely, local and global gates. In a local gate, controls and target qubits belong to the same partition, node, or subsystem. In contrast, in a global gate, control and target qubits belong to different partitions, nodes, or subsystems.

Our proposed method for implementing an n-qubit controlled-U gate in a distributed quantum circuit is described in the next section. This gate can be used in a distributed quantum system.

3 Proposed protocol

In this section, a novel protocol is presented for implementing a global (remote) \(n\)-qubit controlled-\(U\) gate in a distributed quantum circuit. Then the protocol is especially applied for implementing a Toffoli gate. Figure 2a shows the proposed protocol for an \(m.n\)-qubit controlled-U gate distributed between m remote nodes, parts, or subsystems, A, B,…, M. As shown in Fig. 2b, control lines of corresponding U gate are qubits \(A_{1} , \ldots ,A_{n} ,B_{1} , \ldots ,B_{n} , \ldots ,M_{1} , \ldots ,M_{n - 1}\), and the target line is \(M_{n}\).

Fig. 2
figure 2

a Implementation of global (\(m.n)\)-qubit controlled- \(U\) gate. b Schematic of the corresponding \((m.n)\)-qubit controlled-\(U\) gate

The steps of the proposed protocol are as the following:

  • Step 1. If some qubits exist in possession of one node, section, or subsystem, they are placed in the same group. Especially if the target line exists in one section or node, it is called the target group. For example, Fig. 2a shows a remote \(m.n\)-qubit controlled-U gate in possession of M sections A, B,…, M, which can be converted into M groups: Group A, Group B,… and finally Target Group.

  • Step 2. For each group, different from the target group, an entangled state (Bell state) is added, which owns this group and target group. For example, consider two distinct parts (Group A and Group B) and Target Group in Fig. 2. So, it needs two independent Bell states between Group A and Target Group (qubits \(A_{e}\) and \(M_{e1}\)) and also, Group B and Target Group (\(B_{e}\) and \(M_{e2}\)).

  • Step 3. An n-qubit Toffoli gate is applied between each group as the control line and its corresponding entangled qubit as the target line. Then, a basis-Z measurement is applied to the corresponding entangled qubit. Its result is then transmitted to another entangled qubit that belongs to the target group using the classical channel. If its result is \(\left| 1 \right\rangle\) a NOT (\(X\)) gate is applied in the corresponding target group. For example, in Fig. 2a (n + 1)-qubit Toffoli gate is applied between qubits \(A_{1}\) to \(A_{n}\) as the control lines and \(A_{e}\) as the target line. Afterward, a measurement based on Z on qubit \(A_{e}\) is applied, and its result is transmitted to the target group with a classical channel. Then, according to it, a CNOT gate is applied so that the measurement result is as control qubit and qubit \(M_{e1}\) as target qubit. This action is done for other groups (except the target group).

  • Step 4. A controlled-U gate is applied so that all qubits that belong to the Target Group are as control lines, and the main target qubit is the target line. For example, in Fig. 2, a controlled-U gate is applied to qubits \(M_{e1} , M_{e2} ,M_{e3} ,M_{1} , \ldots M_{n - 1}\) as the control lines and \(M_{n}\) as a target line.

  • Step 5. A measurement based on X is applied to entangled qubits that belong to the target group. Then the results are transmitted to dependent groups to entangled state. After that, according to these results, a controlled-Z is applied to qubits in the dependent groups. For example, in Fig. 2, a measurement based on X is applied to qubit \(M_{e1}\) (\(M_{e2}\)) then, the results are transmitted to dependent groups, i.e., Group A (Group B). If results are \(\left| - \right\rangle\), then a controlled-Z gate is applied so that qubits \(A_{1}\) to \(A_{n - 1}\) (\(B_{1} to B_{n - 1}\)) are as the control lines, and \(A_{n}\) (\(B_{n}\)) is the target line. Finally, the corresponding remote U gate is implemented, and the protocol is successfully finished.

It is important to note that the above protocol can also be used straightforward and unchanged for a multi-target Toffoli gate. In this case, for each target qubit located in each node of the network, a target group is assigned. For example, suppose one of the target qubits is in group C, and two target qubits are in group M. So, according to the above algorithm, group C and group M must be labeled as target group C and target group M.

To compare our proposed approach with the previous works, in the following two special cases of the global three-qubit Toffoli gate are explained in detail using the proposed protocol.

  1. a.

    Toffoli Gate on a Bipartite System

Suppose qubit(s) \(A_{1}\) (\(A_{1} , A_{2}\) in the second case) belong to Alice and qubits \(B_{1} , B_{2} (B_{1} )\) belong to Bob, as shown in Fig. 3a, b. In this case, there are two sections, nodes, or subsystems: group A and target group. For applying remote Toffoli gate between Alice and Bob so that qubits \(A_{1}\) and \(B_{1}\) (\(A_{1}\) and \(A_{2}\)) are control qubits, and the target is \(B_{2} (B_{1} )\), two qubits A and B are defined as a maximally entangled state to create a quantum channel between Alice and Bob as the following:

$$ \left| \phi \right\rangle_{AB} = \frac{1}{\sqrt 2 }\left( {\left| {00} \right\rangle + \left| {11} \right\rangle } \right) $$
(2)
Fig. 3
figure 3

Illustration of the five-qubit circuit used for quantum teleportation of Toffoli gate in the bipartite system a first case, b the second case

Figure 3a and b show the proposed protocol for implementing global Toffoli gate on qubits \(A_{1}\) and \(B_{1}\) (\(A_{1}\) and \(A_{2}\)) as control inputs and \(B_{2} (B_{1} )\) as the target for the first case (second case).

Then, the input state of the qubits \(A_{1} ,B_{1}\) and \(B_{2}\) (\(A_{1} , A_{2}\) and \(B_{1}\)) can be expressed in an arbitrary general state as Eq. (3).

$$ \left| {\Psi } \right\rangle_{AB} = d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle + d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle + d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle $$
(3)

The general state of the system is as Eq. (4)

$$ \left| \psi \right\rangle = \left| {\Psi } \right\rangle_{AB} \otimes \left| \phi \right\rangle_{AB} = \frac{1}{\sqrt 2 } (d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle + d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle + d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle ) \otimes (\left| {00} \right\rangle + \left| {11} \right\rangle ) $$
(4)

Then, the following steps are applied:

  • Step 1. Controlled-NOT gate (Toffoli gate) is applied so that \({A}_{1}\) (\({A}_{1}\) and \({A}_{2}\)) is as control qubit, and \(A\) is the target. The next state of the system is as Eq. (5) (Eq. (6)).

    $$ \begin{aligned} CNOT_{A1,A} \left| {\Psi } \right\rangle = & \frac{1}{\sqrt 2 } \left[ {(d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle } \right)\left| {00} \right\rangle + \\ & (d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle + d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle )\left| {10} \right. + \\ & (d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle )\left| {11} \right. + \\ & (d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle + d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle )\left| {01} \right\rangle ]_{{A_{1} B_{1} B_{2} AB}} \\ \end{aligned} $$
    (5)
    $$ \begin{aligned} TOF_{{A_{1} ,A_{2} ,A}} \left| {\Psi } \right\rangle = & \frac{1}{\sqrt 2 } \left[ {(d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle + d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle } \right)(\left| {00} \right\rangle + \left| {11} \right\rangle ) \\ & + (d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle )(\left| {10} \right\rangle + \left| {01} \right\rangle )]_{{A_{1} A_{2} B_{1} AB}} \\ \end{aligned} $$
    (6)
  • Step 2. Alice applies single-qubit measurement on her qubit \(A\) in \(Z\)-basis. Then, according to that, she notifies to Bob her result and applies \(X\) operation to his qubits so that if Alice’s measurement result be one, Bob applies \(X\) operation to qubit \(B\).

  • Step 3. In this step, Bob applies a local Toffoli gate (CNOT gate) between qubits \(B_{1} ,B\) (\(B\)) as control qubits and \(B_{2}\) (\(B_{1}\)) as the target so that if qubits \(B_{1}\) and B (B) be one then, target \(B_{2}\) (\(B_{1}\)) is one. Afterward, the general state of the system is as Eq. (7) (Eq. (8)).

    $$ \begin{aligned} TOF\left( {B_{1} ,B,B_{2} } \right)CNOT_{A1,A} \left| {\Psi } \right\rangle = & \frac{1}{\sqrt 2 } \left[ {(d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle } \right)\left| 0 \right\rangle + \\ & (d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle + d_{6} \left| {111} \right\rangle + d_{7} \left| {110} \right\rangle )\left| 1 \right\rangle ]_{{A_{1} B_{1} B_{2} B}} \\ \end{aligned} $$
    (7)
    $$ \frac{1}{\sqrt 2 } \left[ {(d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle + d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle } \right)\left( {\left| 0 \right\rangle } \right) + (d_{6} \left| {111} \right\rangle + d_{7} \left| {110} \right\rangle )(\left| 1 \right\rangle )]_{{A_{1} A_{2} B_{1} B}} $$
    (8)
  • Step 4. After applying the Toffoli gate (CNOT gate), Bob applies a single-qubit measurement on his qubit B in X-basis. Then, he notifies his measurement result to Alice. Afterward, she applies Z (controlled-Z) operation, according to Bob’s measurement result. If his measurement result is \(\left| - \right\rangle\), she applies Z (controlled-Z \(Z\)) operation to \(A_{1}\) (\(A_{1}\) and \(A_{2}\)). Then, the general state of the system is as Eq. (9), and the protocol is successfully finished.

    $$ d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle + d_{4} \left| {100} \right\rangle d_{5} \left| {101} \right\rangle + d_{6} \left| {111} \right\rangle + d_{7} \left| {110} \right\rangle $$
    (9)
  1. b.

    Toffoli Gate on a Tripartite System

In this section, as shown in Fig. 4, the global Toffoli is implemented with two control qubit (\(A_{1}\) and \(B_{1}\)) belong to Alice and Bob, respectively, and the target belongs to Charlie (C). So, in this structure, there is three Group A, B, and Target Group. For this aim, we need a four-qubit entangled state as a quantum channel so that qubits A and B belong to Alice and Bob, and also qubits C1 and C2 belong to Charlie. The Quantum Channel can be described as Eq. (10).

$$ \left| \phi \right\rangle_{ABC} = \frac{1}{\sqrt 2 }\left( {\left| {00} \right\rangle } \right. + \left| {11} \right\rangle )_{{AC_{1} }} \otimes \frac{1}{\sqrt 2 }(\left| {00} \right\rangle + \left| {11} \right\rangle )_{{BC_{2} }} $$
(10)
Fig. 4
figure 4

Illustration of quantum teleportation of Toffoli gate in the tripartite system

Then, the initial state of the arbitrary qubits \(A_{1} ,B_{1}\), and C can be stated as Eq. (11).

$$ \left| {\Psi } \right\rangle_{ABC} = (d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle + d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle + d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle )_{{A_{1} B_{1} C}} $$
(11)

The general state of the system is as Eq. (12).

$$ \begin{aligned} \left| \psi \right\rangle = \left| {\Psi } \right\rangle_{ABC} \otimes \left| \phi \right\rangle_{ABC} = & \frac{1}{2} (d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle + d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle \\ & + d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle )_{{A_{1} B_{1} C}} \otimes (\left| {00} \right\rangle + \left| {11} \right\rangle )_{{AC_{1} }} \otimes (\left| {00} \right\rangle + \left| {11} \right\rangle )_{{BC_{2} }} \\ \end{aligned} $$
(12)

Then, the following steps are applied:

Step 1. CNOT gates are applied so that \(A_{1}\), \(B_{1}\) are control qubits, and A, B are the targets. The general state of the system is as (13).

$$ \begin{aligned} CNOT_{{A_{1} ,A}} CNOT_{{B_{1} B}} \left| \psi \right\rangle = & \frac{1}{2} [ \left( {d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle } \right)(\left| {00} \right\rangle + \left| {11} \right\rangle )(\left| {00} \right\rangle + \left| {11} \right\rangle ) + \left( {d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle } \right)(\left| {00} \right\rangle + \left| {11} \right\rangle )(\left| {10} \right\rangle + \left| {01} \right\rangle ) \\ & + \left( {d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle } \right)(\left| {10} \right\rangle + \left| {01} \right\rangle )(\left| {00} \right\rangle + \left| {11} \right\rangle ) \\ & + (d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle )(\left| {10} \right\rangle + \left| {01} \right\rangle )(\left| {10} \right\rangle + \left| {01} \right\rangle )]_{{A_{1} B_{1} CAC_{1} BC_{2} }} \\ \end{aligned} $$
(13)

Step 2. In this step, Alice and Bob apply single-qubit measurements on their qubits A and B in Z-basis, and notify their results to Charlie. Then, Charlie applies controlled-NOT operations to his qubits \(C_{1}\) and \(C_{2}\) according to Alice and Bob measurement results so that if the measurement result is \(\left| 1 \right\rangle\), then he applies X operation to corresponding qubits. The general state of the system is as (14).

$$ \frac{1}{2} \left[ { \left( {d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle } \right)\left| {00} \right\rangle + \left( {d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle } \right)\left| {01} \right\rangle + \left( {d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle } \right)\left| {10} \right\rangle + (d_{6} \left| {110} \right\rangle + d_{7} \left| {111} \right\rangle )\left| {11} \right\rangle } \right]_{{A_{1} B_{1} CC_{1} C_{2} }} $$
(14)

Step 3. Charlie applies a local Toffoli gate between qubits \(C_{1}\) and \(C_{2}\) as control qubits and C as the target. The next state is as (15).

$$ \frac{1}{2} \left[ { \left( {d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle } \right)\left| {00} \right\rangle + \left( {d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle } \right)\left| {01} \right\rangle + \left( {d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle } \right)\left| {10} \right\rangle + (d_{6} \left| {111} \right\rangle + d_{7} \left| {110} \right\rangle )\left| {11} \right\rangle } \right]_{{A_{1} B_{1} CC_{1} C_{2} }} $$
(15)

Step 4. Charlie applies an X-basis measurement on his qubits C1 and C2. Then he notifies its results to Alice and Bob, respectively. According to his results, Alice and Bob apply a Z operation when his result be \(\left| - \right\rangle\). The final state of the system is the following, and the protocol is successfully finished.

$$ \frac{1}{\sqrt 2 } \left[ {(d_{0} \left| {000} \right\rangle + d_{1} \left| {001} \right\rangle + d_{2} \left| {010} \right\rangle + d_{3} \left| {011} \right\rangle + d_{4} \left| {100} \right\rangle + d_{5} \left| {101} \right\rangle + d_{6} \left| {111} \right\rangle + d_{7} \left| {110} \right\rangle } \right]_{{A_{1} B_{1} C}} $$
(16)

4 Comparison and discussion

In this section, a comparison between the proposed protocol and the previous works [30, 31] is presented. Table 1 shows this comparison in terms of the number of entangled qubits, auxiliary qubits, operations, and also measurements. In this table, for simplicity, especially consider bipartite and tripartite Toffoli gates in the previous section in terms of the number of entangled gates, the number of auxiliary qubits, the number of applied operations, and the number of measurements. As shown in this table, CE, SM, and FM stand for controlled elevation introduced in [31], single-qubit measurement, and four-qubit measurement, respectively.

Table 1 Comparison of the proposed method with methods [30, 31] for a bipartite and tripartite Toffoli gate

As shown in this table, the method [31] uses additional resources such as a four-dimensional quantum system, three CE, one FM, and four entangled resources (especially for the Tripartite case) to implement a Toffoli gate. Also, the method proposed in [30] generally uses one entangled qubit to transmit each qubit. Besides, using additional gates such as CNOT, Toffoli, and Hadamard increases the costs of this protocol. As shown in this table, our method reduces entangled qubits and also the number of gates used. Therefore, it can implement a remote Toffoli gate with lower cost. In fact, we presented a method for applying n-qubit controlled-U gate using division of qubits’ ownership to groups. So, in this method, the result of each group is transmitted to the target group. In this regard, the proposed method has lower cost compared to the previous works, especially when we need to apply an n-qubit Toffoli gate with a group of qubits in one node or subsystem. Moreover, in this case, the method only uses one entangled qubit. For the general case, consider the scenario proposed in Fig. 2. This figure shows a remote U gate with m·n inputs so that n inputs belong to Alice, n inputs belong to Bob, and n inputs belong to Charlie, and so on. Table 2 shows a comparison between the proposed method and [30] for this scenario. As shown in this table, our method has used fewer resources compared with the previous one in terms of the number of entangled resources, operations, and measurements.

Table 2 Comparison of the proposed method with method [30] for the scenario proposed in Fig. 2 for \((m.n)\)-qubit controlled-U gate

5 Conclusion

In this paper, a general protocol with minimum required resources was presented for implementing a remote n-qubit controlled-U gate. For instance, the proposed method was applied for implementing a Toffoli gate in bipartite and tripartite systems. This method uses the lowest resources when many qubits belong to one node or subsystem of the network. The proposed method is related to a high-level abstract (circuit level) of the implementation of a remote n-qubit controlled-U gate, and it is independent of the particular physical system. According to many studies on the feasibility of realizing non-local gates, such as [35,36,37], the proposed method has the potential to be implemented in any existing technology.