Logic and Matrices

ianmcloughlin.github.io linkedin github

\(2 \times 2\) Matrices

\(\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\)

\(\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\)

Representing Bits

\(|0 \rangle \rightarrow \begin{bmatrix} 1 \\ 0 \end{bmatrix}\)

\(|1 \rangle \rightarrow \begin{bmatrix} 0 \\ 1 \end{bmatrix}\)

\(\textsf{NOT}\) Gate

NOT Gate Symbol

\(\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}\)

\(\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}\begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}\)

\(\textsf{BUFFER}\) Gate

Buffer Gate

\(\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}\)

\(\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}\begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}\)

Other One Bit Gates

All zero gate?

All one gate?

Two bits

Zero, zero

\(|0\rangle|0\rangle = |00\rangle := |0\rangle \otimes |0\rangle\)

\(|00\rangle \rightarrow \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \times \begin{bmatrix} 1 \\ 0 \end{bmatrix} \\[4mm] 0 \times \begin{bmatrix} 1 \\ 0 \end{bmatrix} \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}\)

Zero, one

\(|01\rangle \rightarrow \begin{bmatrix} 1 \\ 0 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 1 \times \begin{bmatrix} 0 \\ 1 \end{bmatrix} \\[4mm] 0 \times \begin{bmatrix} 0 \\ 1 \end{bmatrix} \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix}\)

One, zero

\(|10\rangle \rightarrow \begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 0 \times \begin{bmatrix} 1 \\ 0 \end{bmatrix} \\[4mm] 1 \times \begin{bmatrix} 1 \\ 0 \end{bmatrix} \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix}\)

One, one

\(|11\rangle \rightarrow \begin{bmatrix} 0 \\ 1 \end{bmatrix} \otimes \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \times \begin{bmatrix} 0 \\ 1 \end{bmatrix} \\[4mm] 1 \times \begin{bmatrix} 0 \\ 1 \end{bmatrix} \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix}\)

\(\textsf{AND}\) Gate

AND Gate

\(\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix} \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}\)

\(\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix} \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}\)

\(\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix} \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \end{bmatrix}\)

\(\begin{bmatrix} ? & ? & ? & ? \\ ? & ? & ? & ? \end{bmatrix} \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \end{bmatrix}\)