# How to find a circuit for a unitary operator $e^{-i s |v \rangle \langle v| t }$?

Let $$|v \rangle$$ be an eigenstate of an $$n$$-qubit and $$2$$-local Hamiltonian
$$H = \sum_{i=1}^n \left (X_i + a_i Z_i \right) + \sum_{(i,j)} b_{i,j} Z_i Z_j,$$
where $$\sigma_i = I \otimes \cdots \otimes \sigma \otimes \cdots \otimes I$$ for $$\sigma \in \{X,Z\}$$ and $$a_i,b_i, h_{i,j} \in \mathbb{R}$$.

I would like to know how to do a circuit implementation of $$U(t) = e^{-\textrm{i} s |v \rangle \langle v| t },$$ where $$s,t \in \mathbb{R}$$.

If it helps, $$U(t)$$ can also be written as $$U(t) = e^{-\textrm{i} s |v \rangle \langle v| t } = I + (e^{-\textrm{i} s t}-1) |v \rangle \langle v|.$$

Edit:
My initial idea was to express $$|v \rangle \langle v|$$ as a linear combination of $$(3^2-1)\binom{n}{2}$$ $$n$$-qubit Pauli matrices that have a form $$P_{i,j} = I \otimes \sigma_i \otimes \cdots \otimes \sigma_j \otimes I$$ where $$\sigma_i, \sigma_j \in \{I, X, Z\}$$. Then we can write: \begin{align*} |v\rangle \langle v| &= \sum_{i,j} c_{i,j} P_{i,j}. \\ e^{-\textrm{i} s |v \rangle \langle v| t} &= e^{-\textrm{i} s \left (\sum_{i,j} c_{i,j} P_{i,j} \right)t}. \end{align*}

Since most Pauli terms $$P_{i,j}$$ don't commute, we could apply the first-order Trotterization and get: \begin{align*} e^{-\textrm{i} s |v \rangle \langle v| t} = e^{-\textrm{i} s \left (\sum_{i,j} c_{i,j} P_{i,j} \right) t } \approx \prod_{i,j} e^{-\textrm{i} s c_{i,j} P_{i,j}t}. \end{align*} This is a product of $$(3^2-1)\binom{n}{2}$$ gates $$RZ$$, $$RZZ$$ and $$RX$$.

I think this is too many gates to approximate the original unitary matrix! I also assumed that $$P_{i,j}$$ are made of $$I, X$$ and $$Z$$ and that if $$\sigma_i= X$$ then $$\sigma_j \neq X$$.

Some clarifications:
$$H$$ is known, and it is possible to implement an approximate evolution given by a trotterized version of $$e^{-iHt}$$. I guess we could assume that the associated eigenvalue of $$|v\rangle$$ is known and that it is unique. So far, I don't have an exact expression for $$|v\rangle$$.

• Just to clarify the setting: you know $H$ and can implement unitary evolutions $e^{-iHt}$? You know that $|v\rangle$ is an eigenstate. Do you know (i) its eigenvalue? (ii) is that eigenvalue unique? (iii) what $|v\rangle$ itself actually is? Oct 10, 2022 at 10:09
• @DaftWullie I've added some clarifications. Hope this helps. Thanks! Oct 11, 2022 at 5:46

If you know the eigenvalue associated with the eigenvector, then by far the best thing to do is run a phase estimation protocol using $$e^{-iHt}$$. There's probably an optimum choice of $$t$$ depending on what you know about the spectrum, but as a bare minimum, if all your eigenvalues are between 0 and $$\Lambda$$, then you set $$t=2\pi/\Lambda$$ to maximally spread out the eigenvalues without being affected by the $$2\pi$$ modulus that arises from the exponentiation.

To convey what happens, let $$|\lambda_n\rangle$$ be eigenvectors of $$H$$ with eigenvalue $$\lambda_n$$. Any initial state may be decomposed as $$|\psi\rangle=\sum_n\alpha_n|\lambda_n\rangle.$$ To apply phase estimation, you introduce a second register of $$t$$ qubits, initially in $$|0\rangle$$. After phase estimation you have, at least to a good approximation, $$|\psi\rangle=\sum_n\alpha_n|\lambda_n\rangle|n\rangle.$$ where by $$|n\rangle$$ I mean the $$t$$-bit representation of the eigenvalue $$\lambda_nt/(2\pi)$$. The trick now is to apply a controlled-controlled-...-controlled-phase gate on the extra register that applies $$-1$$ on the value of $$|n\rangle$$ corresponding to the one eigenvector you want. The trick being that while we apply $$I\otimes(I-2|n\rangle\langle n|),$$ it has exactly the same effect as the operation $$(I-2|v\rangle\langle v|)\otimes I.$$ Finally, you have to apply the inverse of the phase estimation to undo the entanglement between the original register and the extra one.

• @ DaftWullie, thanks for the answer. Could you clarify what you mean by "the trick now is to apply a controlled-controlled-...-controlled-phase gate on the extra register that applies −1 on the value of |n⟩ corresponding to the one eigenvector you want"? How does it look mathematically? Also, by "extra register" do you mean a brand-new register? Oct 12, 2022 at 20:39
• Also, is it possible to do get $I + (e^{-\textrm{i} s t}-1) |v \rangle \langle v|$ instead of $(I-2|v\rangle\langle v|)$? Oct 12, 2022 at 20:57
• Yes, the brand-new register. Oct 13, 2022 at 15:05
• Sure, again you apply a controled-controlled-...-controlled phase, where this time the phase is $e^{-ist}$ if the target state is $|n\rangle$ and 2 if it's snything else. Oct 13, 2022 at 15:06
• I'm not sure how you want it to look mathematically, as you clearly know how to write these things: $I-2|n\rangle\langle n|$ Oct 13, 2022 at 15:06

This operation $$U(t) = e^{-i s t|v\rangle \langle v|}$$ that you wish to implement resembles the Grover diffusion operator if we take $$|v \rangle = (H |0\rangle)^{\otimes n}$$ and $$st = \pi$$. Hence, in the spirit of its generalization, given a unitary $$V$$ such that $$V |0 \rangle^{\otimes n} = |v \rangle$$, we can implement $$U(t)$$ via the following $$(n+1)$$-qubit circuit, where an ancillary qubit in state $$|0\rangle$$ is added for convenience. In words, ignoring the $$V$$ and $$V^{\dagger}$$ subcircuits for the moment, we have a $$R_z(2st)$$ gate acting on a qubit in state $$|0\rangle$$ if and only if all $$n$$ qubits in the main register are in state $$|0\rangle$$. Hence, only the state $$|0\rangle^{\otimes n}$$ will be applied a phase shift of $$e^{-i st}$$ per the phase kickback effect. Now, once we sandwich this n-controlled-$$R_z$$ gate between $$V^{\dagger}$$ and $$V$$, the special state that is applied the phase shift is no longer $$|0\rangle^{\otimes n}$$ but instead $$V|0\rangle^{\otimes n} \equiv |v\rangle$$. That is precisely what $$U(t)$$ amounts to.

The n-controlled-$$R_z$$ gate can be decomposed into elementary gates following, e.g., this reference. The only missing piece is therefore the implementation of the $$n$$-qubit operation $$V$$ that prepares the eigenstate $$|v\rangle$$ of the given Hamiltonian. In the absence of the longitudinal field (i.e., setting $$a_i = 0$$), this model is exactly solvable by mapping the local spins-$$\frac{1}{2}$$ to fermions via the Jordan-Wigner transformation, which yields a quadratic Hamiltonian for which all eigenstates are just Slater determinants, which can be prepared on a quantum computer using the method discussed, e.g., here. For the general case where the longitudinal field is present, I suppose one has to resort to some ansatz to find the eigenstates of the model.

• Thanks for the answer. But you left the most relevant part about $V$ unanswered and just wrote about generalized Grover diffusion. I also considered that venue but then it all boiled down to expressing $|v\rangle$ or $V$. Sep 10, 2022 at 15:49