Lesson 2: Quantum Bits and Quantum States | Quantum Computing with D-Wave and Quantum Machine Learning | Brain Illustrate Academy

Objectives

By the end of this lesson, you should be able to:

  • Represent qubits mathematically using state vectors and Dirac notation.
  • Understand and interpret the Bloch Sphere representation of qubits.
  • Perform basic manipulations of qubit states.
  • Visualize qubit states using software tools.

Lesson 2: Quantum Bits and Quantum States | Quantum Computing with D-Wave and Quantum Machine Learning | Brain Illustrate Academy



2.1 Introduction

In the previous lesson, we introduced the fundamental concepts of quantum computing, including qubits, superposition, and entanglement. This lesson delves deeper into the mathematical and physical representation of qubits, providing a foundation for understanding quantum computations and algorithms.


2.2 Mathematical Representation of Qubits

2.2.1 State Vectors and Dirac Notation

A qubit’s state is described by a vector in a two-dimensional complex Hilbert space. We use Dirac notation (also known as bra-ket notation) to represent quantum states.

  • Ket notation: \(|\psi\rangle\) represents a column vector (state vector).
  • Bra notation: \(\langle\psi|\) represents the conjugate transpose of the ket vector.

Basis States

The standard basis states for a qubit are:

  • \(|0\rangle = \begin{pmatrix}1 \\ 0\end{pmatrix}\)
  • \(|1\rangle = \begin{pmatrix}0 \\ 1\end{pmatrix}\)

General Qubit State

A general qubit state is a linear combination (superposition) of the basis states:

\[ |\psi\rangle = \alpha|0\rangle + \beta|1\rangle, \]

where \(\alpha, \beta \in \mathbb{C}\) and \(|\alpha|^2 + |\beta|^2 = 1\).

Example:

Let \(\alpha = \frac{1}{\sqrt{2}}\) and \(\beta = \frac{1}{\sqrt{2}}\):

\[ |\psi\rangle = \frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle. \]

This state is a superposition of \(|0\rangle\) and \(|1\rangle\) with equal probability amplitudes.


2.2.2 Normalization

Quantum states must be normalized to ensure that the total probability of all possible outcomes is 1:

\[ \langle \psi | \psi \rangle = |\alpha|^2 + |\beta|^2 = 1. \]


2.2.3 Global Phase and Physical Equivalence

States that differ only by a global phase factor \( e^{i} \) are physically indistinguishable:

\[ |\psi\rangle \sim e^{i\phi}|\psi\rangle. \]

This means that multiplying a quantum state by a global phase does not affect measurement outcomes.


2.3 The Bloch Sphere Representation

The Bloch Sphere provides a geometric visualization of a single qubit state as a point on the surface of a unit sphere in three-dimensional space.

2.3.1 Parametrization of Qubit States

Any qubit state can be represented using spherical coordinates:

\[ |\psi\rangle = \cos\left(\frac{\theta}{2}\right)|0\rangle + e^{i\phi}\sin\left(\frac{\theta}{2}\right)|1\rangle, \]

where:

  • \(\theta\) ∈ [0, Ï€] is the polar angle.
  • \(\phi\) ∈ [0, 2Ï€) is the azimuthal angle.

2.3.2 Visualization

  • North Pole (\(\theta = 0\)): Corresponds to the state \(|0\rangle\).
  • South Pole (\(\theta = Ï€\)): Corresponds to the state \(|1\rangle\).
  • Equator (\(\theta = \frac{Ï€}{2}\)): Represents equal superpositions of \(|0\rangle\) and \(|1\rangle\).
Bloch Sphere

Figure: The Bloch Sphere representation of qubit states.

2.3.3 Example States

  • \(|+\rangle\) state:

    \[ |\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle), \]

    Corresponds to \(\theta = \frac{Ï€}{2}, \phi = 0\).

  • \(|-\rangle\) state:

    \[ |\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle), \]

    Corresponds to \(\theta = \frac{π}{2}, \phi = π\).


2.4 Qubit State Manipulations

2.4.1 Quantum Gates

Quantum gates are operations that change the state of qubits. They are represented by unitary matrices (matrices \( U \) satisfying \( U^U = I \)).

Common Single-Qubit Gates

  • Pauli-X Gate (NOT Gate):

    \[ X = \begin{pmatrix}0 & 1 \\ 1 & 0\end{pmatrix} \]

    Effect: \( X|0= |1, X|1= |0\).

  • Pauli-Y Gate:

    \[ Y = \begin{pmatrix}0 & -i \\ i & 0\end{pmatrix} \]

  • Pauli-Z Gate:

    \[ Z = \begin{pmatrix}1 & 0 \\ 0 & -1\end{pmatrix} \]

  • Hadamard Gate (H Gate):

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

    Effect: Creates superposition from basis states.

2.4.2 State Transformation

Applying a gate \( U \) to a state \( |\):

\[ |\psi'\rangle = U|\psi\rangle. \]

Example:

Apply the Hadamard gate to \(|0\rangle\):

\[ |\psi'\rangle = H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle). \]


2.5 Measurement in Different Bases

Measurement collapses a qubit’s state to one of the eigenstates of the observable being measured.

2.5.1 Computational Basis Measurement

Standard measurement in the \(|0\rangle, |1\rangle\) basis.

2.5.2 Measurement in the Hadamard Basis

Uses the eigenstates of the \( X \) operator, \(|+\rangle\) and \(|-\rangle\):

  • \(|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\)
  • \(|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)\)

2.6 Density Matrix Representation

An alternative way to represent quantum states, especially useful for mixed states.

2.6.1 Pure States

For a pure state \( |\):

\[ \rho = |\psi\rangle\langle\psi|. \]

2.6.2 Mixed States

Statistical mixtures of quantum states, representing a system in state \( |_i\) with probability \( p_i \):

\[ \rho = \sum_i p_i |\psi_i\rangle\langle\psi_i|. \]


2.7 Quantum State Manipulations with Python

2.7.1 Using Qiskit for Simulation

Although D-Wave uses quantum annealing, we can use quantum circuit simulators like Qiskit to visualize and manipulate qubit states.

Installation

pip install qiskit matplotlib

Example Code

# Import necessary modules from Qiskit
from qiskit import QuantumCircuit
from qiskit.visualization import plot_bloch_vector
from qiskit.quantum_info import Statevector
import matplotlib.pyplot as plt
import numpy as np

# Create a single qubit quantum circuit
qc = QuantumCircuit(1)

# Apply Hadamard gate to qubit 0
qc.h(0)

# Get the statevector directly from the circuit
statevector = Statevector.from_instruction(qc)

# Extract the amplitudes for |0> and |1>
alpha = statevector.data[0]
beta = statevector.data[1]

# Compute the Bloch vector manually
x = 2 * np.real(alpha * np.conj(beta))
y = 2 * np.imag(alpha * np.conj(beta))
z = np.abs(alpha)**2 - np.abs(beta)**2
bloch_vector = [x, y, z]

# Plot the Bloch vector on the Bloch Sphere
plot_bloch_vector(bloch_vector)
plt.savefig('bloch_qubit.png')

2.8 Exercises

Exercise 1: Normalization and State Vector Components

Given the state:

\[ |\psi\rangle = \alpha|0\rangle + \beta|1\rangle, \]

with \(\alpha = \frac{3}{5}\) and \(\beta\) real and positive.

    1. Find the value of \(\beta\).
    1. Calculate the probabilities of measuring \(|0\rangle\) and \(|1\rangle\).

Solution:

  1. Normalize:

\[ |\alpha|^2 + |\beta|^2 = 1 \implies \left(\frac{3}{5}\right)^2 + \beta^2 = 1 \implies \beta^2 = 1 - \frac{9}{25} = \frac{16}{25} \implies \beta = \frac{4}{5}. \]

  1. Probabilities:

\[ P(0) = |\alpha|^2 = \left(\frac{3}{5}\right)^2 = \frac{9}{25}, \]

\[ P(1) = |\beta|^2 = \left(\frac{4}{5}\right)^2 = \frac{16}{25}. \]


Exercise 2: Applying Quantum Gates

Consider the qubit state \(|\psi\rangle = |0\rangle\).

    1. Apply the Hadamard gate \( H \) to \(|\psi\rangle\) and find the new state.
    1. Apply the Pauli-X gate \( X \) to the resulting state from part (a).
    1. Determine the probabilities of measuring \(|0\rangle\) and \(|1\rangle\) after each operation.

Solution:

  1. After applying \( H \):

\[ |\psi'\rangle = H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle). \]

  1. Apply \( X \):

\[ |\psi''\rangle = X|\psi'\rangle = X\left(\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\right) = \frac{1}{\sqrt{2}}(X|0\rangle + X|1\rangle) = \frac{1}{\sqrt{2}}(|1\rangle + |0\rangle) = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = |\psi'\rangle. \]

So applying \( X \) again brings the state back to \( |’\).

  1. Probabilities after applying \( H \):

\[ P(0) = \left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}, \quad P(1) = \frac{1}{2}. \]

Probabilities remain the same after applying \( X \), since the state is unchanged.


Exercise 3: Bloch Sphere Coordinates

Given a qubit state:

\[ |\psi\rangle = \cos\left(\frac{\pi}{4}\right)|0\rangle + e^{i\frac{\pi}{2}}\sin\left(\frac{\pi}{4}\right)|1\rangle. \]

    1. Simplify the state vector.
    1. Determine the coordinates \((\theta, \phi)\) on the Bloch Sphere.
    1. Calculate the probabilities of measuring \(|0\rangle\) and \(|1\rangle\).

Solution:

  1. Simplify:

\[ \cos\left(\frac{\pi}{4}\right) = \frac{1}{\sqrt{2}}, \quad \sin\left(\frac{\pi}{4}\right) = \frac{1}{\sqrt{2}}, \quad e^{i\frac{\pi}{2}} = i. \]

So,

\[ |\psi\rangle = \frac{1}{\sqrt{2}}|0\rangle + i\left(\frac{1}{\sqrt{2}}\right)|1\rangle = \frac{1}{\sqrt{2}}|0\rangle + \frac{i}{\sqrt{2}}|1\rangle. \]

  1. Coordinates:

\[ \theta = 2 \arccos\left(\frac{1}{\sqrt{2}}\right) = \frac{\pi}{2}, \]

\[ \phi = \frac{\pi}{2}. \]

  1. Probabilities:

\[ P(0) = \left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}, \quad P(1) = \left|\frac{i}{\sqrt{2}}\right|^2 = \frac{1}{2}. \]


2.9 Visualizing Qubit States Using Software Tools

2.9.1 Bloch Sphere Visualization with Qutip

Installation

pip install qutip

Example Code

import numpy as np
from qutip import Bloch, Qobj

# Define the state vector
alpha = 1/np.sqrt(2)
beta = 1/np.sqrt(2) * 1j
state = Qobj([[alpha], [beta]])

# Create Bloch sphere
b = Bloch()
b.add_states(state)
b.show()

2.10 Summary

  • Qubits are represented mathematically as state vectors in a complex Hilbert space using Dirac notation.
  • Superposition allows qubits to exist in linear combinations of basis states.
  • Normalization ensures that the total probability of all possible measurement outcomes is 1.
  • The Bloch Sphere provides a powerful visualization tool for single qubit states, mapping quantum states to points on a sphere.
  • Quantum Gates are unitary operations that manipulate qubit states.
  • Measurement collapses qubit states to basis states, with probabilities determined by the state’s amplitudes.
  • Visualization Tools like Qiskit and Qutip help in simulating and understanding qubit behaviors.

2.11 Further Reading

  • “Quantum Mechanics: The Theoretical Minimum” by Leonard Susskind and Art Friedman
  • “Introduction to Quantum Mechanics” by David J. Griffiths
  • Qiskit Tutorials: Qiskit Textbook

2.12 References

  1. Nielsen, M. A., & Chuang, I. L. (2010). Quantum Computation and Quantum Information. Cambridge University Press.
  2. Susskind, L., & Friedman, A. (2014). Quantum Mechanics: The Theoretical Minimum. Basic Books.
  3. Qutip Documentation: http://qutip.org

2.13 Conclusion

This lesson provided a detailed exploration of qubits and quantum states, emphasizing mathematical representations and visualizations. Understanding these foundational concepts is crucial for grasping more complex quantum phenomena and for practical implementations in quantum computing, which we will continue to explore in the upcoming lessons.


2.14 Activities

  • Experiment with Qubit States: Use Qutip or Qiskit to create and visualize different qubit states on the Bloch Sphere.
  • Quantum Gate Operations: Implement code to apply various quantum gates to qubits and observe the changes in their states.
  • State Manipulation: Try creating superposition and entangled states (with two qubits) and analyze their properties.

By mastering the content of this lesson, you are building a solid foundation for understanding quantum computations and algorithms, which will be essential as we progress to more advanced topics in quantum computing and specifically quantum annealing with D-Wave systems.


0 Comments

Brand creation, trend analysis & style consulting

Lorem Ipsum has been the industry's standard dummy text ever since. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since.