Hello! Welcome to your first lesson in our course on the principles of quantum computing.
Our goal in this lesson is to establish the fundamental language of quantum mechanics: how to describe a quantum state mathematically. By the end of our session, you'll be able to represent quantum states as column vectors with complex numbers. This is the first and most crucial step on our journey to building and understanding quantum circuits.
Since you're studying Electronics and Electrical Engineering, you're likely familiar with using vectors to represent physical quantities and complex numbers to handle phase and amplitude in AC circuits (using phasors). We'll build directly on that intuition. Here, instead of representing voltages or currents, our vectors will represent the state of a quantum bit, or qubit.
1. Why Complex Numbers?
In classical computing, a bit is simple: it's either 0 or 1. A qubit is more nuanced. To describe its state fully, we need more than just real numbers; we need complex numbers. They allow us to capture not just the probability of a qubit being 0 or 1, but also its phase, a uniquely quantum property we'll explore throughout this course.
Let's start with a quick, targeted refresher on the properties of complex numbers that are essential for quantum computing.
Quantum Computing Course – Math and Theory for Beginners
This video from the freeCodeCamp.org 'Quantum Computing Course' provides an excellent and concise review of complex numbers. It covers exactly what we need for now, without getting bogged down in unnecessary detail.
Please watch the segment from 01:52 to 07:06. Focus on understanding the a + ib format, how to find the complex conjugate, and how to calculate the magnitude of a complex number.
To summarize the key points from the video:
- A complex number has the form , where is the real part, is the imaginary part, and .
- The complex conjugate of , denoted , is found by flipping the sign of the imaginary part: .
- The magnitude squared of a complex number, denoted , is found by multiplying it by its conjugate:
This last property is incredibly important, as we'll see that these "magnitudes squared" are directly related to probabilities.
2. The Statevector: A Qubit's Mathematical Identity
Now that we have complex numbers, how do we use them to describe a qubit? We use a statevector.
The IBM Quantum Learning platform provides a very clear definition of a quantum state vector. This short reading will formalize the concept.
Please read the first section, titled 'Quantum state vectors'. Pay close attention to the two properties that characterize a quantum state vector.
As the text explains, a quantum state vector for a single qubit is a 2-element column vector whose entries are complex numbers. The two key rules are:
- The entries can be complex numbers.
- The sum of the absolute values squared of the entries must be 1. This is called the normalization condition.
Let's make this concrete. A qubit has two fundamental states, analogous to the classical bit's 0 and 1. We call these basis states |0⟩ and |1⟩. (This |...⟩ notation is called ket notation, a handy shorthand we'll use from now on).
Their vector representations are:
- The state
|0⟩is represented by the vector:
- The state
|1⟩is represented by the vector:
You can think of the top entry as the complex amplitude for the |0⟩ state and the bottom entry as the amplitude for the |1⟩ state. For the |0⟩ state vector, it is "100% in the 0 state" and "0% in the 1 state", and vice-versa for the |1⟩ vector.
3. Superposition: Being in Both States at Once
What makes qubits powerful is that they are not limited to being just |0⟩ or |1⟩. They can be in a superposition of both. This is represented by a linear combination of the basis vectors.
Any generic single-qubit state |ψ⟩ can be written as:
Where and are complex numbers representing the amplitudes. The normalization condition we learned earlier means that:
Let's see some examples.
This next section from the same IBM article provides concrete examples of valid qubit states, including ones with complex numbers.
Read the section 'Examples of qubit states'. Focus on how the examples are constructed and how they satisfy the normalization rule.
Let's check the normalization for one of the examples from the reading, the |+⟩ state:
The normalization check is:
It works!
Now let's consider a state with a complex amplitude. For instance:
Is this a valid quantum state? Let's check the normalization.
- The magnitude squared of the first amplitude is .
- The magnitude squared of the second amplitude is . Using , this is .
So, the sum is . Yes, it's a valid state.
4. A Glimpse into Qiskit
This might all seem a bit abstract, but it has a direct practical application in quantum programming frameworks like Qiskit. You don't have to run this code now (we'll set up your environment in a later module), but it's useful to see how the theory maps to code.
The following resource shows how to initialize a qubit state in Qiskit. Notice how it uses a simple list or array to represent the column vector we've been discussing.
Learn Quantum Computing with Qiskit: Representing Qubit ...
This article by Monit Sharma demonstrates how to represent qubit states in Qiskit. We will just look at the code examples to connect our vector theory to practice.
Scroll down to the 'Exploring with Qiskit' section. Look at the code block where initial_state = [1/sqrt(2), 1j/sqrt(2)] is defined. This is the code representation of the vector we just analyzed. Notice that Python uses j for the imaginary unit i. Also, look at the output below it, Statevector([0.70710678+0.j, 0.+0.70710678j]), which shows the complex amplitudes explicitly.
As you can see, the vector [α, β] is exactly what you pass to the software to define a qubit's starting state. The article also mentions that Qiskit will raise an error if you provide a vector that isn't normalized. This shows how the mathematical rules we're learning are the very foundation of how these systems operate.
Conclusion
In this lesson, we've established the first and most important concept in quantum computation.
Key Takeaways:
- A qubit's state is described by a statevector, which is a 2-element column vector.
- The entries in the vector are complex numbers called amplitudes, written as .
- is the amplitude for the
|0⟩state, and is the amplitude for the|1⟩state. - Statevectors must be normalized, meaning the sum of the squared magnitudes of their amplitudes must equal 1: .
- A state like (where both and are non-zero) is called a superposition.
Preview of the Next Lesson:
Now that we can describe a qubit's state, the next logical question is: how do we change it? In the next lesson, we will explore how quantum operations, or "gates," are represented by matrices. We will start by refreshing our understanding of matrix-vector multiplication, which is the mechanism for applying a gate to a qubit state.