# Derivative of circuit

please show me how to take the derivative of a quantum circuit I don’t understand how a circuit has a derivative

Hi @AstroQFT, great question! It sounds crazy that circuits can have a gradient but in fact they can.

The gradient is similar to the derivative. It’s a vector that points in the direction of highest increase of a function. We use quantum circuits to calculate a function of certain parameters (for instance rotations). So if we can find the direction of highest increase of the function we have the gradient.

In order to do this we vary some of the parameters in the function. This gives us similar functions that combined together in a linear combination give the gradient of the original function! This image from the docs (link below) can further illustrate this concept.

This entry in the docs goes into a lot more detail in case you want a more technical explanation. https://pennylane.readthedocs.io/en/user-docs-refactor/concepts/autograd_quantum.html#id5

Please let me know if this answers your question! 