# Given a matrix, how do I proceed with the quantum phase estimation algorithm and choose $\theta$?

Given a matrix, say $$\begin{bmatrix} 1.5 & 0.5\\ 0.5& 1.5 \end{bmatrix}$$, with eigenvalues $$1$$ and $$2$$, how do I proceed with the quantum phase estimation algorithm? In particular, how do I choose $$\theta$$?

In the text I am reading it says fix $$\theta=\pi$$ and $$\pi/3$$ for the eigenvalues. How do they get this? Can somebody explain?

Edit: is it linked by the approximation that $$\theta= 2\arcsin(C/\lambda_j)$$, if so then why is $$C=1$$ in this matrix case?

• Could you link to the textbook? Nov 13 '20 at 21:04
• arxiv.org/abs/1804.03719 Nov 13 '20 at 21:32
• I am wrong to say that the Quantum phase estimation algorithm can only be applied to unary matrices. Which is clearly not the case for your matrix. Nov 15 '20 at 23:26
• please use meaningful titles for your questions. This makes them much easier to reuse in the future, and thus potentially actually useful
– glS
Nov 19 '20 at 9:57

Quantum phase estimation does not have anything to do with $$\theta$$. I feel that you are confusing phase estimation with the implementation of HHL as given in the paper https://arxiv.org/abs/1804.03719.

As for quantum phase estimation, it works only on unitary matrices. Given a unitary matrix $$U$$ and and eigenvector $$|\psi\rangle$$ of $$U$$ with some eigenvalue $$e^{2\pi i\theta}$$ (which we do not know), quantum phase estimation allows one to estimate $$\theta$$. To do this we assume that we have some way of preparing the state $$|\psi\rangle$$ (maybe we are given the state $$|\psi\rangle$$ explicitly or we are given a black box that prepares this state). We also assume that we can perform a controlled version of the given unitary $$U$$. The circuit for phase estimation then looks like the following: where $$U^{j}$$ denotes that the unitary $$U$$ has been applied $$j$$ times consecutively and $$QFT$$ is the circuit for the quantum Fourier transform on n qubits. The bitstring corresponding to measuring the first n qubits of this circuit is the binary representation of the value $$2^n\theta$$ from where we can obtain the value of $$\theta$$. The value of n depends on the required accuracy of the estimation which is for you to fix as needed. For the complete math behind this algorithm, you could refer to the book Quantum Computation and Quantum Information by Nielsen and Chuang or any other standard book on quantum computing.

Notice that except for a method to prepare the eigenstate $$|\psi\rangle$$ and the controlled version of the unitary $$U$$, you do not need anything else explicitly.

Image Credits: Qiskit

• But how do you implement that $U$, theoretically i get it, but practical implemebtation is where i get trouble. Nov 17 '20 at 6:33
• Since $U$ is a unitary matrix, you just have to find the right sequence of quantum gates that implements $U$. The difficulty of implementing $U$ completely depends on the matrix $U$. For instance if $U = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1\\ 1 &-1\\ \end{bmatrix}$ then all you need is just a $H$ gate to implement $U$. On the other hand, if you have $U$ that not quite simple, then you have to decompose it into multiple quantum gates. Nov 17 '20 at 10:42
• Okay, so if i need to perform $U=e^{iAt}$ then i need to decompose this into elementary gates? Nov 17 '20 at 10:56
• Precisely that. Nov 17 '20 at 12:52
• For the $t$ in the expression, does it have it to be fixed like $\pi/2$ or some other number? Nov 17 '20 at 12:53