# Similarity Transformations on Pauli Operators in 2-qubit states (eq. 11 - Farhi's QNN Paper)


Let $$U_l = \text{exp}(i\frac{\pi}{4}l(z)X)$$ where $$X$$ is the pauli $$\sigma_x$$ gate and $$l(z)$$ is either $$+1$$ or $$-1$$

The paper that I've been reading claims that $$U_l^{\dagger}YU_l = \cos(\frac{\pi}{2}l(z))Y + \sin(\frac{\pi}{2}l(z))Z$$ where $$Y$$ is the pauli $$\sigma_{y}$$ gate and $$Z$$ is $$\sigma_z$$

Finally, they conclude that $$\bra{z,0}U_l^{\dagger}YU_l\ket{z,0} = \sin(\frac{\pi}{2}l(z)) = l(z)$$ , where $$z = z_1,...,z_n$$

When I try this myself, I don't get the same result and I am not able to spot my mistake. Here's my approach:

$$U_l = \text{exp}(i\frac{\pi}{4}l(z)X) = I + e^{i\frac{\pi}{4}l(z)}X$$ where $$I$$ is the identity matrix

Thus, I have that $$U_l^{\dagger}Y = Y + ie^{-i\frac{\pi}{4}l(z)}Z$$ and therefore $$U_l^{\dagger}YU_l = -ie^{i\frac{\pi}{4}l(z)}Z + ie^{-i\frac{\pi}{4}l(z)}Z$$ which, when we apply Euler's formula, reduces to: $$2\sin(\frac{\pi}{4}l(z))Z$$ which doesn't seem to be correct.

Could you please help me out? I've been stuck on it for a couple of days now.

• Where did you get that $U_l = I + e^{...}X$? – Bobak Hashemi Mar 9 '20 at 2:29
• This is Farhi’s paper on qnn right ?! – Enrique Segura Mar 9 '20 at 5:44
• @Enrique Segura, yes this is indeed the paper on qnn – Skyris Mar 9 '20 at 7:24

By taking into account the Euler-like formula for Pauli matrices (see, for example, the formula (4.4) or (4.7) in the M. Nielson and I. Chuang textbook):

$$e^{i \theta X} = cos(\theta)I + i sin(\theta) X$$

We can show that:

$$U_l = e^{i \frac{\pi}{4}l(z) X} = cos(\frac{\pi}{4}l(z)) I + isin(\frac{\pi}{4}l(z)) X$$

So

\begin{align*} U_l^\dagger Y U_l &= \left( cos(\frac{\pi}{4}l(z)) I - isin(\frac{\pi}{4}l(z)) X \right) Y \left( cos(\frac{\pi}{4}l(z)) I + i sin(\frac{\pi}{4}l(z)) X \right) = \\ &= cos^2(\frac{\pi}{4}l(z))Y + \frac{1}{2}sin(\frac{\pi}{2}l(z)) Z + \frac{1}{2}sin(\frac{\pi}{2}l(z))Z - sin^2(\frac{\pi}{4}l(z))Y = \\ &= cos(\frac{\pi}{2}l(z))Y + sin(\frac{\pi}{2}l(z)) Z \end{align*}

Also, I am not certain what $$\left|z,0\right\rangle$$ means, but note that:

\begin{align*} \langle 0| U_l^\dagger Y U_l | 0 \rangle = cos(\frac{\pi}{2}l(z)) \langle 0 | Y | 0 \rangle + sin(\frac{\pi}{2}l(z)) \langle 0 | Z |0 \rangle = sin(\frac{\pi}{2}l(z)) \end{align*}

An example of "bra-ket" calculation:

$$\langle 0 | Y | 0 \rangle = \begin{pmatrix} 1 & 0 \end{pmatrix} \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = 0$$

• I think what that notation means, $| z, 0>$ from the paper is that the last bit is a readout bit, which is $|0>$ and where $|z>$ is a bit string bit made of $1, 0$. So for example, if $z = 0101$, then $| z, 0> = | 0101, 0>$, or more like it, $| 01010>$ . – Enrique Segura Mar 9 '20 at 16:44
• Recalling that the pauli matrices square to the identity matrix, you can see that $$e^{i\theta X} = \cos(\theta) I + i\sin(\theta)X$$ in a totally analogous way to the proof of euler's formula by power series. Which is derivation of your starting point eq.(4.4). – Bobak Hashemi Mar 9 '20 at 21:46
• @BobakHashemi yes you are right, edited accordingly. – Davit Khachatryan Mar 10 '20 at 6:50

$$U_l = \text{exp}(i\frac{\pi}{4}l(z)X_{n+1}) = I_{n+1} + e^{i\frac{\pi}{4}l(z)}X_{n+1}$$

is invalid. When an operator is in the exponent, it is defined by the power series about $$X = 0$$ with the operator replaced in the exponential by the eigenvalue. In this case

$$U_l = 1 + i\frac{\pi}{4}l(z) e^{i\frac{\pi}{4}l(z)x}X_{n+1} - \frac{1}{2!}\frac{\pi^2}{16}l^2(z) e^{i\frac{\pi}{4}l(z)x}X_{n+1}X_{n+1} + ...$$

Recalling that the pauli matrices square to the identity matrix, you can see that $$e^{i\theta X} = \cos(\theta) I + i\sin(\theta)X$$ in a totally analogous way to the proof of euler's formula by power series. Which is derivation of the accepted answers starting point.

In the generic case where such a simplification was not available:

The easiest way to find $$U^{\dagger} Y U$$ would be by recalling

$$U^{\dagger} Y U = U^{\dagger} (U Y) + U^{\dagger} [Y, U] = Y + U^{\dagger} [Y, U]$$

Then you would need to find the commutator $$[Y,U]$$. You could either insert the expansion above in for $$U$$ and use the linearity of the commutator to work that out, or you could use a form of the use Baker-Campbell-Hausdorf formula (line 2 in the link):

$$e^{-A}Be^{A} = B + [A,B] + \frac{1}{2!}[A,[A,B]] + \frac{1}{3!}[A,[A,[A,B]]] + ...$$

Perhaps someone else can come give a more complete answer that works through the algebra, but, if you were to plug in the Pauli commutation relations and collect terms with $$Y$$ and $$Z$$ separately, you would get the expansion for $$\cos(\frac{\pi}{2} l(z))$$ in front of the terms with $$Y$$ and $$\sin(\frac{\pi}{2} l(z))$$ in front of $$[X,Y] \propto Z$$.

Here's a worked example of using the BCH formula for computing $$[x,e^{ixp}]$$.

• Thank you, I got it – Skyris Mar 9 '20 at 7:22
• I will try to work out the algebra – Skyris Mar 9 '20 at 7:33

I see this question and realize you too went through Farhi's paper on Quantun Neural Networks! I encountered this paper when I was applying for the Residency at X and was given this to implement - the other paper, by the way, was the seminal QAOA paper. I spent a lot of time head scratching so I can see the why of this question !

I know this is not quite an answer, but what I can provide is a colab notebook I did of the paper to illustrate it. I developed from scratch using a toy model to illustrate how and why the label is well defined on that boundary and how SGD can be used to systematically find one of the two states for the readout bit. Feel free to comment on it and provide feedback. It is supposed to be a pedagogical notebook so if there's a lot unclear on it, please let me know! I really would appreciate it.

I hope it is as helpful as it was for me to develop it!