S Lazy-H
  • Home
  • About
  • Posts
  • Contact
  • Slide Rules
  • A Biker’s Tale

On this page

  • Truth Tables

Quantum Investigations Part 2

quantum mechanics
Author

Sam Hutchins

Published

September 5, 2023

Now I will attempt to go further into quantum states and gates and what they mean. This is the second post, following the first post on this same subject.

Truth Tables

To see how qubits are influenced by other qubits for a particular gate type, truth tables can show the quantum analogue bits. For the X and Y gates, the truth table is the same (i.e., truth.table(X,1)).

  In1 Out1
1   0    1
2   1    0

So the X gate performs a bit flip (NOT) operation, where the Y gate performs a bit flip on |0> and a phase flip on |1>. The Z, S and T gates show the following.

##   In1 Out1
## 1   0    0
## 2   1    1

Whereas the H gate shows \(\frac{\pi}{2}\) Y-axis rotation followed by a Pauli X gate.

\(\qquad \qquad In1 \qquad Out1\)

\(\qquad \qquad \ \ \ 0 \qquad \ \ \ \frac{1}{\sqrt{2}} (|0>+|1>)\)

\(\qquad \qquad \ \ \ 1 \qquad \ \ \ \frac{1}{\sqrt{2}} (|0>-|1>)\)

The Hadamard gate (H) creates a uniform superposition of the initialized quantum state, so if we apply it to |0>, as so: \(H(1)*qstate(1)\), we get

   ( 0.7071 )   * |0> 
 + ( 0.7071 )   * |1> 

which gives us a unitary matrix shown in the M slot as

          [,1]       [,2]
[1,] 0.7071+0i  0.7071+0i
[2,] 0.7071+0i -0.7071+0i

and represented by

\[H = \frac{1}{\sqrt{2}} \begin{pmatrix}1 & 1\\1 & -1\end{pmatrix}\]

and, just for fun, manually generated as such, without the complex entries, where each matrix value is multiplied by the \(\frac{1}{\sqrt{2}}\).

mat <- matrix(c(1,1,1,-1),nrow=2,ncol=2)
1/sqrt(2) * mat
       [,1]    [,2]
[1,] 0.7071  0.7071
[2,] 0.7071 -0.7071

The Hadamard gate interchanges the x- and z-axis and inverts the y-axis. That can be seen graphically by deploying it to the Bloch sphere image1 in the first post. Multiplying M by its conjugate transpose2 obtains the identity matrix3

H(1)@M %*% Conj(t(H(1)@M))
              [,1]          [,2]
[1,]  1.000e+00+0i -2.237e-17+0i
[2,] -2.237e-17+0i  1.000e+00+0i
Now, this is interesting, as I should obtain the following instead of the above. What I may be seeing is a rounding error.
     [,1] [,2]  
[1,] 1+0i 0+0i  
[2,] 0+0i 1+0i  

Anyway, generally speaking, all allowable operations on quantum state vectors are represented by unitary matrices.

So far, all these gate operations have been using single-qubits. Perhaps in another post, I will try some operations using multiple-qubits. And that’s all for now. Have a great day! We praise God for all we have, and thank Him daily.

Footnotes

  1. I briefly considered making a Bloch sphere showing each gate transformation, but would make the posts much, much too long, And, there are many animated GIFs online that do that very thing.↩︎

  2. The transpose of a matrix is found by exchanging the rows and columns of the matrix.↩︎

  3. The identity matrix is a square matrix with 1s along the diagonal and 0s everywhere else, and plays a role analogous to the number 1 in the matrix world..↩︎

© S Lazy-H 2019 -