# Implementation of matrix A in HHL algorithm circuit

In HHL algorithm, how do we implement matrix $$A$$ (where $$A|x\rangle = |b\rangle$$) in the circuit?

A Hermitian matrix $$A$$ is implemented as series of controlled gates $$\mathrm{e}^{iAt}$$ for some $$t$$. This gate can be then implementend with controlled $$\mathrm{U3}$$ gate on IBM Q.

Note that original paper on HHL algorithm (see link below) provides a "trick" how to convert any matrix to Hermitian one and apply HHL algrithm.

For example, for Hermitian matrix $$A$$, type 2x2, there are two gates with $$t=\frac{\pi}{2}$$ and $$t=\frac{\pi}{4}$$ controlled by two different qubits.