added 122 characters in body
Source Link

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

Why this is true? Let's take a an arbitrary two-qubit state:

$$| \psi \rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |10\rangle + a_{11} |11\rangle$$

CNOT action on $|10\rangle$ state:

$$CNOT |10\rangle = \big(|0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes X \big) |1\rangle \otimes |0\rangle = \\ = |0\rangle \langle 0|1\rangle \otimes |1\rangle + |1\rangle \langle 1|1\rangle \otimes X|0\rangle = |11\rangle$$

because $\langle 0|1\rangle = 0$ and $\langle 1|1\rangle = 1$. After doing similar calculations for all bitstrings we will obtain:

$$CNOT |\psi\rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |11\rangle + a_{11} |10\rangle$$

as one should expect from CNOT's definition (do noting if the control qubit is in the $|0\rangle$ state and apply $X$ to the target qubit if the control qubit is in the $|1\rangle$ state). This also can be shown with matrix representations:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

So:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$


Let's show that $CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

Why this is true? Let's take a an arbitrary two-qubit state:

$$| \psi \rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |10\rangle + a_{11} |11\rangle$$

CNOT action on $|10\rangle$ state:

$$CNOT |10\rangle = \big(|0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes X \big) |1\rangle \otimes |0\rangle = \\ = |0\rangle \langle 0|1\rangle \otimes |1\rangle + |1\rangle \langle 1|1\rangle \otimes X|0\rangle = |11\rangle$$

because $\langle 0|1\rangle = 0$ and $\langle 1|1\rangle = 1$. After doing similar calculations for all bitstrings we will obtain:

$$CNOT |\psi\rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |11\rangle + a_{11} |10\rangle$$

as one should expect from CNOT's definition (do noting if the control qubit is in the $|0\rangle$ state and apply $X$ to the target qubit if the control qubit is in the $|1\rangle$ state). This also can be shown with matrix representations:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

So:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

So:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$


Let's show that $CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

edited body
Source Link

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

Why this is true? Let's take a an arbitrary two-qubit state:

$$| \psi \rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |10\rangle + a_{11} |11\rangle$$

CNOT action on $|10\rangle$ state:

$$CNOT |10\rangle = \big(|0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes X \big) |1\rangle \otimes |0\rangle = \\ = |0\rangle \langle 0|1\rangle \otimes |1\rangle + |1\rangle \langle 1|1\rangle \otimes X|0\rangle = |11\rangle$$

because $\langle 0|1\rangle = 0$ and $\langle 1|1\rangle = 1$. After doing similar calculations for all bitstrings we will obtain:

$$CNOT |\psi\rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{11} |10\rangle + a_{11} |10\rangle$$$$CNOT |\psi\rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |11\rangle + a_{11} |10\rangle$$

as one should expect from CNOT's definition (do noting if the control qubit is in the $|0\rangle$ state and apply $X$ to the target qubit if the control qubit is in the $|1\rangle$ state). This also can be shown with matrix representations:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

So:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

Why this is true? Let's take a an arbitrary two-qubit state:

$$| \psi \rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |10\rangle + a_{11} |11\rangle$$

CNOT action on $|10\rangle$ state:

$$CNOT |10\rangle = \big(|0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes X \big) |1\rangle \otimes |0\rangle = \\ = |0\rangle \langle 0|1\rangle \otimes |1\rangle + |1\rangle \langle 1|1\rangle \otimes X|0\rangle = |11\rangle$$

because $\langle 0|1\rangle = 0$ and $\langle 1|1\rangle = 1$. After doing similar calculations for all bitstrings we will obtain:

$$CNOT |\psi\rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{11} |10\rangle + a_{11} |10\rangle$$

as one should expect from CNOT's definition (do noting if the control qubit is in the $|0\rangle$ state and apply $X$ to the target qubit if the control qubit is in the $|1\rangle$ state). This also can be shown with matrix representations:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

So:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

Why this is true? Let's take a an arbitrary two-qubit state:

$$| \psi \rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |10\rangle + a_{11} |11\rangle$$

CNOT action on $|10\rangle$ state:

$$CNOT |10\rangle = \big(|0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes X \big) |1\rangle \otimes |0\rangle = \\ = |0\rangle \langle 0|1\rangle \otimes |1\rangle + |1\rangle \langle 1|1\rangle \otimes X|0\rangle = |11\rangle$$

because $\langle 0|1\rangle = 0$ and $\langle 1|1\rangle = 1$. After doing similar calculations for all bitstrings we will obtain:

$$CNOT |\psi\rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |11\rangle + a_{11} |10\rangle$$

as one should expect from CNOT's definition (do noting if the control qubit is in the $|0\rangle$ state and apply $X$ to the target qubit if the control qubit is in the $|1\rangle$ state). This also can be shown with matrix representations:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

So:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$

added 1444 characters in body
Source Link

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

HenceWhy this is true? Let's take a an arbitrary two-qubit state:

$$| \psi \rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |10\rangle + a_{11} |11\rangle$$

CNOT action on $|10\rangle$ state:

$$CNOT |10\rangle = \big(|0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes X \big) |1\rangle \otimes |0\rangle = \\ = |0\rangle \langle 0|1\rangle \otimes |1\rangle + |1\rangle \langle 1|1\rangle \otimes X|0\rangle = |11\rangle$$

because $\langle 0|1\rangle = 0$ and $\langle 1|1\rangle = 1$. After doing similar calculations for all bitstrings we will obtain:

$$CNOT |\psi\rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{11} |10\rangle + a_{11} |10\rangle$$

as one should expect from CNOT's definition (do noting if the control qubit is in the $|0\rangle$ state and apply $X$ to the target qubit if the control qubit is in the $|1\rangle$ state). This also can be shown with matrix representations:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

So:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

Hence:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$

Here is the CNOT gate:

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

Why this is true? Let's take a an arbitrary two-qubit state:

$$| \psi \rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{10} |10\rangle + a_{11} |11\rangle$$

CNOT action on $|10\rangle$ state:

$$CNOT |10\rangle = \big(|0\rangle \langle 0| \otimes I + |1\rangle \langle 1| \otimes X \big) |1\rangle \otimes |0\rangle = \\ = |0\rangle \langle 0|1\rangle \otimes |1\rangle + |1\rangle \langle 1|1\rangle \otimes X|0\rangle = |11\rangle$$

because $\langle 0|1\rangle = 0$ and $\langle 1|1\rangle = 1$. After doing similar calculations for all bitstrings we will obtain:

$$CNOT |\psi\rangle = a_{00} |00\rangle + a_{01} |01\rangle + a_{11} |10\rangle + a_{11} |10\rangle$$

as one should expect from CNOT's definition (do noting if the control qubit is in the $|0\rangle$ state and apply $X$ to the target qubit if the control qubit is in the $|1\rangle$ state). This also can be shown with matrix representations:

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = \\ =\begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&0 \\ 0&0&0&0 \\ \end{pmatrix} + \begin{pmatrix} 0&0&0&0 \\ 0&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = \begin{pmatrix} 1&0&0&0 \\ 0&1&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ \end{pmatrix} = CNOT$$

So:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

If we will take into account $HXH = Z$ and $HH = I$, then:

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$

Source Link
Loading