Suppose I have a register(qs) of 3 qubits (first 2 being used solely for control, the last one is the input) . The first two control qubits are in the |+>
state and the state of the 3rd input is unknown. Let it be a|0> + b|1>
.
Now I apply CCNOT(qs[0],qs[1],qs[2]) so their combined state becomes 0.5(a,b,a,b,a,b,b,a)
in Transposed matrix form [Please correct if I'm wrong here] . Now I apply S-gate to the 3rd qubit which transforms |1> -> i|1>
.
I am unable to guess the state of the combined state of 'qs' now.
What I thought:
|XY1>
so the combined state becomes 0.5(a,ib,a,ib,a,ib,b,ia) [Transposed]
(I x I x S)
since I'm not changing the first 2 qubits. Performing this yields a different result which is 0.5(a,b,a,b,ia,ib,ib,ia) [Transposed]
[Again, correct me if I'm wrong]. Which is the correct output after passing through S-gate (if any) ?
The first two qubits can't start in |+> state, since |+> is a single-qubit state. I assume that the starting state of the first two qubits in the register is 0.5 (|00> + |01> + |10> + |11>)
.
Both approaches are correct, because they are different ways to represent the same transformation. The first answer 0.5(a,ib,a,ib,a,ib,b,ia) [Transposed]
is correct. Your second answer 0.5(a,b,a,b,ia,ib,ib,ia) [Transposed]
seems to be obtained by multiplying by S x I x I
, i.e., applying S
gate on the first qubit instead of the third one.
The tensor product I x I x S
can be calculated as tensor product of I x I
(which is just a 4x4 identity matrix) and S
. The result is an 8x8 matrix which consists of 16 copies of S
matrix, multiplied by corresponding elements of I x I
:
1 0 | 0 0 | 0 0 | 0 0
0 i | 0 0 | 0 0 | 0 0
- - - - - - - -
0 0 | 1 0 | 0 0 | 0 0
0 0 | 0 i | 0 0 | 0 0
- - - - - - - -
0 0 | 0 0 | 1 0 | 0 0
0 0 | 0 0 | 0 i | 0 0
- - - - - - - -
0 0 | 0 0 | 0 0 | 1 0
0 0 | 0 0 | 0 0 | 0 i
If you multiply the state of the qubits by this matrix, you'll get the same answer as in the first approach.