Derivative of cost function with respect to the unitary matrix

Suppose I have a cost function $$C = \langle \psi \rvert U^\dagger O U \rvert \psi \rangle$$ for a fixed observable $$O$$ and a fixed state $$\rvert \psi \rangle$$. I know that usually people take the derivative of the cost function wrt parameters, but here I want to take the derivative of $$C$$ wrt $$U$$: $$\frac{\partial C}{\partial U} = \langle \psi \rvert \frac{\partial U^\dagger}{\partial U} O U \rvert \psi \rangle + \langle \psi \rvert U^\dagger O \rvert \psi \rangle$$, and I am not sure how to deal with $$\frac{\partial U^\dagger}{\partial U}$$ part. Any help would be appreciated!

• What is the origin of the unitary matrix and how can it change? (I hope you're not allowing an entirely arbitrary $n$-qubit unitary!) Commented Jul 3, 2023 at 6:13

If I take your questions literally, then the answer is fairly straightforward: $$\frac{dU^\dagger}{dU}=-1.$$ You should think about it this way: we know $$UU^\dagger=I$$. If $$U$$ changes by $$\delta U$$ (small), $$U^\dagger$$ must change to compensate: $$(U+\delta U)(U-\delta U)=I+O(\delta U^2)$$ Thus, to first order, $$U^\dagger$$ changes to $$U^\dagger-\delta U$$.