# Ansatz explanation for VQE

I have found quite a bit of information on the UCC ansatz, but I cannot really find basic explanations for the Ry and RyRz ansatzs... Are they just applying these gates to a circuit? If anyone has good material on this I would greatly appreciate it!

In term of the $$RY$$ Ansatze, from my understanding, this is because many systems of interest, the Hamiltonian contains only real terms. And if we have real Hamiltonian, then the decomposition of the matrix representation of the Hamiltonian can be achieved with real eigenvectors.

Now, a single-qubit $$RY$$ rotation confined the qubit state remains real. That is, it is restricted to the $$xz$$-plane. You can see this through the Bloch-sphere visualization below.

Furthermore, if we use CNOT as our entangling gate operation, then it has a real representation. Thus if we restrict our single-qubit operations to leave each qubit state in the real subspace then the state as a whole will be in real. This is why, people consider the $$RY$$ ansatze:

┌──────────┐ ░                 ░ ┌──────────┐ ░                 ░ ┌──────────┐
┤ RY(θ[0]) ├─░───■────■────────░─┤ RY(θ[3]) ├─░───■────■────────░─┤ RY(θ[6]) ├
├──────────┤ ░ ┌─┴─┐  │        ░ ├──────────┤ ░ ┌─┴─┐  │        ░ ├──────────┤
┤ RY(θ[1]) ├─░─┤ X ├──┼────■───░─┤ RY(θ[4]) ├─░─┤ X ├──┼────■───░─┤ RY(θ[7]) ├
├──────────┤ ░ └───┘┌─┴─┐┌─┴─┐ ░ ├──────────┤ ░ └───┘┌─┴─┐┌─┴─┐ ░ ├──────────┤
┤ RY(θ[2]) ├─░──────┤ X ├┤ X ├─░─┤ RY(θ[5]) ├─░──────┤ X ├┤ X ├─░─┤ RY(θ[8]) ├
└──────────┘ ░      └───┘└───┘ ░ └──────────┘ ░      └───┘└───┘ ░ └──────────┘


Also note that this Ansatze has the name "Real Amplitudes" in qiskit. This is because what I described above.

Now, $$RY$$ rotation follow by $$RZ$$ rotation will allows you to get more general quantum states, states with non-real amplitudes. Thus this Ansatze, $$RYRZ$$ Ansatze, is aiming at a more general setting. But if you consider chemistry problem then most likely you should be able to get away with just using $$RY$$ Ansatze.

• How do I appropriately adjust the gates in the RY ansatz to make it hardware efficient? For example, if the basis gates are (CX, ID, RZ, SX, X) would I change the RY gate in the ansatz somehow? – thespaceman Apr 6 at 16:26
• Hardware efficient Ansatz has to do with the depth of the circuit. So by converting $RY$ to $RZ, SX$ will increase the depth, I wouldn't be worry to much about that since they are just single qubit rotation... not much error occur. The problem is when you start having CNOT gates in the circuit. So for instance, an example of a hardware efficient Ansatze would be applying a single qubit rotation (says RY) follow by CNOT gate align in a staging manner... – KAJ226 Apr 6 at 16:46
• The reason why you want CNOT gates align in a staging manner is because not all the qubits are connected to one another... if you want to perform CNOT on qubit 0 with qubit 5 then there will be a lot of SWAPPING operations.... this will increase the depth of the circuit tremendously... For single qubit gate, this is not needed... – KAJ226 Apr 6 at 16:48
• This makes sense regarding the single qubit gates. But how about for the two qubit gates, if the system had CZ in the basis instead of CX would all of the entanglers be made from CZ gates as in Fig.3 of (arxiv.org/pdf/1909.05820.pdf)? My ultimate goal is to make a hardware efficient version of the ansatz from that paper. – thespaceman Apr 6 at 17:01
• So if the hardware take $CZ$ as a basis/native gate instead of $CX$ then you can still use $CX$ but it will decomposed into $CZ$ with some additional rotations (two Hadamards )... The reason why the Ansatz in fig.3 in the paper you linked is called hardware efficient is because of how the entangler gate (CZ in this case) are aligned... they aligned in such a way that only neighboring connectivity between the qubits are needed. – KAJ226 Apr 6 at 17:18