Quantum Algorithms and Software Engineering: Term Portfolio Project
By Zak Toews
4th Year Software Engineering Student
Part 1: Documenting my Quantum Journey
1. How did you get up to speed in basic linear algebra (e.g., Euler formula, complex plane, linear transformations or operators, eigenvectors and eigenvalues), including which resources you consulted in this process?
In this course, it was brought to our attention that the foundations of Quantum Computing relies on a understanding of linear algerbra, trigonometry, complex numbers, and matrix operations. We have yet to work with eigenvalues and eigenvectors.
For the matrix algebra, I had recalled some of my knowledge from my first year course which is almost 5 years ago now. But, I was not too concerned as if I had learned it fine the first time, I could learn it again without much of a hitch. I looked up the basic Matrix Operations 1, practice was real time during Quizzes and Assignments, and I would verify my answers with some tools [2][3]. Although, I am still pretty weary about trusting the math that AI pumps out, but Gemini is pretty good at it now.
For trigonometry and Euler’s formula, I understand the basics, but I have been consistently going back to the slides that contain Euler’s identity then trying to imagine what how the phase change affects the qubit on the Bloch sphere. The complex plane as it is has been drilled home for me from classes such as ECE 360 Control Systems (T_T).
I included some code to show the different basis states below.
Show code
import matplotlib.pyplot as pltfrom qiskit.visualization import plot_bloch_vector# Coordinates for the 6 basis states [x, y, z]states = {"|0>": [0, 0, 1],"|1>": [0, 0, -1],"|+>": [1, 0, 0],"|->": [-1, 0, 0],"|i>": [0, 1, 0],"|-i>": [0, -1, 0]}# Create subplots with 3D projectionfig = plt.figure(figsize=(20, 5))for i, (label, coord) inenumerate(states.items()):# Add a 3D subplot for each basis vector ax = fig.add_subplot(1, 6, i +1, projection='3d') plot_bloch_vector(coord, title=label, ax=ax)plt.show()
2. How did you get started in documenting linear algebra formulas (e.g., Euler formula or matrices) using LaTeX Markdown in Jupyter Notebooks? Develop your own cheat sheet of the quantum computing formulas and Dirac notation to ease assignment typesetting.
To get started with the formulas and matrices that I would need, I would pull the relevant information from the slides. I had actually done my assignment by hand to avoid the typesetting, but for the next assignment I will be able to copy and paste from the following cheat sheet:
Linear Combination of Unit Kets: A general quantum state |\psi\rangle is a superposition: |\psi\rangle = \alpha|0\rangle + \beta|1\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix} where \alpha, \beta \in \mathbb{C} and |\alpha|^2 + |\beta|^2 = 1.
Inner Product and Orthnormality The inner product of two vectors |\phi\rangle and |\psi\rangle is written as \langle \phi | \psi \rangle. For the computational basis: \langle i | j \rangle = \delta_{ij} \implies \langle 0|0\rangle = 1, \quad \langle 0|1\rangle = 0
Measurement and the Born Rule When measuring a state |\psi\rangle = \alpha|0\rangle + \beta|1\rangle in the computational basis:
Probability of outcome |0\rangle:P(0) = |\langle 0|\psi\rangle|^2 = |\alpha|^2
Probability of outcome |1\rangle:P(1) = |\langle 1|\psi\rangle|^2 = |\beta|^2
General Born Rule: For a state |\psi\rangle, the probability of measuring an eigenvalue associated with eigenvector |x\rangle is: P(x) = |\langle x|\psi\rangle|^2
7. Common Gate Identities Note: Identities are often given “up to a global phase” (e^{i\theta}).
\begin{aligned}
&\text{Phase/Rotation Relations:} & S &= P(\pi/2) \equiv R_z(\pi/2) \\
& & T &= P(\pi/4) \equiv R_z(\pi/4) \\
&\text{Hadamard Basis Change:} & H X H &= Z \\
& & H Z H &= X \\
&\text{Square Root Relations:} & (\sqrt{X})^2 &= X \\
& & S^2 &= Z \\
&\text{Self-Inverse Gates (Hermitian):} & H^2 = X^2 &= Y^2 = Z^2 = I \\
&\text{Pauli Multiplication:} & XY &= iZ, \quad YZ = iX, \quad ZX = iY
\end{aligned}
8. Tensor Product of Vectors (n-qubits) If we have n individual qubits in states |\psi_1\rangle, |\psi_2\rangle, \dots, |\psi_n\rangle, the combined state |\Psi\rangle is the tensor product: |\Psi\rangle = |\psi_1\rangle \otimes |\psi_2\rangle \otimes \dots \otimes |\psi_n\rangle
For the computational basis, the state |x\rangle where x is a binary string x_1x_2\dots x_n: |x_1 x_2 \dots x_n\rangle = |x_1\rangle \otimes |x_2\rangle \otimes \dots \otimes |x_n\rangle This results in a column vector of size 2^n.
9. Tensor Product of Matrices (Kronecker Product) For two matrices A (size m \times n) and B (size p \times q), the tensor product A \otimes B is a matrix of size mp \times nq:
A \otimes B = \begin{pmatrix}
a_{11}B & a_{12}B & \dots \\
a_{21}B & a_{22}B & \dots \\
\vdots & \vdots & \ddots
\end{pmatrix}
10. 2-Qubit Computational Basis The basis for a 2-qubit system is formed by the tensor product of two 1-qubit basis vectors. There are 2^2 = 4 possible states:
General Rule for n-qubits For an n-qubit state |x\rangle where x is the decimal representation of the binary string: * The vector has a length of 2^n. * The vector has a 1 at the x-th index (starting from 0) and 0 elsewhere.
Measurement in the Hadamard Basis To measure a state |\psi\rangle in the Hadamard basis using the Born Rule, you project onto the |+\rangle or |-\rangle states: P(+) = |\langle +|\psi\rangle|^2, \quad P(-) = |\langle -|\psi\rangle|^2
11. 2-Qubit Gate Tensor Products The following matrices represent the operations when gates are applied in parallel to two separate qubits.
12. 3-Qubit Hadamard Tensor Product (H^{\otimes 3}) Applying a Hadamard gate to three qubits simultaneously creates a uniform superposition of all 8 possible basis states.
13. General n-qubit Identity and Parity * I^{\otimes n}: An identity matrix of size 2^n \times 2^n. * Z^{\otimes n}: A diagonal matrix where the entry is +1 if the basis state has an even number of 1s and -1 if it has an odd number of 1s.
14. Entanglement: The 4 Bell States
The Bell states (or EPR pairs) are the four maximally entangled two-qubit states. They form an orthonormal basis for the 4-dimensional Hilbert space of two qubits.
Generating Bell States via Circuit The general recipe to create a Bell state from a basis state |xy\rangle is: \text{Bell}(x,y) = \text{CNOT}_{0 \to 1} (H \otimes I) |xy\rangle
Matrix of the CNOT Gate The CNOT gate flips the target (second) qubit if the control (first) qubit is |1\rangle: \text{CNOT} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}
3. How did you get started running your first quantum circuits using IBM Qiskit and Xanadu Pennylane Jupyter Notebook platforms?
I first started checking out Qiskit in the labs and seeing how it generates the circuits in the IBM Quantum Composer. As for PennyLane, one of the other students said that the PennyLane Codebook was helpful in learning PennyLane and comprehension off the material. So, I have since completed the Introduction segment, but I plan to continue to follow along [4].
4. How would you motivate other students to join the journey into quantum computing given the motivational materials presented in class and found in the references? Your answers to this question will likely evolve during this course. Revisit regularly this quesion.
Well, I have already suggested to my friend, who is interested in the material but couldn’t join the course, that he should check out the content on PennyLane and go through the CodeBook. There are also the tutorials available on the IBM Qiskit website [5].
Also, suggesting the Bloch Sphere is sometimes a good tool for visualizing phase changes and the relative locations of the basis states; however, it is not an accurate tool, as the basis kets are intended to orthogonal, but instead are viewed as opposing in the Bloch Sphere.
The short article about Quantum and Computational Chemistry was insightful and approachable [6]. I would recommend that.
From my understanding, Quantum Computing is inevitable and will become a common way for sophisticated problem in the not-too-distant future. Therefore it would be advised that everyone in Software Engineering and Computer Science start to understand at least the basics of Quantum Computing. Take this article “Quantum Computing Moves from Theoretical to Inevitable” that explains the upcoming markets that will benefit the most from Quantum Computing [7].
5. Which algorithm is your favourite quantum algorithm so far?
I think that all the algorithms, so far, are interesting. The most difficult, yet intriguing, part is trying to grasp the significance of how gates modify the quantum state and how the math verifies the expected results in the end.
From a curiosity perspective, I would say that the Teleportation algorithm is the most important because it proves the ability to move quatum states around, and it also kills the misconception that many people have, that Quantum states can somehow transfer information faster than the speed of light.
I have included a snippiet of code that simulates transportation. It was completed with the aid of Gemini [3].
Show code
import pennylane as qml# We need 3 wires for teleportationdev = qml.device("default.qubit", wires=3)@qml.qnode(dev)def teleportation_circuit():# 1. PREPARE THE STATE TO TELEPORT (on wire 0)# Let's just create a random state using a rotation qml.RX(1.23, wires=0) qml.RY(0.45, wires=0)# 2. CREATE ENTANGLEMENT (between Alice/wire 1 and Bob/wire 2) qml.Hadamard(wires=1) qml.CNOT(wires=[1, 2])# 3. ALICE'S OPERATIONS (Bell State Measurement) qml.CNOT(wires=[0, 1]) qml.Hadamard(wires=0)# 4. MEASURE AND CONDITIONALLY APPLY CORRECTIONS# In PennyLane, we use m_0 and m_1 to represent Alice's measurement results m_0 = qml.measure(0) m_1 = qml.measure(1)# Bob applies corrections based on Alice's classical bits# If m_1 is 1, apply PauliX; if m_0 is 1, apply PauliZ qml.cond(m_1, qml.PauliX)(wires=2) qml.cond(m_0, qml.PauliZ)(wires=2)# Return the probabilites in the statereturn qml.probs(wires=2)# Executeresult = teleportation_circuit()print(result)
[0.6504817 0.3495183]
6. What was the most challenging part in understanding Grover’s algorithm?
I don’t think we have covered Grover’s algorithm yet in class, but I looked it up and this PennyLane article covers it pretty well [8].
I suppose one of the most challenging parts of using Grover’s algorithm or any other Oracle based algorithm is being able to imagine and then describe how the oracle needed for the specific problem.
7. Required: What are your personal insights, aha moments, and epiphanies you experienced in the first part of this course?
Some things that ocurred to me were:
The matrix math becomes unwieldy very quickly, and that Dirac notation is much preferred.
Quantum computing in inevitable
The algorithms needed for solving a modern problem must be huge (many quibits, many gates) with large portions being progromatically generated or transpiled.
Modern Quantum Computing is the culmination of many very clever people.
Quantum computing will not likely be of much use alone but will be integrated wtih standard computing; something that can be called upon when the certain cases arise (such as with simulation or searching).
8. Required: How did you experience Generative AI as a learning tool for this course?
Gen AI, especially Google Gemini, has been extremely helpful in this course. I would say that Gen AI is helpful in a many scenarios, but academically, it has been essential for easing the initial learning curve involved with such things as Dirac notation and explaining phase rotation. The optimist in me says that AI is a super useful tool that has come along at a time when it is most in need where we can all benefit from the culmination of our efforts. The pessimist in me says that all the most useful AI models will be behind paywalls soon enough and we may find ourselves reliant on them, especially if we don’t actually understand the information that it gives back to us. So, ultimately, GenAI is amazing for boiler-plate work, but for knowledge work (exploratory solutions and the like), the results should still be critisized and the technicalites understood.
9. Record your Generative AI prompts and contexts for Basic Quantum Terms, Complex Linear Algebra, Quantum Algorithms, Python, Qiskit, and PennyLane inquiries for easy recall. Use the same line item or project in your genAI engine (e.g., ChatGPT, Google Gemini, Perplexity, or others) to build up the “quantum context”.
“Hey can you explain superposition, entanglement, and the no cloning theorem? keep it simple and just tell me why each one actually matters for making a quantum computer faster than a regular one.”
“Quantum states use a lot of linear algebra. Can you explain how bra ket notation works with unitary matrices and hermitian operators. Also, why does a unitary matrix have to keep the total probability at 1 when it acts on a qubit state?”
“Can you explain to me how Grover’s algorithm works? I would like the Dirac and Matrix representation.”
“I need to make a bell state in qiskit. Can you give me the python code to set up 2 qubits, apply them with a hadamard and a cnot, and then run it to see the results. keep the code simple and just use comments to say which qubit is which.”
“I want to try a teleportation circuit in pennylane. Can you show me a template for that? Please explain the different steps.”
Bibliography
[1] GeeksforGeeks, “Matrix Operations,” GeeksforGeeks, Nov. 23, 2020. https://www.geeksforgeeks.org/maths/matrix-operations/
[2] “Matrix Calculator - Reshish,” matrix.reshish.com. https://matrix.reshish.com/
[3] Google, “Gemini,” gemini.google.com, 2025. https://gemini.google.com/app
[4] “Map | PennyLane Codebook,” Pennylane.ai, 2025. https://pennylane.ai/codebook/learning-paths
[5] “IBM Quantum Computing | Qiskit,” Ibm.com, 2026. https://www.ibm.com/quantum/qiskit#tutorials (accessed Feb. 12, 2026).
[6] “Fertilizer and other quantum computer chemistry,” Quantum Flagship. https://qt.eu/applications/fertilizer-and-other-quantum-computer-chemistry
[7] G. Dunn, V. Sinha, Laurent-Pierre Baculard, S. Ali, and W. Chang, “Quantum Computing Moves from Theoretical to Inevitable,” Bain, Sep. 23, 2025. https://www.bain.com/insights/quantum-computing-moves-from-theoretical-to-inevitable-technology-report-2025/
[8] L. Botelho, “Grover’s Algorithm,” PennyLane Demos, Jul. 03, 2023. https://pennylane.ai/qml/demos/tutorial_grovers_algorithm