I am reading a review about the variational quantum algorithm. And there is a definition of the cost function:

$C(\theta)=\sum_k f_k (Tr[O_k U(\theta)\rho_kU^\dagger(\theta)])$

Where $U(\theta)$ is a parametrized unitary with $\theta$ as the parameters. $\rho_k$ are density matrices, and ${O_k}$ are a set of observables, $f_k$ are functions which encode the task at hand.

I am confused about these two things: (1) Is there any general physical meaning of $Tr[O_k U(\theta)\rho_kU^\dagger(\theta)]$? It feels like I have seen it sometime before but I can't really find it now. (2) Why the cost function is defined this way?

Thank you for your help!

  • 1
    $\begingroup$ The trace you are referring to is the average value of the observable $O_k$ when the quantum state is $U(\theta)\rho_k U^{\dagger}(\theta)$ $\endgroup$ Sep 16, 2021 at 13:59

1 Answer 1


Breaking it down:

  1. $\rho' \equiv U \rho U^\dagger$ is the quantum state $\rho$ after applying the parameterized quantum circuit described by $U$.
  2. As @StarBucK explained in a comment, ${\rm Tr}[O_k\rho']$ is the density-matrix way of writing the expectation value of the observable $O_k$ (ie. $\langle O_k \rangle$) when the quantum state is $\rho'$. You may be more accustomed to the state-vector notation $\langle\psi|O_k|\psi\rangle$.
  3. The cost function $C\equiv \sum_k f_k \langle O_k \rangle$ is simply a weighted average of each expectation value $\langle O_k \rangle$, where $f_k$ serves as the weight.

The system being studied (ie. the "task at hand") determines what each of the $O_k$ are, as well as their corresponding weight $f_k$. Apparently the review you are reading also considers a different initial state $\rho_k$ for each operator $O_k$, although I haven't seen that before.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.