# Ansatz

In quantum computing, the term "Ansatz" refers to a trial wavefunction or trial state used as a starting point for approximations or optimizations. It's a parameterized quantum state that serves as an educated guess for the solution to a particular problem, such as finding the ground state of a quantum system. The Ansatz is a central concept in variational algorithms like the Variational Quantum Eigensolver (VQE).

An Ansatz is typically represented by a parameterized quantum circuit, where the parameters are adjustable variables that define the state. The structure of the Ansatz can be chosen based on prior knowledge of the problem or physical intuition. The parameters are then optimized using classical or quantum techniques to approximate the desired quantum state as closely as possible.

In variational algorithms, the Ansatz is used to prepare a trial state that approximates the solution to the problem at hand. By iteratively adjusting the parameters and evaluating the resulting state, the algorithm converges towards the optimal solution. The quality of the Ansatz, including its structure and initial parameters, can significantly impact the efficiency and accuracy of the algorithm.

Choosing an appropriate Ansatz is a critical step in variational algorithms. The Ansatz must be expressive enough to capture the essential features of the target state but also simple enough to be efficiently implemented on a quantum computer. The choice may be guided by physical insights, problem-specific constraints, or empirical testing.

Designing an effective Ansatz can be challenging, especially for complex or poorly understood problems. Research in this area focuses on developing new Ansatz structures, understanding the trade-offs between expressibility and efficiency, and devising methods to automate or guide the selection of the Ansatz.

Beyond quantum computing, the concept of an Ansatz is also used in other areas of physics and mathematics, where it represents an assumed form of a solution to an equation or a system. It's a foundational concept in many approximation methods and numerical techniques.

The Ansatz is a fundamental concept in quantum computing, particularly in variational algorithms. It represents a bridge between physical intuition, mathematical modeling, and computational implementation. The design and optimization of the Ansatz are central to the success of variational approaches and continue to be areas of active research and innovation.

## What is Ansatz

In a Statistics How To article titled “Ansatz: Simple Definition, Examples, Comparison to Hypothesis” a definition is provided that is not specific to quantum computing. Mathematically, an ansatz can be thought of as a starting point. We have to start somewhere. Therefore, the initial parameters of the circuit can be thought of as a guess. The circuit itself is carefully selected, but the parameters are just guesses until a couple of rounds of measurements are taken and the parameters begin to be optimized deliberately. The initial guesses find the pathway toward the optimal solutions.

The article offers an analogy with hypotheses. Similar to how a hypothesis is stated and tested, an ansatz is prepared and measured. In the case of an ansatz, however, it is presumed to be wrong in the beginning, almost definitely needing adjustments to find optimal solutions.

For additional reading, the article highlights three ansatzes:

- The Bethe ansatz has utility in solving the quantum inverse scattering problem, the Heisenberg spin chain, and the Hubbard model
- The coupled cluster ansatz approximates the ground states of many-body quantum systems, including atoms as well as molecules
- The variational autoencoder learns the structures of datasets in a manner that enables additional training data, similar to the original, to be generated

As hinted above, the term “ansatz” has variations that are not necessarily applicable to quantum computing. For example, the term “ansatz method” applies to solving differential equations or systems of equations by reducing complex problems into simpler problems. The term “ansatz differential equations” has the same definition, but applied specifically to solving differential equations.

## Ansatz in Quantum Algorithms

Anecdotally, a quantum ansatz is a great mystery. The term is often found in books, papers, tutorials, and articles without a definition, and its meaning is not intuitive without such a definition. A student can therefore discover all the parts of an algorithm, even run examples of an algorithm, while still not knowing what an “ansatz” is.

The quantum ansatz is the parameterized quantum circuit. The number of qubits, the number of operations, and the types of operations are all carefully selected based on the problem to be solved. The latter refers to both single-qubit and multi-qubit operations. The parameters then determine the quantum state represented by the overall circuit.

When looking at the use cases of quantum computing, as well as the state of current hardware, it makes sense that such parameterized circuits can be found almost everywhere. Two of the major classifications of use cases are simulation and optimization, both of which are the primary applications of variational quantum algorithms.

## Variational Quantum Algorithms

Variational quantum algorithms (VQA) are a class of quantum algorithms that find approximate solutions to optimization and simulation problems. Their popularity is due to them being designed for Noisy Intermediate-Scale Quantum (NISQ) devices, which have relatively few qubits and can only execute shallow quantum circuits. The key components of a VQA are:

- The quantum ansatz is the parameterized quantum circuit that provides the range of quantum states available by adjusting the parameters
- The Hamiltonian or objective function that represents the quantum system to be simulated or the optimization problem to be solved, respectively
- Repeated measurements of the quantum states provide a statistical estimate of the objective function’s expectation value
- Classical optimization, via artificial neural networks, adjusts the ansatz’s parameters so as to minimize the objective function’s expectation value
- Together, measurements are taken and parameters are updated in an iterative manner until either a minimum is found or a maximum number of iterations is reached
- Convergence indicates that either the ground state energy, for simulation problems, or an approximation of an optimal solution, for optimization problems, has been found

Implementing VQAs poses three challenges:

- Each ansatz has to be carefully selected based on the problem to be solved, and the discovery of novel ansatzes is probably necessary
- Each parameter optimization strategy has to be carefully selected not only to minimize runtime but also to avoid common machine-learning pitfalls
- As more parameters are added to an ansatz, the process of optimizing those parameters becomes an optimization problem in its own right

It’s worth noting that popular VQAs, particularly the Variational Quantum Eigensolver (VQE) and Quantum Approximate Optimization Algorithm (QAOA), have their own variations. Therefore, the ansatzes vary, the optimization strategies vary, and the algorithms themselves vary.