From aeacfca5aea5df7c107cf0c12e72ab5d496c96e1 Mon Sep 17 00:00:00 2001 From: Prefetch Date: Tue, 3 Jan 2023 19:48:17 +0100 Subject: More improvements to knowledge base --- source/know/concept/quantum-gate/index.md | 85 ++++++++++++++++--------------- 1 file changed, 43 insertions(+), 42 deletions(-) (limited to 'source/know/concept/quantum-gate/index.md') diff --git a/source/know/concept/quantum-gate/index.md b/source/know/concept/quantum-gate/index.md index 9704e53..dd198f2 100644 --- a/source/know/concept/quantum-gate/index.md +++ b/source/know/concept/quantum-gate/index.md @@ -17,15 +17,15 @@ so we only consider the most important examples here. ## One-qubit gates -As an example, consider the following must general single-qubit state $$\Ket{\psi}$$: +As an example, consider the following most general single-qubit state $$\ket{\psi}$$: $$\begin{aligned} - \Ket{\psi} - = \alpha \Ket{0} + \beta \Ket{1} + \ket{\psi} + = \alpha \ket{0} + \beta \ket{1} = \begin{bmatrix} \alpha \\ \beta \end{bmatrix} \end{aligned}$$ -Arguably the most famous and/or most fundamental quantum gates are the **Pauli matrices**: +Arguably the most famous and most fundamental quantum gates are the **Pauli matrices**: $$\begin{aligned} \boxed{ @@ -53,19 +53,19 @@ $$\begin{aligned} } \end{aligned}$$ -They have the following effect on $$\Ket{\psi}$$. +They have the following effect on $$\ket{\psi}$$. Note that $$X$$ is equivalent to the classical $$\mathrm{NOT}$$ gate (and is often given that name), and $$Z$$ is sometimes called the **phase-flip gate**: $$\begin{aligned} - X \Ket{\psi} + X \ket{\psi} = \begin{bmatrix} \beta \\ \alpha \end{bmatrix} \qquad - Y \Ket{\psi} + Y \ket{\psi} = \begin{bmatrix} -i \beta \\ i \alpha \end{bmatrix} \qquad - Z \Ket{\psi} + Z \ket{\psi} = \begin{bmatrix} \alpha \\ -\beta \end{bmatrix} \end{aligned}$$ @@ -87,7 +87,7 @@ For $$\phi = \pi$$, we recover the Pauli-$$Z$$ gate. In general, the action of $$R_\phi$$ is as follows: $$\begin{aligned} - R_\phi \Ket{\psi} + R_\phi \ket{\psi} = \begin{bmatrix} \alpha \\ e^{i \phi} \beta \end{bmatrix} \end{aligned}$$ @@ -128,10 +128,11 @@ $$\begin{aligned} \end{aligned}$$ Its action consists of rotating the qubit -by $$\pi$$ around the axis $$(X + Z) / \sqrt{2}$$ of the Bloch sphere: +by $$\pi$$ around the axis $$(X + Z) / \sqrt{2}$$ of +the [Bloch sphere](/know/concept/bloch-sphere/): $$\begin{aligned} - H \Ket{\psi} + H \ket{\psi} = \frac{1}{\sqrt{2}} \begin{bmatrix} \alpha + \beta \\ \alpha - \beta \end{bmatrix} \end{aligned}$$ @@ -139,20 +140,20 @@ Notably, it maps the eigenstates of $$X$$ and $$Z$$ to each other, and is its own inverse (i.e. unitary): $$\begin{aligned} - H \Ket{0} = \Ket{+} + H \ket{0} = \ket{+} \qquad - H \Ket{1} = \Ket{-} + H \ket{1} = \ket{-} \qquad - H \Ket{+} = \Ket{0} + H \ket{+} = \ket{0} \qquad - H \Ket{-} = \Ket{1} + H \ket{-} = \ket{1} \end{aligned}$$ The **Clifford gates** are a set including $$X$$, $$Y$$, $$Z$$, $$H$$ and $$S$$, or more generally any gates that rotate by multiples of $$\pi/2$$ around the Bloch sphere. -This set is **not universal**, meaning that if we start from $$\Ket{0}$$, -we can only reach $$\Ket{0}$$, $$\Ket{1}$$, $$\Ket{+}$$, $$\Ket{-}$$, $$\Ket{+i}$$ $$\Ket{-i}$$ using these gates. +This set is **not universal**, meaning that if we start from $$\ket{0}$$, +we can only reach $$\ket{0}$$, $$\ket{1}$$, $$\ket{+}$$, $$\ket{-}$$, $$\ket{+i}$$ $$\ket{-i}$$ using these gates. If we add *any* non-Clifford gate, for example $$T$$, then we can reach any point on the Bloch sphere, @@ -170,15 +171,15 @@ any state can be approximated. ## Two-qubit gates As an example, let us consider -the following two pure one-qubit states $$\Ket{\psi_1}$$ and $$\Ket{\psi_2}$$: +the following two pure one-qubit states $$\ket{\psi_1}$$ and $$\ket{\psi_2}$$: $$\begin{aligned} - \Ket{\psi_1} - = \alpha_1 \Ket{0} + \beta_1 \Ket{1} + \ket{\psi_1} + = \alpha_1 \ket{0} + \beta_1 \ket{1} = \begin{bmatrix} \alpha_1 \\ \beta_1 \end{bmatrix} \qquad \quad - \Ket{\psi_2} - = \alpha_2 \Ket{0} + \beta_2 \Ket{1} + \ket{\psi_2} + = \alpha_2 \ket{0} + \beta_2 \ket{1} = \begin{bmatrix} \alpha_2 \\ \beta_2 \end{bmatrix} \end{aligned}$$ @@ -186,23 +187,22 @@ The composite state of both qubits, assuming they are pure, is then their tensor product $$\otimes$$: $$\begin{aligned} - \Ket{\psi_1 \psi_2} - = \Ket{\psi_1} \otimes \Ket{\psi_2} - &= \alpha_1 \alpha_2 \Ket{00} + \alpha_1 \beta_2 \Ket{01} + \beta_1 \alpha_2 \Ket{10} + \beta_1 \beta_2 \Ket{11} + \ket{\psi_1 \psi_2} + = \ket{\psi_1} \otimes \ket{\psi_2} + &= \alpha_1 \alpha_2 \ket{00} + \alpha_1 \beta_2 \ket{01} + \beta_1 \alpha_2 \ket{10} + \beta_1 \beta_2 \ket{11} \\ - &= c_{00} \Ket{00} + c_{01} \Ket{01} + c_{10} \Ket{10} + c_{11} \Ket{11} + &= c_{00} \ket{00} + c_{01} \ket{01} + c_{10} \ket{10} + c_{11} \ket{11} \end{aligned}$$ Note that a two-qubit system may be [entangled](/know/concept/quantum-entanglement/), in which case the coefficients $$c_{00}$$ etc. cannot be written as products, -i.e. $$\Ket{\psi_2}$$ cannot be expressed separately from $$\Ket{\psi_1}$$, and vice versa. +i.e. $$\ket{\psi_2}$$ cannot be expressed separately from $$\ket{\psi_1}$$, and vice versa. +In other words, the action of a two-qubit gate +can be expressed in the basis of $$\ket{00}$$, $$\ket{01}$$, $$\ket{10}$$ and $$\ket{11}$$, +but not always in the basis of $$\ket{0}_1$$, $$\ket{1}_1$$, $$\ket{0}_2$$ and $$\ket{1}_2$$. -In other words, the general action of a two-qubit quantum gate -can be expressed in the basis of $$\Ket{00}$$, $$\Ket{01}$$, $$\Ket{10}$$ and $$\Ket{11}$$, -but not always in the basis of $$\Ket{0}_1$$, $$\Ket{1}_1$$, $$\Ket{0}_2$$ and $$\Ket{1}_2$$. - -With that said, the first two-qubit gate is $$\mathrm{SWAP}$$, -which simply swaps $$\Ket{\psi_1}$$ and $$\Ket{\psi_2}$$: +With this noted, the first two-qubit gate is $$\mathrm{SWAP}$$, +which simply swaps $$\ket{\psi_1}$$ and $$\ket{\psi_2}$$: {% include image.html file="swap.png" width="22%" alt="SWAP gate diagram" %} @@ -219,18 +219,18 @@ $$\begin{aligned} } \end{aligned}$$ -This matrix is given in the basis of $$\Ket{00}$$, $$\Ket{01}$$, $$\Ket{10}$$ and $$\Ket{11}$$. +This matrix is given in the basis of $$\ket{00}$$, $$\ket{01}$$, $$\ket{10}$$ and $$\ket{11}$$. Note that $$\mathrm{SWAP}$$ cannot generate entanglement, so if its input is separable, its output is too. In any case, its effect is clear: $$\begin{aligned} - \mathrm{SWAP} \Ket{\psi_1 \psi_2} - &= c_{00} \Ket{00} + c_{10} \Ket{01} + c_{01} \Ket{10} + c_{11} \Ket{11} + \mathrm{SWAP} \ket{\psi_1 \psi_2} + &= c_{00} \ket{00} + c_{10} \ket{01} + c_{01} \ket{10} + c_{11} \ket{11} \end{aligned}$$ Next, there is the **controlled NOT gate** $$\mathrm{CNOT}$$, -which "flips" (applies $$X$$ to) $$\Ket{\psi_2}$$ if $$\Ket{\psi_1}$$ is true: +which "flips" (applies $$X$$ to) $$\ket{\psi_2}$$ if $$\ket{\psi_1}$$ is true: {% include image.html file="cnot.png" width="22%" alt="CNOT gate diagram" %} @@ -250,13 +250,13 @@ $$\begin{aligned} That is, it swaps the last two coefficients $$c_{10}$$ and $$c_{11}$$ in the composite state vector: $$\begin{aligned} - \mathrm{CNOT} \Ket{\psi_1 \psi_2} - &= c_{00} \Ket{00} + c_{01} \Ket{01} + c_{11} \Ket{10} + c_{10} \Ket{11} + \mathrm{CNOT} \ket{\psi_1 \psi_2} + &= c_{00} \ket{00} + c_{01} \ket{01} + c_{11} \ket{10} + c_{10} \ket{11} \end{aligned}$$ More generally, from every one-qubit gate $$U$$, we can define a two-qubit **controlled U gate** $$\mathrm{CU}$$, -which applies $$U$$ to $$\Ket{\psi_2}$$ if $$\Ket{\psi_1}$$ is true: +which applies $$U$$ to $$\ket{\psi_2}$$ if $$\ket{\psi_1}$$ is true: {% include image.html file="cu.png" width="22%" alt="CU gate diagram" %} @@ -277,8 +277,8 @@ Where the lower-right 2x2 block is simply $$U$$. The general action of this gate is given by: $$\begin{aligned} - \mathrm{CU} \Ket{\psi_1 \psi_2} - &= c_{00} \Ket{00} + c_{01} \Ket{01} + (c_{10} u_{00} + c_{11} u_{01}) \Ket{10} + (c_{10} u_{10} + c_{11} u_{11}) \Ket{11} + \mathrm{CU} \ket{\psi_1 \psi_2} + &= c_{00} \ket{00} + c_{01} \ket{01} + (c_{10} u_{00} + c_{11} u_{01}) \ket{10} + (c_{10} u_{10} + c_{11} u_{11}) \ket{11} \end{aligned}$$ A set of gates is **universal** if all possible mappings @@ -287,6 +287,7 @@ A minimal universal set is $$\{\mathrm{CNOT}, T, S\}$$, and there exist many others. + ## References 1. J.S. Neergaard-Nielsen, *Quantum information: lectures notes*, -- cgit v1.2.3