1
$\begingroup$

I'm given with a Hamiltonian, $H=H_1+H_2$, where $H_1=\sigma_x\otimes\sigma_z$ and $H_2=\sigma_y\otimes\sigma_y$, and want to built a circuit which will implement $e^{-iHt},t=\pi/6$. We see that as $\sigma_x\otimes\sigma_z$ and $\sigma_y\otimes\sigma_y$ commutes, so $e^{-iHt}=e^{-i(\sigma_x\otimes\sigma_z)t}e^{-i(\sigma_y\otimes\sigma_y)t}.$

enter image description here enter image description here By referring to answer given here,the first circuit is of $e^{-i(\sigma_x\otimes\sigma_z)t}$ and the second implements $e^{-i(\sigma_y\otimes\sigma_y)t}$, where $Y=\frac {1}{\sqrt{2}} \begin{pmatrix} 1&1\\ i&-i\\ \end{pmatrix} $

Note that the bottom qubit corresponds to the first in the tensor product.

Question

As $H_1$ and $H_2$ commutes, $e^{-iH_1t}$ and $e^{-iH_2t}$ should also commute. But here, in quirk. Though probabilities are same after both cases, the final state isn't, which indicates $e^{-i(\sigma_x\otimes\sigma_z)t}$ and $e^{-i(\sigma_y\otimes\sigma_y)t}$ are not commuting. What's my mistake here?

$\endgroup$
  • 1
    $\begingroup$ I know quirk uses the opposite convention, but you’ll almost universally find elsewhere that the top qubit in a circuit diagram corresponds to the first qubit in the tensor product. It’s probably worth being explicit about your convention especially when you’re asking people to hunt for faults. Not that it helps solve your problem.... $\endgroup$ – DaftWullie Apr 3 at 7:49
  • $\begingroup$ Have you checked which Y quirk is using? It’s a standard gate and you’ve specified a (different) custom gate with the same name. $\endgroup$ – DaftWullie Apr 3 at 7:50
  • $\begingroup$ @DaftWullie, Question has been edited as suggested. Also I've used custom Y gate and not Pauli-Y. $\endgroup$ – Omkar Apr 3 at 8:29
  • $\begingroup$ What I was asking is whether you have carefully checked that the output of quirk is consistent with the gate you think it’s using? $\endgroup$ – DaftWullie Apr 3 at 8:37
  • $\begingroup$ As Craig Gidney mentioned in the answer, there was a confusion in order in which I've applied the gates. Now I've corrected it. Thank you @DaftWullie $\endgroup$ – Omkar Apr 3 at 10:26
1
$\begingroup$

I agree that $Y$ is not the best notation. Actually, in the paper that I was referring in the answer there was a gate $Y$ that was doing the desired job (it was also not a self-inverse gate). I didn't use the gate from the paper, but I kept the notation. Anyway, I like more Craig Gidney's suggestion to use $H_{YZ}$ gate. I will edit my answer to replace Y gate with $H_{YZ}$ (but I will call it just $H_y$ in order to have a short name in the circuits).

Now, about the question. I tried to do implementation of the circuits with Qiskit and find out that their outputs are the same. But, firstly, note that, my definition of $Y$ gate is different from the definition mentioned in the question. Here are my notations and corresponding Qiskit implementations of those gates:

\begin{align*} Y = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & -i \\ 1 & i \end{pmatrix} = &u2(0, \pi/2) \qquad Y^{\dagger} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ i & -i \end{pmatrix} = u2(\pi/2, \pi) \\ &u2 = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & e^{i\varphi} \\ e^{i\lambda} & e^{i(\varphi + \lambda)} \end{pmatrix} \end{align*}

Here is the code:

from qiskit import *
import numpy as np

simulator = Aer.get_backend('statevector_simulator')

q = QuantumRegister(2, 'q')

circuit_xz = QuantumCircuit(q)
circuit_xz.h(q[0])
circuit_xz.cx(q[1], q[0])
circuit_xz.rz(np.pi / 3, q[0])
circuit_xz.cx(q[1], q[0])
circuit_xz.h(q[0])

circuit_yy = QuantumCircuit(q)
circuit_yy.u2(np.pi/2, np.pi, q[0])
circuit_yy.u2(np.pi/2, np.pi, q[1])
circuit_yy.cx(q[1], q[0])
circuit_yy.rz(np.pi / 3, q[0])
circuit_yy.cx(q[1], q[0])
circuit_yy.u2(0, np.pi/2, q[0])
circuit_yy.u2(0, np.pi/2, q[1])

circuit_xz_yy = circuit_xz + circuit_yy
circuit_yy_xz = circuit_yy + circuit_xz

result_1 = execute(circuit_xz_yy, simulator).result().get_statevector(circuit_xz_yy)
result_2 = execute(circuit_xz_yy, simulator).result().get_statevector(circuit_xz_yy)

print("The first result \n{}".format(result_1))
print("\n The second result \n{}".format(result_1))

And here is the output:

The first result 
[ 0.375+0.64951905j  0.375-0.21650635j  -0.125-0.21650635j  0.375-0.21650635j]

The second result 
[ 0.375+0.64951905j  0.375-0.21650635j  -0.125-0.21650635j  0.375-0.21650635j]
| improve this answer | |
$\endgroup$
2
$\begingroup$

You reversed the order of $Y^\dagger$ and $Y$ compared to the answer you linked. Instead of using the "$Y^\dagger$" operation that sends the X axis to the Y axis to the Z axis to the X axis, you're doing the reverse. So you're operating on $X \otimes X$ instead of $Y \otimes Y$. (Incidentally, given the confusion w.r.t. the Y axis, it's hard to think of a worse name than Y for a custom operation.)

Personally I would recommend using self-inverse operations that swap one axis for another, like how the Hadamard swaps X for Z, instead of operations where it's possible to use them in the wrong order. In this case you could use $H_{YZ} = (Y + Z) / \sqrt{2} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & -i \\ i & -1 \end{bmatrix}$.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you @Craig Gidney. Note the last entry of $H_{YZ}$ is $\frac{-1}{\sqrt{2}}$ $\endgroup$ – Omkar Apr 3 at 10:03
  • $\begingroup$ @Omkar Thanks, fixed. $\endgroup$ – Craig Gidney Apr 3 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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