Home Algorithms Commercialization Data Science Information Theories Quantum Theories Lab Linear Algebra
<< GHZ State PDF IBM Q - Sqrt T >>

$\require{cancel} \newcommand{\Ket}[1]{\left|{#1}\right\rangle} \newcommand{\Bra}[1]{\left\langle{#1}\right|} \newcommand{\Braket}[1]{\left\langle{#1}\right\rangle} \newcommand{\Rsr}[1]{\frac{1}{\sqrt{#1}}} \newcommand{\RSR}[1]{1/\sqrt{#1}} \newcommand{\Verti}{\rvert} \newcommand{\HAT}[1]{\hat{\,#1~}} \DeclareMathOperator{\Tr}{Tr}$

Hadamard on Multi-Qubits

First created in September 2018

It is useful to express multi-qubit quantum states in terms of a sumation of all possible states.

Unbiased Superposition

For an $n$-qubit system, there are $N=2^n$ states. By applying Hadamard transform to all $n$ qubits, an unbiased superposition is obtained.

$\displaystyle H^{\otimes n}\Ket0^{\otimes n}=\Rsr{2^n}\sum_{k=0}^{N-1}\Ket k .$

The simplest form when $n=1$ is $H\Ket0=\Rsr2(\Ket0+\Ket1).$

When $n=2,~H\otimes H\Ket{00}={1\over2}(\Ket{00}+\Ket{01}+\Ket{10}+\Ket{11}).$

Phase

Instead of an all-zero $\Ket0^{\otimes n}$, let us examine bit-patterns of $\Ket{x_k}^{\otimes n}$ where $x_k\in\{0,1\}$.

Notation: Pattern $\Ket x=\Ket{x_1x_2\ldots x_n}~~\text{with iteration variable }\Ket z=\Ket{z_1z_2\ldots z_n},$


When $n=1,~\Ket x=\Ket{x_1},~\Ket z=\Ket{z_1},$

$H\Ket{x_1} =\Rsr2(\Ket0+(-1)^{x_1}\Ket1) =\Rsr2((-1)^{x_1\cdot 0}\Ket0+(-1)^{x_1\cdot 1}\Ket1) =\Rsr2\sum_{z=0}^1(-1)^{x_1z_1}\Ket z .$


When $n=2,~\Ket{x_1x_2},~\Ket z=\Ket{z_1z_2}$

$H\otimes H\Ket{x_1x_2}\\ ={1\over2}~(\Ket0+(-1)^{x_1}\Ket1)~(\Ket0+(-1)^{x_2}\Ket1)\\ ={1\over2}(\Ket{00}+(-1)^{x_2}\Ket{01}+(-1)^{x_1}\Ket{10}+(-1)^{x_1+x_2}\Ket{11}) .$

It appears that $(-1)^{x_k}$ appears when and only when $z_k=1$, so we can generally apply $(-1)^{x_kz_k}$ to all values of $z$.

$H\otimes H\Ket{x_1x_2}={1\over2}\sum_{z=0}^3(-1)^{x_1z_1+x_2z_2}\Ket{z_1z_2}.$


Generally, for $\Ket x=\Ket{x_1x_2\ldots x_n},~\Ket z=\Ket{z_1z_2\ldots z_n},$

$\displaystyle H^{\otimes n}\Ket{x_1x_2\ldots x_n} =\Rsr{2^n}\sum_{z_1,z_2,\ldots,z_n}(-1)^{x_1z_1+x_2z_2+\ldots+x_nz_n}\Ket{z_1z_2\ldots z_n} .$

$\boxed{H^{\otimes n}\Ket x=\Rsr{2^n}\sum_z(-1)^{x\cdot z}\Ket z}$ where $x\cdot z$ is the sum of the bit-wise AND result of the two patterns $x$ and $z$.

Code Section Template

In [1]:
# Initialisation

import sys
sys.path.append('../')
from qtol import *
In [2]:
# Iteration

# Number of qubits
qbNum = 1

# Define the Quantum and Classical Registers
q = QuantumRegister(qbNum)
c = ClassicalRegister(qbNum)

qc = QuantumCircuit(q, c)

# Preparation
qc.iden(q)

# Circuit building
# ...

# Finalisation
# ...

show_me(qc, q, c, show_latex=True, show_bloch_vector=True, show_histogram=True)

circuit_drawer(qc)
Raw vector:   [1.+0.j 0.+0.j]
Normalised:   [1.+0.j 0.+0.j]
Text form:    |0>
$$\text{LaTeX form:}\quad\Ket{0}$$
Bloch Vector: [ 0.002  -0.0508  1.    ]
$$\cos(0.0\pi)\Ket0 + e^{i~0.0\pi}\sin(0.0\pi)\Ket1$$
Out[2]:

 

<< GHZ State Top IBM Q - Sqrt T >>