# What is this circuit doing?

Can anyone help me understanding what is this circuit doing ?

The circuit can be reproduced with qiskitas follows:

qc = QuantumCircuit(3,3)

qc.h(0)
qc.cx(0,1)
qc.cx(0,2)

qc.barrier()

qc.h(0)
qc.sdg(1)
qc.h(1)
qc.sdg(2)
qc.h(2)

qc.measure(range(3),range(3))
qc.draw(output='mpl')


From my understanding, The proposed circuit is fed with the following quantum state $$\Psi = |000\rangle$$. We first apply Hadamard on the first qubit, getting \begin{align*} \Psi \to \underbrace{\cfrac{1}{\sqrt2} \ (|000\rangle + |100\rangle) }_{\Psi_1} \end{align*}

then the states goes through a CNOT on the second and third qubit controlled on the first one, which produces \begin{align*} \Psi_1 \to \cfrac{1}{\sqrt2} \ (|000\rangle + |111\rangle) \end{align*}

Which is the GHZ entangled state.

The $$S^t$$ gate is represented by the following matrix \begin{align*} \mathcal{S}^t = \left[ {\begin{array}{cc} 1 & 0 \\ 0 & -i \\ \end{array} } \right] \end{align*}

and since

\begin{align} \mathcal{S}^t |0\rangle = |0 \rangle \\ \mathcal{S}^t |1\rangle = -i |1\rangle \end{align}

after the $$\mathcal{S}^t$$ plus $$\mathcal{H}$$ cascade on the second and third qubit and the $$\mathcal{H}$$ on the first qubit, we end up with the following final state before the measurement \begin{align*} \Phi = \cfrac{1}{2} \ (|001\rangle + |010\rangle + |100\rangle + |111\rangle) \end{align*}

I don't know if my calculations are correct. Anyway I don't get what is this circuit doing. Please notice that I'm not a physicist then my knowledge is limited to the field of Qcomputing.

The first part of the circuit

is to create a GHZ state

$$|\psi\rangle = \dfrac{|000\rangle + |111\rangle}{\sqrt{2}}$$

The second part of the circuit is to change the basis of measurement to $$XYY$$. That is you measure the first qubit in the $$X$$ basis, and second and third qubit in the $$Y$$ basis. To see this, first let's us look at the first qubit and note the idenity $$HZH = X$$ Therefore, $$\langle \psi | X | \psi \rangle = \langle \psi | HZH | \psi \rangle = \langle \psi H | Z | H\psi \rangle$$

hence the reason for the Hadamard gate before the measurement in the $$Z$$ basis.

Similarly, for the second and third qubits, recall the identity $$(SH)Z(HS^\dagger) = Y$$ and therefore $$\langle \psi |Y| \psi \rangle = \langle \psi | (SH)Z (HS^\dagger) | \psi \rangle = \langle \psi SH | Z | H S^\dagger \psi \rangle$$

Thus, here you want to apply $$S^\dagger$$ follow by the Hadamard gate $$H$$ before measurement.

Put all of this together, you get the circuit you have in question:

This looks like one case of a GHZ bell test. It's preparing a GHZ state and then measuring the qubits in the X, Y, and Y bases respectively.

In the full experiment the three players prepare the state and are then simultaneously told to measure their qubits in either the XXX, XYY, YXY, or YYX bases without being given time to communicate. The interesting thing is the various results predicted by quantum mechanics are provably impossible to reproduce using local classical strategies.