Postulate is the best way to take and share notes for classes, research, and other learning.
One sentence: Hamiltonians are matrices whose eigenvector with lowest eigenvalue ("ground state") is the answer to a combinatorial optimization problem.
Let's work from the ground up.
Say you want to solve the maxcut problem. You can encode the graph into a Hamiltonian using an Ising model. I don't know how to do that encoding, but there are prebuilt functions to do it:
Generating Hamiltonians from graphs in Orquestra :^)
After encoding, the answer to the maxcut problem is equal to the ground state of the Hamiltonian. (The ground state is the eigenvector with lowest eigenvalue, or sometimes also known as the minimum expectation value.) This means that the goal of maxcut-solving-QAOA (or any parametized quantum circuit) is to find the minimum expectation value of a Hamiltonian. Thus, the cost function is the expectation value.
How to calculate the expectation value of H? The expectation result of the Hamiltonian with respect to a quantum state phi is calculated with multiplying the Hamiltonian by the bra and ket of phi like this:
What is phi? It is the resulting quantum state of our parametized circuit. Actually, the above should be like this because phi is parametized.
Theta is a list of parameters with length M, which makes for this general cost function of quantum neural networks (found in this paper):
What is phi? Phi is the output of our parametized quantum circuit.
U(theta) is the parametized quantum circuit. (All the gates to a circuit multiplied together is a unitary.)
What are the gates that compose U? For QAOA, U is this beast (taken from Musty Thoughts)
...which is basically the fancy way of saying that the circuit is applying U_c and U_b alternatingly p times.
What are U_c and U_b?
U_c is the unitary of our initial cost Hamiltonian. Fun fact: every time you apply the exp() function to a hermitian operator, (hamiltonians are hermitian operators), you get a unitary with the same eigenvalues and eigenvectors. (Thank you Pavan) These transformations are called the "time evolution operator," which directly corresponds to how Shrodinger's equation describes how quantum states evolve over time:
(Fun digression: all quantum states change over time according to unitary operators, per Shrodinger's equation time evolution. Quantum gates change the state of qubits over time through time evolution. Therefore, quantum gates must be unitary matrices. I might be wrong, but this is kind of what I got from this 3b1b video.)
And so U_c = e^-iH_c, where H_c is our original Hamiltonian.
And U_b = e^-iH_b, where H_b is a known as a "mixer Hamiltonian." For more on what the mixer hamiltonian actually does in QAOA, read this. And so, our circuit/ansatz looks like this: (pic taken from Pennylane)
And that is what Hamiltonians really do, from first principles.
Things I'm learning from working at Zapata Computing