2
$\begingroup$

You are given a quantum circuit with around 4-5 gates connected. The catch is that you know all the gates and the connection except one gate. For as many times as you want you can check what the output state would be for any input of your choice. How would you find the unknown gate?

I am thinking of writing gates in terms of the unitary matrices and then applying the unitary matrices on the input state . We can assume the unitary Matrix of unknown gate and then do inverse to calculate. But isn't that difficult to do with multi qubit gate? Is there a way to determine the unknown gate?

$\endgroup$
2
  • $\begingroup$ Is the unknown gate a 1-qubit, 2-qubit or n-qubit gate? $\endgroup$ Feb 4 at 13:21
  • $\begingroup$ Depending on the circuit, for simplicity let's assume a 2 qubit gate $\endgroup$
    – wizzywizzy
    Feb 4 at 13:38

4 Answers 4

3
$\begingroup$

In the following, I assume that the circuit uses $n$ qubits. Therefore, the state vector representing the global state has $2^n$ elements (complex numbers). If you are not given the output state, the unknown gate can be any gate and you will not be able to find it. Instead, if you are given the output state $|\psi'\rangle$, you can at least reduce the set of candidate gates that will produce the given output state. For a 2-qubit gate, you have 16 complex numbers to find (the elements of a $4 \times 4$ matrix). You can compute the vector representing the global state (say, $|\psi\rangle$) produced by the circuit until the layer that contains the gate you want to find. The remaining part of the circuit corresponds to a unitary $U$ that is function of the 16 unknown complex numbers. You have to solve $U|\psi\rangle = |\psi'\rangle$ to find such values. If the number of unknown complex numbers is larger (because the unknown gate operates on $2<k\leq n$ qubits), a sub-optimal solution could be searched using a soft computing approach (e.g., genetic algorithm).

$\endgroup$
4
  • $\begingroup$ Can you please elaborate a bit? Specifically from the global state part $\endgroup$
    – wizzywizzy
    Feb 4 at 15:40
  • $\begingroup$ I edited the answer to make it more clear. $\endgroup$ Feb 4 at 16:42
  • $\begingroup$ You have writen ...elements of 2x2 matrix..., however, two-qubit gate is described by 4x4 matrix, right? $\endgroup$ Feb 4 at 21:44
  • $\begingroup$ Yes, sorry I wrote that in a hurry, I corrected. $\endgroup$ Feb 4 at 21:53
2
$\begingroup$

Cancel out the known gates by surrounding the circuit with their inverses, then apply any process tomography method.

$\endgroup$
3
  • 1
    $\begingroup$ I think that the question is more about theoretical approach than how to do this on real quantum processor. $\endgroup$ Feb 4 at 21:48
  • 1
    $\begingroup$ @MartinVesely The answer still applies if it's being done in theory. Cancel out the gates you know and you've reduced the problem to finding the single unknown unitary. Assuming you're in the context of, like, a simulator where you can apply the unknown gate to states and get the final state vector as a result, apply it to an entangled state and read out the matrix using the state channel duality. In other words, do what you'd normally do for process tomography after cancelling the surrounding gates, even in a simulator. $\endgroup$ Feb 4 at 22:15
  • 1
    $\begingroup$ Craig, I want to solve the problem on qiskit. How can I do that? Also can you please tell me more about tomography. $\endgroup$
    – wizzywizzy
    Feb 5 at 7:05
1
$\begingroup$

I would multiply all matrices describing gates while the unknown is a general matrix with each it's element being and unknown variable. Then I would put all basis states on the input and read the output. In the end, I would solve system of equations I gained with this approach. Note that this can be computationally extensive as number of elements of the unknown matrix increases exponentially in number of qubits.

$\endgroup$
3
  • 2
    $\begingroup$ So if our unknown gate is of n qubit gate, then its unitary matrix will be of the size 2^n * 2^n.Am i correct? $\endgroup$
    – wizzywizzy
    Feb 4 at 13:57
  • $\begingroup$ Also is there any other approach to such questions ? $\endgroup$
    – wizzywizzy
    Feb 4 at 13:57
  • 1
    $\begingroup$ $2^n\times 2^n$ complex numbers $\endgroup$ Feb 4 at 14:40
0
$\begingroup$

The effect of a circuit can be explained by matrix-vector multiplications.

If you start with a state $\vec{q}$ and if the gates in your figure are represented by the matrices $A$, $B$, and $U$ (where $U$ is the unknown), then the output will be given by $\vec{q_f} = ABU\vec{q}$.

The $AB$ factor can be replaced by a single matrix called $C$, and with symbolic computation (a.k.a computer algebra) you can combine $U$ and $C$ too.

Let's try this, assuming that your "controlled note" get is just what others usually call "controlled not" or CNOT. Then we have:

$$ A = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix},\tag{1} $$

$$ B = \begin{bmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix},\tag{2} $$

$$ U = \begin{bmatrix} a & b & c & d \\ e & f & g & h \\ i & j & k & l \\ m & n & o & p \end{bmatrix},\tag{3} $$

$$ \vec{q} = \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix},\tag{4} $$

and

$$ \vec{q}_f = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}.\tag{5} $$

This would mean that we have:

$$\tag{6} \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} a & b & c & d \\ e & f & g & h \\ i & j & k & l \\ m & n & o & p \end{bmatrix}\begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}, $$ $$\tag{7} \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} a & b & c & d \\ e & f & g & h \\ i & j & k & l \\ m & n & o & p \end{bmatrix}\begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}, $$

$$ \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} f \\ b \\ j \\ n \end{bmatrix}.\tag{8} $$

You now have found 4 out of 16 unknown variables. You can do the same for the other 3 scenarios to get the other 4x3 = 12 unkown variables. You can use this matrix-vector multplier to make the computations easier.

$\endgroup$
1
  • 2
    $\begingroup$ this got flagged as a duplicate answer of quantumcomputing.stackexchange.com/a/30033/55. Did you perhaps mistakenly post it in two places? If you think the answer should be identical to that to the other post, perhaps this question should be closed as duplicate of the other one? $\endgroup$
    – glS
    Feb 4 at 18:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.