unit vectors

Using Unit Vectors to Describe Quantum States

Now that we’ve covered some of the basics of superposition, we can start introducing a little bit of linear algebra into how we talk about qubits.

If you’re coming at quantum computing from a different field, you may or may not have taken a linear algebra course in school, but it’s definitely something you’ll want to pause and catch up on before trying to move too far ahead in your studying. In my case, I plan on taking Brilliant’s Linear Algebra course later this quarter as part of building up my math competency (for context, I took up through Calculus II in college). I’ll also be using Part III of Quantum Computing: An Applied Approach, recommended by Anastasia Marchenkova in this really helpful video on quantum computing books for software engineers, alongside the online course to supplement my learning.

The first interesting thing we’ll do with linear algebra involves unit vectors…so let’s review what those are!

Vectors & Unit Vectors

Vectors represent two things: direction and magnitude. Velocity, which accounts for both the speed and direction of a moving object, is an example of a quantity that gets represented by a vector.

Mathematically, a line segment that has a direction and magnitude can be used to represent a vector. Working within a Cartesian plane, we can think of a vector as the line between two points, each of which can be represented by a pair of x, y coordinates.

You can find the length between the two points, and thereby the magnitude, by using the Pythagorean Theorem where the vector is the hypotenuse.

To find the direction, it’s slightly trickier because you’ll need to rely on some trigonometry. If the angle between the vector and the x-axis is called θ, you can use the following equation:

$$\tan\theta = \frac{opposite}{adjacent} $$

where it is understood that opposite is the size of the line segment opposite θ and adjacent is the size of the line segment adjacent to θ.

Building on this knowledge of vectors, we can now talk about unit vectors, which are vectors whose magnitude is always equal to 1. These are most often used when you’re not really interested in the size of something, and you just want to talk about the direction.

A regular vector can be deconstructed into a unit vector multiplied by some scalar coefficient that represents the magnitude.

A new way to talk about qubits

We can now use unit vectors to talk about the states of qubits in the following way:

$$ \ket{0} = \langle 1, 0\rangle $$ $$ \ket{1} = \langle 0, 1\rangle $$

Each of the above is a computational state, where the qubit is either entirely in the 0 state or the 1 state. Turning these into vectors, the top vector represents a line segment entirely in the direction of x whereas the bottom vector represents a line segment entirely in the direction of y. Both vectors have magnitude 1. You can think of the value of 1 here as representing 100% probability of the qubit being in that state.

However, what if we want to represent superposition states, not just computational states, using unit vectors?

In that case, we can use the following formula:

$$ a_1\ket{0}+a_2\ket{1} = \langle a_1, a_2\rangle $$

Where the coefficients represent the relative magnitudes of how likely a qubit is to be measured in each state.

This can also be written using column vector notation:

$$ a_1\ket{0} + a_2\ket{1} = \begin{bmatrix} a_1 \\ a_2 \end{bmatrix} $$

UNIFORM STATES AS VECTORS

The previous blog post introduced the idea of uniform states, and now we can describe them using vectors:

$$ \ket{+} = \frac{1}{\sqrt{2}}\ket{0} + \frac{1}{\sqrt{2}}\ket{1} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ 1 \end{bmatrix}$$ $$ \ket{-} = \frac{1}{\sqrt{2}}\ket{0} - \frac{1}{\sqrt{2}}\ket{1} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{-1}{\sqrt{2}} \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ -1 \end{bmatrix}$$

These two states of superposition are considered uniform, because the probability that the qubit will be measured in either the 0 state or the 1 state is even, and that makes the states useful for calculations. In fact, they’re used so frequently that they’re given special notation (seen at the beginning of each line in the two equations above).

In the next post, we’ll start to learn more about these uniform states in the context of quantum gates, and we’ll continue to rely on vectors and matrices to help us.


A huge thank you to Andrea Sharpless (LinkedIn) for the help with this post and our general discussions on linear algebra.