# Generalized Parameter Shift CNOT

**URL:** https://discuss.pennylane.ai/t/generalized-parameter-shift-cnot/3054
**Category:** PennyLane Help
**Created:** [June 16, 2023, 10:24am UTC](https://discuss.pennylane.ai/t/generalized-parameter-shift-cnot/3054 "2023-06-16T10:24:34Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nikhil\_Narayanan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/nikhil_narayanan/32/1682_2.png) [@Nikhil\_Narayanan](https://discuss.pennylane.ai/u/Nikhil_Narayanan)
#### Post date: [June 16, 2023, 10:24am UTC](https://discuss.pennylane.ai/t/generalized-parameter-shift-cnot/3054/1 "2023-06-16T10:24:34Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![isaacdevlugt](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/isaacdevlugt/32/1159_2.png) [@isaacdevlugt](https://discuss.pennylane.ai/u/isaacdevlugt)
#### Post date: [June 16, 2023, 1:33pm UTC](https://discuss.pennylane.ai/t/generalized-parameter-shift-cnot/3054/2 "2023-06-16T13:33:26Z")

</div>

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 🙂.

---

<div class="post-metadata">

### Author: ![Nikhil\_Narayanan](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/nikhil_narayanan/32/1682_2.png) [@Nikhil\_Narayanan](https://discuss.pennylane.ai/u/Nikhil_Narayanan)
#### Post date: [June 16, 2023, 2:22pm UTC](https://discuss.pennylane.ai/t/generalized-parameter-shift-cnot/3054/3 "2023-06-16T14:22:11Z")

</div>

Thank you for clarifying!

---

<div class="post-metadata">

### Author: ![isaacdevlugt](https://yyz2.discourse-cdn.com/flex012/user_avatar/discuss.pennylane.ai/isaacdevlugt/32/1159_2.png) [@isaacdevlugt](https://discuss.pennylane.ai/u/isaacdevlugt)
#### Post date: [June 16, 2023, 5:29pm UTC](https://discuss.pennylane.ai/t/generalized-parameter-shift-cnot/3054/4 "2023-06-16T17:29:55Z")

</div>

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 🙂.
