# How to calculate eigenvalues by phase estimation？

I have been learning Quantum PCA recently but I came across a problem. How can I get the eigenvalues of a matrix by phase estimation？ And what on what kind of matrix can we implement this algorithm？(Unitary matrix only？)

Sorry for my poor description:)

• Matrix with eigenvalues $\lambda$ of the form $e^{i\theta}$, i.e., modulus one. Or if you know $|\lambda|$ already. Commented May 20, 2022 at 2:06
• Have a look at HHL algorithm. The evaluation of eigenvalues is part of it. Commented May 20, 2022 at 6:17

The Quantum Phase Estimation algorithm allows you to estimate the phases $$\theta_k$$ in the eigenvalue equation:

$$U|\psi_k\rangle = e^{2\pi i \theta_k} |\psi_k\rangle$$

where $$|\psi_k\rangle$$ and $$e^{2\pi i \theta_k}$$ correspond to the eigenvectors and eigenvalues of $$U$$. As you need to implement $$U$$ in a quantum circuit, this matrix must be unitary. However, you can get the eigenvalues of a Hermitian matrix H as well (which is not necessarily unitary) by doing the exponential of the matrix, i.e:

$$U = e^{ibH}$$

$$b$$ is a scale factor that ensures that all the phases $$\theta_k$$ fall in the interval $$[0,1]$$ (since what you will measure in the ancillary register is the state $$|2^n \theta_k \rangle$$ where n is the number of qubits ancilla). You can find more information here:

https://qiskit.org/documentation/stubs/qiskit.algorithms.HamiltonianPhaseEstimation.html

and here:

https://quantum-computing.ibm.com/composer/docs/iqx/guide/quantum-phase-estimation

If interested, there is also the function 'exp_i()' in Qsikit that allows you to obtain the exponential form of a weighted sum of Pauli operators:

Section 'Evolutions, exp_i(), and the EvolvedOp' of https://qiskit.org/documentation/tutorials/operators/01_operator_flow.html

and:

https://qiskit.org/documentation/stubs/qiskit.opflow.primitive_ops.PauliSumOp.exp_i.html

Quantum Principal Component Analysis uses what the authors call a quantum phase algorithm. This refers to the HHL algorithm, not quantum phase estimation which requires a copy of an eigenvector to find its eigenvalue. HHL, which actually use QPE as a subroutine, instead gives the eigenvectors and eigenvalues of a unitary without additional information. In the case of QPCA, this unitary is the exponentiated density matrix containing the data we wish to extract the principal components from.

This video does a good job explaining the HHL algorithm. The wikipedia page also gives a good overview.