Generalized Parameter Shift CNOT

Hi, I was wondering how parameter shift rule can be applied to the CNOT gate? I have watched the derivations on the PennyLane Youtube channel but I am slightly confused about where it applies and if it applies to all entangling gates?

Hey @Nikhil_Narayanan!

The parameter shift rule applies to parameterized gates (with some assumptions made to those gates). The CNOT gate has no parameters — it flips a target qubit if the control qubit is 1 :slight_smile:.

1 Like

Thank you for clarifying!

1 Like

My pleasure! To add to my previous comment, the parameter-shift rule is a differentiation method. The method by which we differentiate aside, let’s just say I have a function f(x). If f(x) is a constant function (e.g., f(x) = 3), then its derivative is zero. However, if f(x) actually depends on x (e.g., f(x) = x^2), then its derivative is non-zero — it’s another function.

The same goes for differentiating gates in a quantum circuit. If a gate doesn’t depend on any variables (like X, Y, Z, Hadamard, CNOT, etc.), then differentiating it with respect to any parameter is a null result and doesn’t need to be accounted for in any way :slight_smile:.

1 Like