This Jupyter Notebook provides a reproducible classical simulation of measurement probabilities for a single qubit using the Born rule The notebook accompanies Chapter 2 of Quantum Computing Preliminaries and demonstrates how the same quantum state produces different probability distributions when measured in different orthonormal bases A generic pure qubit state is constructed from a polar angle of pi divided by 3 and an azimuthal angle of pi divided by 4 on the Bloch sphere The notebook calculates the probabilities of measuring this state in the computational basis and in the Hadamard basis In the computational basis the probabilities of the zero and one outcomes are three quarters and one quarter In the Hadamard basis the probabilities of the plus and minus outcomes are calculated from the corresponding complex inner products The implementation validates that the quantum state is finite one dimensional and normalised It also verifies that each supplied measurement basis has the correct dimensions and is orthonormal Numerical consistency checks confirm that the probabilities obtained in each basis independently sum to 1 within a suitable floating point tolerance The notebook uses Python 3 and NumPy No external datasets internet connection quantum computing framework or physical quantum hardware are required
This Jupyter Notebook provides a reproducible classical simulation of measurement probabilities for a single qubit using the Born rule The notebook accompanies Chapter 2 of Quantum Computing Preliminaries and demonstrates how the same quantum state produces different probability distributions when measured in different orthonormal bases A generic pure qubit state is constructed from a polar angle of pi divided by 3 and an azimuthal angle of pi divided by 4 on the Bloch sphere The notebook calculates the probabilities of measuring this state in the computational basis and in the Hadamard basis In the computational basis the probabilities of the zero and one outcomes are three quarters and one quarter In the Hadamard basis the probabilities of the plus and minus outcomes are calculated from the corresponding complex inner products The implementation validates that the quantum state is finite one dimensional and normalised It also verifies that each supplied measurement basis has the correct dimensions and is orthonormal Numerical consistency checks confirm that the probabilities obtained in each basis independently sum to 1 within a suitable floating point tolerance The notebook uses Python 3 and NumPy No external datasets internet connection quantum computing framework or physical quantum hardware are required
This Jupyter Notebook provides a reproducible simulation of single qubit measurement probabilities using the Born rule. It accompanies Chapter 2 of Quantum Computing Preliminaries and demonstrates the relationship between complex vector calculations, Bloch sphere geometry and experimentally observed measurement frequencies. The notebook implements a validated Python function that calculates both the complex probability amplitude and the corresponding transition probability for an initial quantum state and a measurement state. It checks that the supplied vectors are finite, one dimensional, equal in size and correctly normalised. Invalid or physically inconsistent inputs produce informative errors. A worked example prepares a qubit in the computational zero state and measures it in the Pauli X basis. The calculated probabilities of obtaining the plus and minus outcomes are both 0.5, and their sum is verified to be 1. The result is independently confirmed using the geometric relationship between the corresponding Bloch sphere vectors. The notebook also constructs general pure qubit states at different polar and azimuthal angles. It compares numerical transition probabilities with the Bloch sphere half angle prediction across a range of sampled angles and verifies agreement within a numerical tolerance. A finite measurement simulation using 10000 trials illustrates the distinction between an exact theoretical probability and an observed experimental frequency. A fixed random seed of 2026 ensures that this demonstration is reproducible. The notebook records the Python version, NumPy version and execution platform. It requires only Python 3, Jupyter Notebook or JupyterLab, and NumPy. No external datasets, internet connection, quantum computing framework or physical quantum hardware are required.
This Jupyter Notebook provides a reproducible numerical demonstration of the Born rule for projective measurements of a single qubit. It explains how a complex inner product is converted into a physically meaningful measurement probability. Using Python and NumPy, the notebook defines a validated function that calculates the probability amplitude between an initial quantum state and a measurement state. It then calculates the transition probability by taking the squared absolute value of that amplitude. The implementation checks that both state vectors are finite, one dimensional, equal in size and correctly normalised. It uses the NumPy vdot function to apply complex conjugation to the measurement state correctly. In the worked example, the qubit is prepared in the computational zero state and measured in the Pauli X basis. The calculation shows that the probabilities of obtaining the plus and minus outcomes are both 0.5. It also confirms that the two probabilities sum to 1. The numerical result is compared with the corresponding Bloch sphere prediction. The notebook verifies that the vector calculation and the geometric calculation both produce a transition probability of 0.5. Numerical consistency checks confirm agreement between the two calculation methods and verify probability conservation. The notebook requires Python 3, Jupyter Notebook or JupyterLab, and NumPy. It does not require a quantum computing framework or access to physical quantum hardware.
This Python/NumPy program implements an ideal projective measurement for a single-qubit state. It verifies that the supplied state is normalised and that the measurement operator is both Hermitian and idempotent. It then applies the Born rule to calculate the probability of the selected outcome. When the probability is non-zero, the program constructs and normalises the conditional post-measurement state; when the probability is zero within the specified numerical tolerance, it reports that the outcome cannot occur and avoids invalid normalisation of the zero vector. Two worked examples demonstrate both a possible and an impossible measurement outcome.
This educational Jupyter notebook demonstrates how to simulate sequential quantum-gate operations using NumPy. Beginning with the computational-basis state |0>, it applies the Hadamard and Pauli-X operators in chronological circuit order while explaining the corresponding right-to-left order of matrix multiplication. The notebook uses NumPy's matrix-multiplication operator to compute intermediate and final state vectors, verifies the equivalence of composite-operator evaluation, and confirms that unitary evolution preserves state normalisation. It is intended as a transparent, reproducible introduction to matrix-based single-qubit simulation for students, educators and readers beginning their study of quantum computing.
Quantum computing uses a mathematical language that can seem unfamiliar to readers from programming, engineering and other technical backgrounds. Qubits are represented by vectors, quantum gates by matrices, measurement outcomes by eigenvalues, and probability amplitudes by complex numbers. Quantum Computing Preliminaries develops this language carefully, connecting each mathematical idea with its computational and physical meaning. The book begins with complex vector spaces and explains why quantum states require more than classical probabilities. It introduces qubits, superposition, normalisation, basis vectors and Dirac bra–ket notation, supported by worked calculations and geometric interpretation using the Bloch sphere. The discussion then turns to inner products and the geometry of quantum states. Readers learn how to calculate norms, test orthogonality, determine state overlap and apply the Born rule. Particular attention is given to complex conjugation and the distinction between the ordinary dot product and the Hermitian inner product used in quantum mechanics.The treatment of matrix operators establishes the roles of linear, unitary and Hermitian operators. It explains matrix multiplication, non-commutativity, eigenvalues, eigenvectors, reversibility and norm preservation. The Pauli and Hadamard gates provide concrete examples that link matrix algebra to rotations, the Bloch sphere, quantum-state evolution, and measurement. Outer products and projection operators are developed as tools for constructing operators, selecting state components and describing ideal projective measurements. The book examines idempotence, completeness, repeated measurement and the distinction between the ket–bra outer product and the tensor product used to form composite quantum systems. The final chapter explores changes of basis, operator representations and diagonalisation. It shows how the same physical state or operation can have different numerical representations in the computational and Hadamard bases. Readers derive the similarity transformation, use outer-product substitution, diagonalise Hermitian operators and interpret the spectral decomposition geometrically. Examples involving the Pauli-X, Pauli-Y, Pauli-Z and Hadamard operators demonstrate how basis choice exposes phase, population and measurement structure without changing the underlying physics. Throughout the book, Python and NumPy examples translate the mathematics into executable calculations. The programs demonstrate complex-vector operations, inner products, eigendecomposition, basis transformation and numerical verification while explaining the importance of using operations suited to complex Hilbert spaces. Each chapter includes conceptual, mathematical, computational and challenge exercises. Detailed solutions provide step-by-step derivations, program output and physical interpretation, allowing the book to support both guided study and independent practice. Quantum Computing Preliminaries is intended for students, software developers, engineers and technically minded readers preparing to study quantum circuits, algorithms, simulation, measurement, entanglement or error correction. It assumes familiarity with elementary algebra and programming but does not require prior training in quantum mechanics. Its purpose is to provide a clear mathematical foundation for understanding how quantum information is represented, transformed and measured.
This Jupyter Notebook provides a reproducible implementation for determining whether two complex quantum state vectors are orthogonal The notebook accompanies Chapter 2 of Quantum Computing Preliminaries and demonstrates how orthogonality is tested using the absolute value of the complex inner product The Python function accepts normalised or unnormalised state vectors and normalises them automatically before calculating their overlap The implementation validates that both inputs are finite nonempty one dimensional and equal in size It also rejects the zero vector because the zero vector cannot be normalised The calculation uses the NumPy vdot function to apply complex conjugation to the first vector correctly A numerical tolerance is used to determine whether the absolute overlap is sufficiently close to zero The function returns True when the states are orthogonal and False otherwise The notebook includes examples involving the computational zero state the computational one state the plus state and two unnormalised complex vectors The examples confirm that the computational zero and one states are orthogonal while the computational zero and plus states are not orthogonal The unnormalised complex example also demonstrates a pair of states that are not orthogonal Numerical assertions verify all calculated results The notebook requires Python 3 Jupyter Notebook or JupyterLab and NumPy No external datasets internet connection quantum computing framework or physical quantum hardware are required