+
Introduction to Quantum Computing

Developed by Marie Lopez del Puerto - Published March 24, 2025

DOI: 10.1119/PICUP.Exercise.IntroQComp

This set of exercises is based on the Open Access book [Quantum Computing for the Quantum Curious](https://link.springer.com/book/10.1007/978-3-030-61601-4) by Ciaran Hughes, Joshua Isaacson, Anastasia Perry, Ranbel F. Sun, Jessica Turner. Exercise 6 uses the [Stern–Gerlach simulator](https://physics.nfshost.com/demos/Sterngerlach/). The Exercise Set is an introduction to superposition, qubits, the Bloch sphere, the Stern-Gerlach apparatus and changing measurement basis, quantum gates, entanglement, and quantum algorithms.
Subject Areas Modern Physics and Quantum Mechanics
Level Beyond the First Year
Available Implementations IPython/Jupyter Notebook and MATLAB
Learning Objectives
At the end of this exercise set students should: * Be able to represent a quantum state as a vector (Exercises 1 and 3) * Be able to calculate the probabilities for measuring each of the states in a superposition of quantum states (Exercises 1, 8, and 9) * Be able to visualize and interpret quantum states on the Bloch sphere (Exercises 2 and Questions 1-2) * Be able to represent gates as matrices and understand changes to a quantum state after a matrix operation (Exercises 4-7) * Be able to describe spin measurements in a series of Stern-Gerlach Apparatus (Questions 3-8 and Exercises 6) * Have a basic understanding of entangled states (Exercises 8 and 9) * Be able to articulate the advantage of quantum algorithms (Question 9 and Summary)
Time to Complete 180 min

These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).

See the MATLAB LiveScript, Jupyter Notebook, or pdf files under "Code Templates" for an integrated document with readings and exercises. *Note:* in the following exercises will use heads as state |0> and tails as state |1>, which is opposite the standard notation (but makes so much more sense!). heads: $|0> = \begin{pmatrix} 1 \\\ 0 \end{pmatrix}$, tails: $|1> = \begin{pmatrix} 0 \\\ 1 \end{pmatrix}$ **Exercise 1** Read Chapter 2 sections 2.1 and 2.2 of [Quantum Computing for the Quantum Curious](https://link.springer.com/book/10.1007/978-3-030-61601-4). * In your chosen computational platform, represent the state of a weighted coin, $|weighted \hspace{2pt}coin> = \sqrt{\frac{2}{3}} |0> + \sqrt{\frac{1}{3}} |1>$, as a vector. * Then calculate the probability of each of the two states. Your result should show that the coin has twice the probability of landing on heads vs. tails. **Exercise 2** Read section 2.3 of [Quantum Computing for the Quantum Curious](https://link.springer.com/book/10.1007/978-3-030-61601-4). * How does the Bloch sphere represent the probabilities of |coin> to be heads or tails? * How does the Bloch sphere represent the probabilities of |weighted_coin> to be 2/3 heads and 1/3 tails? You can rotate the Bloch sphere around if you click on it. **Exercise 3** Assume a flipped coin can be measured as either heads, |0> , or tails, |1>. * If the coin is in a normalized state $\frac{1}{\sqrt{10}}|0>+\frac{3}{\sqrt{10}}|1>$, what is the probability that the coin will be tails? * During a flip, the coin is in state $\frac{1}{3}|0>+\frac{2}{3}|1>$. Is this state normalized? * A machine is built to flip coins and put them in state $\frac{1}{2}|0>+\frac{\sqrt{3}}{2}|1>$ when flipped. If 100 coins are flipped, how many coins should land on tails? * A coin starts in state $\frac{1}{\sqrt{10}}|0>+\frac{3}{\sqrt{10}}|1>$. After a measurement is made on the coin, what could be the state of the coin? * Your friend gives you many qubits which are in the same superposition state. How can you determine what the state is? That is, you know each qubit is in some superposition state $|\Psi>=\alpha|0>+\beta|1>$, how could you determine the values of $\alpha$ and $\beta$? **Exercise 4** Read section 2.4 of [Quantum Computing for the Quantum Curious](https://link.springer.com/book/10.1007/978-3-030-61601-4). * In your chosen computational platform, input the following matrix operator: $X = \begin{pmatrix} 0 \hspace{10pt} 1 \\\ 1 \hspace{10pt}0 \end{pmatrix}$. Show that operator $X$ is unitary. * What is the result of applying the unitary operator $X$ onto a |0> state qubit? You should have found that matrix X changes qubit state |0> to qubit state |1>. * What is the result of applying the unitary operator X onto a |1> state qubit? * What is the matrix product of the X matrix and a qubit in the general state $|\Psi> = \alpha|0> + \beta|1>$? Write your result as a linear combination of |0> and |1>. **Exercise 5** * Find the conjugate transpose of matrix $\gamma = \begin{pmatrix} 0 \hspace{10pt} -i \\\ i \hspace{10pt} 0 \end{pmatrix}$ * Show that matrix $\gamma$ is unitary. * Show that the matrix $U= \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \hspace{10pt} -1 \\\ 1 \hspace{10pt} -1 \end{pmatrix}$ is unitary. **Exercise 6** Read section 4.1 of [Quantum Computing for the Quantum Curious](https://link.springer.com/book/10.1007/978-3-030-61601-4). * Open up the [Stern–Gerlach simulator](https://physics.nfshost.com/demos/Sterngerlach/). Drag down an oven, a Z analyzer, and two detectors. Connect them as shown in the figure: ![](images/IntroQComp/SGAZ.jpg "") Now turn the oven on (click on the "Start All" button on the top left) to send a stream of silver atoms, which are spin 1/2 particles just like electrons, of various initial spins into the Stern–Gerlach apparatus (SGA). Are the results what you would expect? Explain. * If you sent the spin up particles through a horizontal SGA (in the x-direction), as shown below, ![](images/IntroQComp/SGAZX.jpg "") and you put a fluorescent screen at the end of the experiment, where would you expect the particles to land? Select all possibilities from the choices below: ![](images/IntroQComp/Fig4.10.jpg "") Read sections 4.2 and 4.4 of [Quantum Computing for the Quantum Curious](https://link.springer.com/book/10.1007/978-3-030-61601-4). * In the Stern–Gerlach simulator send particles with randomly oriented spins through a vertical SGA (Z). What is the spin of the particles that pass through the top hole? ![](images/IntroQComp/SGAZ.jpg "") * Add a second SGA, oriented horizontally (X).What is the spin of the particles before entering the second SGA? Assume the positive x-axis points out of the page. ![](images/IntroQComp/SGAZX.jpg "") * What is the spin of the particles after passing through the top of the second SGA of the previous question? * What is the z-spin of the electron coming out of the second SGA? Design an experiment to confirm this in the simulation. The Hadamard gate is an important operator in quantum computing. It is a matrix, $H= \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \hspace{12pt} 1 \\\ 1 \hspace{1pt} -1 \end{pmatrix}$. * Input matrix H into your chosen computational platform. What is the result of multiplying operator H by state |0>? That is, what is H|0>? * Can you write the vector you obtained as a linear combination of |0> and |1>? That is if $H|0> = \alpha |0> +\beta |1>$, determine $\alpha$ and $\beta$, and write out the state. * What is the result of multiplying operator H by state |1>? That is, what is H|1>? * Can you write the vector you obtained as a linear combination of |0> and |1>? * What does the Hadamard gate do? The states you found are called the |+> and |-> states, such that |+>=H|0> and |->=H|1>. They represent the spin in the +x and -x axis, as explained in section 4.2. Spin in the +z and -z axis is written as |0> and |1>. So applying the Hadamard gate to either state |0> (spin up) or state |1> (spin down) results in a state that is a linear combination of spin in the +x and -x directions. In the Stern-Gerlach experiment, we started with picking the particles that went through the top hole of the SGA(Z), so we know they are in state |0>. Then we put them through an SGA(X), which measures in the |+> or |-> basis. * Can you write state |0> as a linear combination of |+> and |->? * We then took particles that went through the top of the SGA(X), so that they were in state |+>, and put them through an SGA(Z), which measures in the |0> and |1> basis. What is the probability of measuring and finding the particle in state |0>? Remember you previously wrote state |+> as a linear combination of states |0> and |1>. **Exercise 7** A superposition of states can also be achieved by a beam splitter, a partially reflective mirror that splits a beam of light into two. In a 50/50 beam splitter, 50% of the light intensity is transmitted and 50% is reflected. The beam splitter can be modeled as a matrix, $B= \frac{1}{\sqrt{2}}\begin{pmatrix} -1 \hspace{8pt} 1 \\\ 1 \hspace{12pt} 1 \end{pmatrix}$. * What is B|0>? * What is B|1>? Both of which should be superpositions of |0> and |1>, very similar to what we found with the Hadamard operator, but different locations for the $\pm$ signs on the amplitudes. **Exercise 8** Read sections 7.1 - 7.3 of [Quantum Computing for the Quantum Curious](https://link.springer.com/book/10.1007/978-3-030-61601-4). For each of the questions below, assume that two qubits start in the state $|\psi> = \frac{1}{\sqrt{2}}|00>+\frac{1}{2}|10>-\frac{1}{2}|11>$. * What is the probability of measuring both qubits as 0? * What is the probability of measuring the first qubit as 1? * What is the probability of measuring the second qubit as 0? * What is the new state of the system after measuring the first qubit as 0? * What is the new state of the system after measuring the first qubit as 1? **Exercise 9** For each of the questions below, assume that two qubits start in the state $|\psi> = \frac{1}{\sqrt{3}}|00>+\frac{1}{2}|01>-\frac{1}{\sqrt{6}}|10>-\frac{1}{2}|11>$. * What is the probability of measuring both qubits as 0? * What is the probability of measuring the first qubit as 1? * What is the probability of measuring the second qubit as 0? * What is the new state of the system after measuring the first qubit as 0? * What is the new state of the system after measuring the first qubit as 1? **Exercise 10** Read sections 9.1 and 9.2 of [Quantum Computing for the Quantum Curious](https://link.springer.com/book/10.1007/978-3-030-61601-4). * How many different classical pieces of information can be represented by eight classical bits (1 byte)? * What about a quantum computer with eight qubits? * What advantage does the quantum computer have over the classical computer? **Summary** In quantum mechanics, * what is meant by superposition? * what is meant by measurement? how does measuring change a state? * what is meant by entanglement? * What did you find most interesting about this lab? * What did you find confusing?

Download Options

Share a Variation

Did you have to edit this material to fit your needs? Share your changes by Creating a Variation

Credits and Licensing

Marie Lopez del Puerto, "Introduction to Quantum Computing," Published in the PICUP Collection, March 2025, https://doi.org/10.1119/PICUP.Exercise.IntroQComp.

DOI: 10.1119/PICUP.Exercise.IntroQComp

The instructor materials are ©2025 Marie Lopez del Puerto.

The exercises are released under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license