Quantum Logic Gates

Quantum circuits are primarily composed of logic gates. It is these logic gates that create and utilize phenomenon like superposition and entanglement of qubits, which are responsible for the interesting properties of quantum computing. This visualization allows you to apply single-qubit logic gates.


Add logic gates:


Remove logic gates:


Some Standard inputs:
Amplitudes input:

Or type the amplitudes here:

Both amplitudes should be between -1 and 1



Description

Every qubit \( | \psi \gt \) resides on a point on a Block sphere. It can be represented by two numbers \( (a, b)\) such that: \[ | \psi \gt = a | 0 \gt + b | 1 \gt \] Here, \( | 0 \gt \) and \( b | 1 \gt \) are known as the basis states. The probability that a qubit is measured in the \( | 0 \gt \) state is given by \( a^2 \). The probability that a qubit is measured in the \( | 1 \gt \) state is given by \( b^2 \). Following the postulates of probability, we require that: \[ a^2 + b^2 = 1 \] Logic gates essentially manipulate these amplitudes whilst preserving the normalisation. Every logic gate's action can be represented by a matrix. A logic gate with matrix representation \( M \), acts on a qubit \( | \psi \gt \) to produce \( M | \psi \gt \) via matrix multiplication. The single-qubit logic gates are:

  1. Hadamard gate:
    This gate is mainly used for spreading and recombination of quantum states. It operates as follows: \[ (a, b) \rightarrow \left( \frac{a + b}{\sqrt{2}}, \frac{a - b}{\sqrt{2}} \right) \] Its matrix representation is: \[ H = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \]
  2. Pauli-X or NOT gate: This gate interchanges the amplitudes of the qubit's state: \[ (a, b) \rightarrow (b, a) \] Its matrix representation is: \[ X = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \]
  3. Pauli-Z or phase-flip gate: This gate flips the sign of the 2nd amplitude \[ (a, b) \rightarrow (a, -b) \] Its matrix representation is: \[ Z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} \]

All the above logic gates function as their own inverse. You can verify that \( HH = XX = ZZ = I \)




Note:
  1. Besides H, X and Z, there are other single qubit gates like Pauli-Y (Y), Phase (P), \( \frac{\pi}{8} \) (T), etc
  2. Multi qubit gates also exist: Controlled NOT (CNOT), Controlled Z (CZ), Toffoli (TOFF), SWAP, etc
  3. In order to preserve normalization, the matrix associated with every logic gate must be unitary \( M M^{\dagger} = M^{\dagger} M = I \).
  4. The program does not consider your text-input until it is defined and proper


Developed by ChanRT | Fork me at GitHub