Cbit gates continued

Lecture II

One of the most important 2-cbit gates ( the (Subscript[C, 01]) and (Subscript[C, 10]) gates) can be constructed by sums of products of 1 bit gates.
First we introduce the Pauli gates which act only on individual 1-cbit states, 

in the Mermin text they are called X (see 1.17), Z (1.37) and Y (1.50) 
there is also the identity gate (it does nothing) I.

Pauli gates

Ipauli={{1,0},{0,1}};
Xpauli={{0,1},{1,0}};
Zpauli={{1,0},{0,-1}};
MatrixForm[Ipauli]
MatrixForm[Xpauli]
MatrixForm[Zpauli]

C01=1/2 (KroneckerProduct[Ipauli,Ipauli]+KroneckerProduct[Xpauli,Ipauli])+ 1/2(KroneckerProduct[Ipauli,Zpauli]).(KroneckerProduct[Ipauli,Ipauli]-KroneckerProduct[Xpauli,Ipauli])
MatrixForm[%]

offoff=column[off,off]
offon=column[off,on]
onoff=column[on,off]
onon=column[on,on]

(* Lets operate these input states with C01 *)
C01.offoff
C01.offon
C01.onoff
C01.onon

(* Lets check the relations as logicals *)
C01.offoff==offoff
C01.offon==onon
C01.onoff==onoff
C01.onon==offon

(Subscript[C, 01]) (and (Subscript[C, 10])) are one of the most important 2-cbit (Qbit) gates in this course. It is called a Controlled-Not  or CNOT gate. Do you see why?  If the first cbit  (cbit 0) is turned off, then the second cbit (i.e. cbit 1 ) is unchanged. Likewise if the first  bit (also called the control cbit) is in the on
position then cbit 1 is flipped, off to on and visa versa.  This is best described visually.

Another way to describe this gate is through the following notation

(Subscript[C, 01])|x⟩|y⟩=|x ⊕ y ⟩|y⟩ 

i.e. (Subscript[C, 01])leaves the 0 cbit |y⟩ alone, but changes the 1 cbit into | x  ⊕ y ⟩, but what does x  ⊕ y  mean?

Pauli gates

A short excursion into modular arithmetic

Consider the set of integers and suppose we have two of them x, and y.  Lets add  x + y, the result will either be an odd number, in that case we
define  x ⊕ y = 1  (the one is just a symbol for the fact the our regular sum is an odd number). Alternatively if x + y is an even number we
say that  x ⊕ y = 0. Our symbol  ⊕ here refers to addition modulu 2.  

In general a number if we give the following number  e.g.  39 Mod4 we divide 39/4=36/4+3, and we just look at the remainder then
and dont' care about the part that is divisible by 4. Thus we say that 39 Mod4 is congruent  to 3.

Mod[39,4]

Mod[1,4]
Mod[2,4]
Mod[3,4]
Mod[4,4]
Mod[5,4]
Mod[6,4]
Mod[7,4]
Mod[8,4]
Mod[9,4]

Note: the cyclic pattern and so modular arithmetic is also sometimes called clock arithmetic. See that 7 Mod4 is congruent to 39 Mod4, etc.
How do we add modular numbers ? 

Mod[A Mod n + B Mod n,n] = (A +B ) Mod n

x=23;
y=4;
Mod[Mod[x,2]+ Mod[y,2],2]==Mod[x+y,2]

so for base n=2 we get

1⊕0 = 1 Mod 2
1⊕1 = 0 Mod 2

We will talk a lot more on modular arithmetic when we discuss the Shor algorithm later in term.

Homework Assignment due 2/9.

Above we defined the 2-bit operator (gate)  (Subscript[C, 01]) using the identity .

(Subscript[C, ij]) = (1/2) ((Subscript[1, i])⊗(Subscript[1, j]) + (Subscript[1, i])⊗(Subscript[X, j])) +  (1/2)(Subscript[Z, i])⊗(Subscript[1, j]) ((Subscript[1, i])⊗(Subscript[1, j])-(Subscript[1, i])⊗ (Subscript[X, j]) )

(1) make sure you understand how (Subscript[C, 01]) was constructed above.  Use this formula to construct (in Mathematica) (Subscript[C, 10]).

(2) Use this gate to evaluate   (Subscript[C, 10])|00⟩, (Subscript[C, 10])|01⟩, (Subscript[C, 10])|10⟩, (Subscript[C, 10])|11⟩  in the manner described in my lecture notes above.

(3) Suppose you have a 3-cbit register i.e. | a b c ⟩. Construct  (Subscript[C, 02])  and write a routine that evaluates the action of (Subscript[C, 02]) on all possible
 states (Subscript[|x ⟩, 3]).

(4) Show that the identity given  is indeed correct by constructing those operators using Mathematica. (you can work in a two-cbit space)

(5) Construct the swap gate  (Subscript[S,  12])using the identity

(Subscript[S,   i j]) = (Subscript[n, i])(Subscript[n, j]) +  (Subscript[m, i])(Subscript[m, j])  + (Subscript[X, i]) (Subscript[X, j]) (  (Subscript[n, i])(Subscript[m, j]) +  (Subscript[m, i])(Subscript[n, j]) )     where  (Subscript[X, i])   is the Pauli X operator and  n=(({{0, 0}, {0, 1}}))  m = (({{1, 0}, {0, 0}})).

Apply (Subscript[S, 12]) on (Subscript[all |x ⟩, 3]).

Hyperlink["http://www.youtube.com/watch?v=cYjM52XGhPc"]