0% found this document useful (0 votes)
18 views3 pages

Density Matrices IBM Quantum Learning 2

The document introduces density matrices as a representation of quantum states in quantum information theory, highlighting their importance in describing a broader class of states, including those affected by noise and entanglement. It defines density matrices mathematically, emphasizing conditions such as unit trace and positive semidefiniteness, and explains how their entries relate to probabilities and quantum superposition. The document also discusses examples of density matrices and their connection to quantum state vectors.

Uploaded by

siwachdu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views3 pages

Density Matrices IBM Quantum Learning 2

The document introduces density matrices as a representation of quantum states in quantum information theory, highlighting their importance in describing a broader class of states, including those affected by noise and entanglement. It defines density matrices mathematically, emphasizing conditions such as unit trace and positive semidefiniteness, and explains how their entries relate to probabilities and quantum superposition. The document also discusses examples of density matrices and their connection to quantum state vectors.

Uploaded by

siwachdu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

IBM Quantum Learning Sign in

Density matrices

Introduction

In the general formulation of quantum information, quantum states are not


represented by vectors like we have in the simplified formulation, but instead are
represented by a special class of matrices called density matrices.

At first glance it may seem peculiar that quantum states are represented by matrices,
which more typically represent actions or operations as opposed to states. For
example, unitary matrices describe quantum operations in the simplified formulation
of quantum information and stochastic matrices describe probabilistic operations in
the context of classical information. In contrast, although density matrices are indeed
matrices, they represent states — not actions or operations to which we typically
associate an intuitive meaning.

Nevertheless, the fact that density matrices can (like all matrices) be associated with
linear mappings is a critically important aspect of them. For example, the eigenvalues
of density matrices describe the randomness or uncertainty inherent to the states
they represent.

Before we proceed to the definition of density matrices, here are a few key points that
motivate their use.

– Density matrices can represent a broader class of quantum states than quantum
state vectors. This includes states that arise in practical settings, such as states of
quantum systems that have been subjected to noise, as well as random choices of
quantum states.

– Density matrices allow us to describe states of isolated parts of systems, such as


the state of one system that happens to be entangled with another system that we
wish to ignore. This isn't easily done in the simplified formulation of quantum
information.

– Classical (probabilistic) states can also be represented by density matrices,


specifically ones that are diagonal. This is important because it allows quantum and
classical information to be described together within a single mathematical
framework, with classical information essentially being a special case of quantum
information.

Basics

We'll begin by describing what density matrices are in mathematical terms, and then
we'll take a look at some examples. After that, we'll discuss a few basic aspects of
how density matrices work and how they relate to quantum state vectors in the
simplified formulation of quantum information.

Definition

Suppose that we have a quantum system named X, and let Σ be the (finite and
nonempty) classical state set of this system. Here we're mirroring the naming
conventions used in the Basics of quantum information course, which we'll continue to
do when the opportunity arises.

In the general formulation of quantum information, a quantum state of the system X


is described by a density matrix ρ whose entries are complex numbers and whose
indices (for both its rows and columns) have been placed in correspondence with the
classical state set Σ. The lowercase Greek letter ρ is a conventional first choice for
the name of a density matrix and σ and ξ are also common choices.

Here are a few examples of density matrices that describe states of qubits:
1 1 3 i 1
0
(1 ), ( i ), ( ).
1 0
( ),
2 2 4 8 2
and
0 0 1
−8 1
0 1
2 2 4 2

To say that ρ is a density matrix means that these two conditions, which will be
explained momentarily, are both satisfied:

1. Unit trace: Tr(ρ) = 1.


2. Positive semidefiniteness: ρ ≥ 0.
The first condition refers to the trace of a matrix. This is a function that is defined for
all square matrices as the sum of the diagonal entries:

α0,0 α0,1 ⋯ α0,n−1


α1,0 α1,1 ⋯ α1,n−1
Tr = α0,0 + α1,1 + ⋯ + αn−1,n−1 .
⋮ ⋮ ⋱ ⋮
αn−1,0 αn−1,1 ⋯ αn−1,n−1

The trace is a linear function: for any two square matrices A and B of the same size
and any two complex numbers α and β, the following equation is always true.

Tr(αA + βB) = α Tr(A) + β Tr(B)

The trace is an extremely important function and there's a lot more that can be said
about it, but we'll wait until the need arises to say more.

The second condition refers to the property of a matrix being positive semidefinite,
which is a truly fundamental concept in quantum information theory (and in many
other subjects). A matrix P is positive semidefinite if there exists a matrix M such that

P = M †M .

Here we can either demand that M is a square matrix of the same size as P or allow
it to be non-square — we obtain the same class of matrices either way.

There are several alternative (but equivalent) ways to define this condition, including
these:

– A matrix P is positive semidefinite if and only if P is Hermitian (i.e., equal to its own
conjugate transpose) and all of its eigenvalues are nonnegative real numbers.
Checking that a matrix is Hermitian and all of its eigenvalues are nonnegative is a
simple computational way to verify that it's positive semidefinite.

– A matrix P is positive semidefinite if and only if ⟨ψ∣P ∣ψ⟩ ≥ 0 for every complex
vector ∣ψ⟩ having the same indices as P .

An intuitive way to think about positive semidefinite matrices is that they're like matrix
analogues of nonnegative real numbers. That is, positive semidefinite matrices are to
complex square matrices as nonnegative real numbers are to complex numbers. For
example, a complex number α is a nonnegative real number if and only if

α = ββ

for some complex number β, which matches the definition of positive


semidefiniteness when we replace matrices with scalars. While matrices are more
complicated objects than scalars in general, this is nevertheless a helpful way to think
about positive semidefinite matrices. This also explains why the notation P ≥ 0 is
used to mean that P is positive semidefinite. (Notice in particular that the notation
P ≥ 0 does not mean that each entry of P is nonnegative in this context. There are
positive semidefinite matrices having negative entries as well as matrices whose
entries are all positive that are not positive semidefinite.)

At this point the definition of density matrices may seem rather arbitrary and abstract,
as we have not yet associated any meaning with these matrices or their entries. The
way density matrices work and can be interpreted will be clarified as the lesson
continues, but for now it may be helpful to think about the entries of density matrices
in the following (rather informal) way.

– The diagonal entries of a density matrix give us the probabilities for each classical
state to appear if we perform a standard basis measurement — so we can think
about these entries as describing the "weight" associated with each classical state.

– The off-diagonal entries of a density matrix describe the degree to which the two
classical states corresponding to that entry (meaning the one corresponding to the
row and the one corresponding to the column) are in quantum superposition, as well
as the relative phase between them.

It is certainly not obvious a priori that quantum states should be represented by


density matrices. Indeed, there is a sense in which the choice to represent quantum
states by density matrices leads naturally to the entire mathematical description of
quantum information. Everything else about quantum information actually follows
pretty logically from this one choice!

Random examples

We'll see several examples of density matrices throughout the lesson, including ones
that represent states encountered earlier in the series. To begin, let's take a look as
some randomly generated examples. We'll begin with some random examples of
positive semidefinite matrices, and from these examples we can obtain examples of
density matrices by simply normalizing — which in this context means dividing by the
trace.

1 # Required imports for code cells


2
3 from qiskit.quantum_info import Statevector, Operator, DensityMatrix
4 from qiskit.visualization import array_to_latex
5 import numpy as np
6 from numpy import linalg
7
8
print('Imports loaded.')

Authenticate to run code cells Sign in

Output:

Imports loaded.

The code cell that follows randomly generates a positive semidefinite matrix by first
generating an n × n matrix M whose entries have real and imaginary parts chosen
independently and uniformly from the set {−9, … , 9} and then outputting the
positive semidefinite matrix P = M † M . Through this method we'll only obtain
matrices whose entries have integer real and imaginary parts that aren't too large,
which will make the examples more readable — but be aware that not every positive
semidefinite matrix has this property. Changing the dimension n and running the cells
multiple times may help to develop a sense for what positive semidefinite matrices
look like.

1 # Randomly generate a positive semidefinite matrix


2
3 n = 3
4 M = np.random.randint(-9, 10, size=(n, n)) + 1j * np.random.randint(-9, 10, size=(n, n))
5 P = M.conj().T @ M
6
7 display(array_to_latex(P))

Authenticate to run code cells Sign in

Output:

201 −76 + 31i 54 + 36i


−76 − 31i 55 −6 − 17i
54 − 36i −6 + 17i 43

(Here we're using Qiskit's array_to_latex function to obtain a more human-readable


output format for the matrix. Substituting display(P) for
display(array_to_latex(P)) shows the result using the standard matrix

representation in Python.)

The fact that each randomly generated positive semidefinite matrix is Hermitian can
be checked by inspection. We can also compute the eigenvalues to see that they're
always nonnegative real numbers.

1 # Compute the eigenvalues (in decreasing order)


2
3 display(array_to_latex(np.sort(linalg.eigvals(P))[::-1]))

Authenticate to run code cells Sign in

Output:

[258.3556572641 31.4884836828 9.1558590531]

Random examples generated in this way are naturally limited in what they can tell us,
but we can observe some features that are true in general for positive semidefinite
matrices. In particular, the diagonal entries are always nonnegative real numbers, and
the off-diagonal entries are never "too large" in comparison to the two corresponding
diagonal entries (meaning the diagonal entries in the same row and the same column
as the chosen off-diagonal entry).

As was already suggested, to generate a random density matrix we can use the same
procedure to generate a random positive semidefinite matrix and then divide this
matrix by its trace. The following code cell does this. (Note that the cell will throw a
warning if by chance P is the all-zero matrix, which is possible but unlikely — this can
only happen when M is the all-zero matrix.)

1 # Randomly generate a density matrix


2
3 n = 3
4 M = np.random.randint(-9, 10, size=(n, n)) + 1j * np.random.randint(-9, 10, size=(n, n))
5 P = M.conj().T @ M
6 rho = P/np.trace(P)
7
8
display(array_to_latex(rho))

Authenticate to run code cells Sign in

Output:

0.4947735192 0.012195122 − 0.0139372822i −0.0034843206


0.012195122 + 0.0139372822i 0.2090592334 −0.0609756098
−0.0034843206 + 0.0087108014i −0.0609756098 − 0.2212543554i

(The array_to_latex function does its best to provide a symbolic representation of


the matrix, but it's not exact and will occasionally produce unusual expressions that
happen to closely approximate the actual results.)

Notice that the diagonal entries are always nonnegative and sum to 1, so they form a
probability vector. This probability vector specifies the probabilities for obtaining each
possible classical state from a standard basis measurement, as was already
suggested.

We can also compute the eigenvalues of these randomly generated density matrices.
Although the eigenvalues are usually different from the diagonal entries, they also
form a probability vector. This is a consequence of the following basic fact from matrix
theory.

Theorem. The trace of a square matrix is equal to the sum of its eigenvalues, with
each eigenvalue being included in the sum a number of times equal to its
multiplicity.

1 # Compute the eigenvalues (in decreasing order)


2
3 display(array_to_latex(np.sort(linalg.eigvals(rho))[::-1]))

Authenticate to run code cells Sign in

Output:

[0.4977478518 0.4840907784 0.0181613698]

Qiskit also includes a DensityMatrix class that includes some useful methods for
working with density matrices.

1 # Initialize and display a density matrix


2 # using the DensityMatrix package
3
4 rho = DensityMatrix([[3/4, 1j/8],[-1j/8,1/4]])
5 display(rho.draw('latex'))

Authenticate to run code cells Sign in

Output:

3 i
[ i 4 8]
1
−8 4

Connection to quantum state vectors

Recall that a quantum state vector ∣ψ⟩ describing a quantum state of X is a column
vector having Euclidean norm equal to 1 whose entries have been placed in
correspondence with the classical state set Σ. The density matrix representation ρ of
the same state is defined as follows.

ρ = ∣ψ⟩⟨ψ∣

To be clear, we're multiplying a column vector to a row vector, so the result is a square
matrix whose rows and columns correspond to Σ. Matrices of this form, in addition to
being density matrices, are always projections and have rank equal to 1.

For example, let us define two qubit state vectors as follows.


1

∣1⟩ = ( i )
1 i 2
∣+i⟩ = ∣0⟩ +
2 2 2
1
∣1⟩ = ( )
1 i 2
∣−i⟩ = ∣0⟩ −
2 2 − i
2

The density matrices corresponding to these two vectors are as follows.


1 1
− 2i
∣+i⟩⟨+i∣ = ( ) ( ) (i )
2 1 i 2
i 2
− 2
= 1
2 2 2
1 1 i
( i ) ( 12 ) =( i )
2 i 2 2
∣−i⟩⟨−i∣ = 2
− 2 −2 1
2

Here these examples are included with a few other basic examples: ∣0⟩, ∣1⟩, ∣+⟩, and
∣−⟩. We'll see these six states again later in the lesson.

State vector Density matrix

∣0⟩ = ( ) ∣0⟩⟨0∣ = ( )
1 1 0
0 0 0

∣1⟩ = ( ) ∣1⟩⟨1∣ = ( )
0 0 0
1 0 1
1 1 1
∣+⟩ = ( 1
2
) ∣+⟩⟨+∣ = (2 2
)
1 1
2 2 2
1 1
− 12
∣−⟩ = ( 21 ) ∣−⟩⟨−∣ = ( 2
)
− − 12 1
2 2
1 1
− 2i
∣+i⟩ = ( ) ( )
2 2
∣+i⟩⟨+i∣ =
i 1 1
2 2 2

1 1
( 2i )
i
∣−i⟩⟨−i∣ = ( )
2 2
∣−i⟩ =
− − 2i 1
2 2

For one more example, here's a state from the Single systems lesson, including both
its state vector and density matrix representations.
5 −2−4i
( −2+4i )
1 + 2i 2 9 9
∣v⟩ = ∣0⟩ − ∣1⟩ ∣v⟩⟨v∣ =
3 3 4
9 9

To check these density matrix representations, we can compute by hand or ask Qiskit
to perform the conversion using the .to_operator method from the Statevector
class. Here we also use the .from_label method to define the first six state vectors
for convenience.

1 # Define and display examples of density matrices


2 # using the Statevector package
3
4 ket_0 = Statevector.from_label('0')
5 ket_1 = Statevector.from_label('1')
6 ket_plus = Statevector.from_label('+')
7 ket_minus = Statevector.from_label('-')
8
ket_iplus = Statevector.from_label('r')
9
ket_iminus = Statevector.from_label('l')
10
11 v = Statevector([(1 + 2j) / 3, -2 / 3])
12
13 display(array_to_latex(ket_0.to_operator()))
14 display(array_to_latex(ket_1.to_operator()))
15 display(array_to_latex(ket_plus.to_operator()))
16 display(array_to_latex(ket_minus.to_operator()))
17 display(array_to_latex(ket_iplus.to_operator()))
18 display(array_to_latex(ket_iminus.to_operator()))
display(array_to_latex(v.to_operator()))

Authenticate to run code cells Sign in

Output:

1 0
[ ]
0 0
0 0
[ ]
0 1
1 1
[ 21 2]
1
2 2
1
− 12
[ 1 2
1 ]
−2 2
1
− 2i
[ 2i 1 ]
2 2
1 i
[ i 2 2]
1
−2 2
5 4i
− 29 −
[ 9
4i
9]
− 29 + 9
4
9

We can also use the .from_label method for DensityMatrix elements for the first
6.

1 # Define and display examples of density matrices


2 # using the DensityMatrix package
3
4 rho_0 = DensityMatrix.from_label('0')
5 rho_1 = DensityMatrix.from_label('1')
6 rho_plus = DensityMatrix.from_label('+')
7 rho_minus = DensityMatrix.from_label('-')
8
rho_iplus = DensityMatrix.from_label('r')
9
rho_iminus = DensityMatrix.from_label('l')
10
11
12 display(rho_0.draw('latex'))
13 display(rho_1.draw('latex'))
14 display(rho_plus.draw('latex'))
15 display(rho_minus.draw('latex'))
16 display(rho_iplus.draw('latex'))
display(rho_iminus.draw('latex'))

Authenticate to run code cells Sign in

Output:

1 0
[ ]
0 0
0 0
[ ]
0 1
1 1
[ 21 2]
1
2 2
1
− 12
[ 1 2
1 ]
−2 2
1
− 2i
[ 2i 1 ]
2 2
1 i
[ i 2 2]
1
−2 2

Density matrices that take the form ρ = ∣ψ⟩⟨ψ∣ for some quantum state vector ∣ψ⟩
are known as pure states. Not every density matrix can be written in this form; some
states are not pure.

As density matrices, pure states always have one eigenvalue equal to 1 and all other
eigenvalues equal to 0. This is consistent with the interpretation that the eigenvalues
of a density matrix describe the randomness or uncertainty inherent to that state. A
way to think about this is that there's no uncertainty for a pure state ρ = ∣ψ⟩⟨ψ∣ —
the state is definitely ∣ψ⟩.

In general, for a quantum state vector

α0
α1
∣ψ⟩ =

αn−1

for a system with n classical states, the density matrix representation of the same
state is as follows.

α0 α0 α0 α1 ⋯ α0 αn−1 ∣α0 ∣2 α0 α1 ⋯
α1 α0 α1 α1 ⋯ α1 αn−1 α1 α0 ∣α1 ∣2 ⋯
∣ψ⟩⟨ψ∣ = =
⋮ ⋮ ⋱ ⋮ ⋮ ⋮ ⋱
αn−1 α0 αn−1 α1 ⋯ αn−1 αn−1 αn−1 α0 αn−1 α1 ⋯

Thus, for the special case of pure states, we can verify that the diagonal entries of a
density matrix describe the probabilities that a standard basis measurement would
output each possible classical state.

A final remark about pure states is that density matrices eliminate the degeneracy
concerning global phases found for quantum state vectors. Suppose we have two
quantum state vectors that differ by a global phase: ∣ψ⟩ and ∣ϕ⟩ = eiθ ∣ψ⟩, for some
real number θ. Because they differ by a global phase, these vectors represent exactly
the same quantum state, despite the fact that the vectors may be different. The
density matrices that we obtain from these two state vectors, on the other hand, are
identical.

∣ϕ⟩⟨ϕ∣ = (eiθ ∣ψ⟩)(eiθ ∣ψ⟩) = ei(θ−θ) ∣ψ⟩⟨ψ∣ = ∣ψ⟩⟨ψ∣

In general, density matrices provide a unique representation of quantum states: two


quantum states are identical, generating exactly the same outcome statistics for every
possible measurement that can be performed on them, if and only if their density
matrix representations are equal. Using mathematical parlance, we can express this
by saying that density matrices offer a faithful representation of quantum states.

Convex combinations of density matrices

A key aspect of density matrices is that probabilistic selections of quantum states are
represented by convex combinations of their associated density matrices.

For example, if we have two density matrices, ρ and σ, representing quantum states
of a system X, and we prepare the system in the state ρ with probability p ∈ [0, 1]
and σ with probability 1 − p, then the resulting quantum state is represented by the
density matrix

pρ + (1 − p)σ.

More generally, if we have m quantum states represented by density matrices


ρ0 , … , ρm−1 , and a system is prepared in the state ρk with probability pk for some
probability vector (p0 , … , pm−1 ), the resulting state is represented by the density
matrix

m−1
∑ pk ρk .
k=0

This is a convex combination of the density matrices ρ0 , … , ρm−1 .

If we suppose that we have m quantum state vectors ∣ψ0 ⟩, … , ∣ψm−1 ⟩, and we


prepare a system in the state ∣ψk ⟩ with probability pk for each k ∈ {0, … , m − 1},
the state we obtain is represented by the density matrix

m−1
∑ pk ∣ψk ⟩⟨ψk ∣.
k=0

For example, if a qubit is prepared in the state ∣0⟩ with probability 1/2 and in the state
∣+⟩ with probability 1/2, the density matrix representation of the state we obtain is
given by
1 1 3 1
∣0⟩⟨0∣ + ∣+⟩⟨+∣ = ( ) + (1 ) (1 ).
1 1 1 1 0 1 2 2 4 4
=
2 2 2 0 0 2 1 1
2 2 4 4

In the simplified formulation of quantum information, averaging quantum state


vectors like this doesn't work. For instance, the vector

1 2+ 2
∣0⟩ + ∣+⟩ = ( ) + ( )
1 1 1 1 1 2 4
=
2 2 2 0 2 1 2
2 4

is not a valid quantum state vector because its Euclidean norm is not equal to 1.

A more extreme example that shows that this doesn't work for quantum state vectors
is that we fix any quantum state vector ∣ψ⟩ that we wish, and then we take our state to
be ∣ψ⟩ with probability 1/2 and −∣ψ⟩ with probability 1/2. These states differ by a
global phase, so they're actually the same state — but averaging gives us the zero
vector, which is not a valid quantum state vector.

The completely mixed state

Suppose we set the state of a qubit to be ∣0⟩ or ∣1⟩ randomly, each with probability
1/2. The density matrix representing the resulting state is as follows. (In this equation
the symbol I denotes the 2 × 2 identity matrix.)

1
∣0⟩⟨0∣ + ∣1⟩⟨1∣ = ( )+ ( ) = (2 )= I
1 1 1 1 0 1 0 0 0 1
2 2 2 0 0 2 0 1 1 2
0 2

This is a special state known as the completely mixed state. It represents complete
uncertainty about the state of a qubit, similar to a uniform random bit in the
probabilistic setting.

Now suppose that we change the procedure: in place of the states ∣0⟩ and ∣1⟩ we'll
use the states ∣+⟩ and ∣−⟩. We can compute the density matrix that describes the
resulting state in a similar way.
1 1 1
− 12 1
0
∣+⟩⟨+∣ + ∣−⟩⟨−∣ = ( 1 ) + ( 1 )=( )=
1 1 1 2 2 1 2 2 1
I
2 2 2 1 2 − 1
0 1 2
2 2 2 2 2

It's the same density matrix as before, even though we changed the states. We would
again obtain the same result — the completely mixed state — by substituting any two
orthogonal qubit state vectors for ∣0⟩ and ∣1⟩.

This is a feature not a bug! We do in fact obtain exactly the same state either way. That
is, there's no way to distinguish the two procedures by measuring the qubit they
produce, even in a statistical sense — so we've simply described the same state in two
different ways.

We can verify that this makes sense by thinking about what we could hope to learn
given a random selection of a state from one of the two possible state sets {∣0⟩, ∣1⟩}
and {∣+⟩, ∣−⟩}. To keep things simple, let's suppose that we perform a unitary
operation U on our qubit and then measure in the standard basis.

In the first scenario, the state of the qubit is chosen uniformly from the set {∣0⟩, ∣1⟩}.
If the state is ∣0⟩, we obtain the outcomes 0 and 1 with probabilities

∣⟨0∣U ∣0⟩∣2 and ∣⟨1∣U ∣0⟩∣2

respectively. If the state is ∣1⟩, we obtain the outcomes 0 and 1 with probabilities

∣⟨0∣U ∣1⟩∣2 and ∣⟨1∣U ∣0⟩∣2 .

Because the two possibilities each happen with probability 1/2, we obtain the
outcome 0 with probability

1 1
∣⟨0∣U ∣0⟩∣2 + ∣⟨0∣U ∣1⟩∣2
2 2
and the outcome 1 with probability

1 1
∣⟨1∣U ∣0⟩∣ + ∣⟨1∣U ∣1⟩∣2 .
2
2 2
Both of these expressions are equal to 1/2. One way to argue this is to use a fact from
linear algebra that can be seen as a generalization of the Pythagorean theorem.

Theorem. Suppose {∣ψ1 ⟩, … , ∣ψn ⟩} is an orthonormal basis of a (real or


complex) vector space V. For every vector ∣ϕ⟩ ∈ V we have ∣⟨ψ1 ∣ϕ⟩∣2 + ⋯ +
∣⟨ψn ∣ϕ⟩∣2 = ∥∣ϕ⟩∥2 .

We can apply this theorem to determine the probabilities as follows. The probability to
get 0 is

1 1 1
∣⟨0∣U ∣0⟩∣2 + ∣⟨0∣U ∣1⟩∣2 = (∣⟨0∣U ∣0⟩∣2 + ∣⟨0∣U ∣1⟩∣2 )
2 2 2
1
= (∣⟨0∣U † ∣0⟩∣2 + ∣⟨1∣U † ∣0⟩∣2 )
2
1 † 2
= U ∣0⟩
2

and the probability to get 1 is

1 1 1
∣⟨1∣U ∣0⟩∣2 + ∣⟨1∣U ∣1⟩∣2 = (∣⟨1∣U ∣0⟩∣2 + ∣⟨1∣U ∣1⟩∣2 )
2 2 2
1
= (∣⟨0∣U † ∣1⟩∣2 + ∣⟨1∣U † ∣1⟩∣2 )
2
1 † 2
= U ∣1⟩ .
2

Because U is unitary we know that U † is unitary as well, implying that both U † ∣0⟩ and
U † ∣1⟩ are unit vectors. Both probabilities are therefore equal to 1/2. This means that
no matter how we choose U , we're just going to get a uniform random bit from the
measurement.

We can perform a similar verification for any other pair of orthonormal states in place
of ∣0⟩ and ∣1⟩. For example, because {∣+⟩, ∣−⟩} is an orthonormal basis, the
probability to obtain the measurement outcome 0 is in the second procedure is

1 1 1 † 2 1
∣⟨0∣U ∣+⟩∣2 + ∣⟨0∣U ∣−⟩∣2 = U ∣0⟩ =
2 2 2 2
and the probability to get 1 is

1 2 1 2 1 † 2 1
∣⟨1∣U ∣+⟩∣ + ∣⟨1∣U ∣−⟩∣ = U ∣1⟩ = .
2 2 2 2
In particular, we obtain exactly the same output statistics as we did for the states ∣0⟩
and ∣1⟩.

Probabilistic states

Classical states can be represented by density matrices. In particular, for each


classical state a of a system X, the density matrix

ρ = ∣a⟩⟨a∣

represents X being definitively in the classical state a. For qubits we have

1 0 0 0
∣0⟩⟨0∣ = ( ) and ∣1⟩⟨1∣ = ( ),
0 0 0 1

and in general we have a single 1 on the diagonal in the position corresponding to the
classical state we have in mind, with all other entries zero.

We can then take convex combinations of these density matrices to represent


probabilistic states. Supposing for simplicity that our classical state set is
{0, … , n − 1}, if we have that X is in the state a with probability pa for each a ∈
{0, … , n − 1}, then the density matrix we obtain is

p0 0 ⋯ 0
n−1
0 ⋱ ⋮
ρ = ∑ pa ∣a⟩⟨a∣ =
p1
.
a=0 ⋮ ⋱ ⋱ 0
0 ⋯ 0 pn−1

Going in the other direction, any diagonal density matrix can naturally be identified
with the probabilistic state we obtain by simply reading the probability vector off from
the diagonal. To be clear, when a density matrix is diagonal, it's not necessarily the
case that we're talking about a classical system, or that the system must have been
prepared through the random selection of a classical state, but rather that the state
could have been obtained through the random selection of a classical state.

The fact that probabilistic states are represented by diagonal density matrices is
consistent with the intuition suggested at the start of the lesson that off-diagonal
entries describe the degree to which the two classical states corresponding to the row
and column of that entry are in quantum superposition. Here all of the off-diagonal
entries are zero, so we just have classical randomness and nothing is in quantum
superposition.

Density matrices and the spectral theorem

We've seen that if we take a convex combination of pure states,

m−1
ρ = ∑ pk ∣ψk ⟩⟨ψk ∣,
k=0

we obtain a density matrix. Every density matrix ρ, in fact, can be expressed as a


convex combination of pure states like this. That is, there will always exist a collection
of unit vectors {∣ψ0 ⟩, … , ∣ψm−1 ⟩} and a probability vector (p0 , … , pm−1 ) for
which the equation above is true.

We can, moreover, always choose the number m so that it agrees with the number of
classical states of the system being considered, and we can select the quantum state
vectors to be orthogonal. The spectral theorem allows us to conclude this. (The
statement of this theorem that follows refers to a normal matrix M . This is a matrix
that satisfies M † M = M M † , or in words, commutes with its own conjugate
transpose.)

Theorem (spectral theorem). Let M be a normal n × n complex matrix. There


exists an orthonormal basis of n dimensional complex vectors
{∣ψ0 ⟩, … , ∣ψn−1 ⟩} along with complex numbers λ0 , … , λn−1 such that M =
λ0 ∣ψ0 ⟩⟨ψ0 ∣ + ⋯ + λn−1 ∣ψn−1 ⟩⟨ψn−1 ∣.

We can apply this theorem to a given density matrix ρ because density matrices are
Hermitian and therefore normal, which allows us to write

ρ = λ0 ∣ψ0 ⟩⟨ψ0 ∣ + ⋯ + λn−1 ∣ψn−1 ⟩⟨ψn−1 ∣

for some orthonormal basis {∣ψ0 ⟩, … , ∣ψn−1 ⟩}. It remains to verify that
(λ0 , … , λn−1 ) is a probability vector, which we can then rename to (p0 , … , pn−1 ) if
we wish.

The numbers λ0 , … , λn−1 are the eigenvalues of ρ, and because ρ is positive


semidefinite these numbers must therefore be nonnegative real numbers. We can
conclude that λ0 + ⋯ + λn−1 = 1 from the fact that ρ has trace equal to 1. Going
through the details will give us an opportunity to point out an important and useful
property of the trace.

Theorem (cyclic property of the trace). For any two matrices A and B that give us
a square matrix AB by multiplying, the equality Tr(AB) = Tr(BA) is true.

Note that this theorem works even if A and B are not themselves square matrices —
we may have that A is n × m and B is m × n, for some choice of positive integers n
and m, so that AB is an n × n square matrix and BA is m × m. So, if we let A be a
column vector ∣ϕ⟩ and let B be the row vector ⟨ϕ∣, then we see that

Tr(∣ϕ⟩⟨ϕ∣) = Tr(⟨ϕ∣ϕ⟩) = ⟨ϕ∣ϕ⟩.

The second equality follows from the fact that ⟨ϕ∣ϕ⟩ is a scalar, which we can also
think of as a 1 × 1 matrix whose trace is its single entry. Using this fact, we can
conclude that λ0 + ⋯ + λn−1 = 1 by the linearity of the trace function.

1 = Tr(ρ) = Tr(λ0 ∣ψ0 ⟩⟨ψ0 ∣ + ⋯ + λn−1 ∣ψn−1 ⟩⟨ψn−1 ∣)

= λ0 Tr(∣ψ0 ⟩⟨ψ0 ∣) + ⋯ + λn−1 Tr(∣ψn−1 ⟩⟨ψn−1 ∣) = λ0 + ⋯ + λn−1

Alternatively, we can use a fact that was mentioned previously, which is that the trace
of a square matrix is equal to the sum of its eigenvalues, to reach the same
conclusion.

We have therefore concluded that any given density matrix ρ can be expressed as a
convex combination of pure states. We also see that we can, moreover, take the pure
states to be orthogonal. This means, in particular, that we never need the number n to
be larger than the size of the classical state set of X.

It must be understood that there will in general be many different ways to write a
density matrix as a convex combination of pure states, not just the ways that the
spectral theorem provides. A previous example illustrates this.
3 1
∣0⟩⟨0∣ + ∣+⟩⟨+∣ = ( 1 )
1 1 4 4
2 2 1
4 4

This is not a spectral decomposition of this matrix because ∣0⟩ and ∣+⟩ are not
orthogonal. Here's a spectral decomposition:
3 1
(1 )
4 4
1
= cos2 (π/8)∣ψπ/8 ⟩⟨ψπ/8 ∣ + sin2 (π/8)∣ψ5π/8 ⟩⟨ψ5π/8 ∣,
4 4

where ∣ψθ ⟩ = cos(θ)∣0⟩ + sin(θ)∣1⟩. The eigenvalues are numbers we've seen
before.

2 2+ 2 2 2− 2
cos (π/8) = ≈ 0.85 and sin (π/8) = ≈ 0.15
4 4
The eigenvectors can be written explicitly like this.

2+ 2 2− 2
∣ψπ/8 ⟩ = ∣0⟩ + ∣1⟩
2 2
2− 2 2+ 2
∣ψ5π/8 ⟩ = − ∣0⟩ + ∣1⟩
2 2

As another, more general example, suppose ∣ϕ0 ⟩, … , ∣ϕ99 ⟩ are quantum state
vectors representing states of a qubit, chosen arbitrarily — so we're not assuming any
particular relationships among these vectors. We could then consider the state we
obtain by choosing one of these 100 states uniformly at random:

99
1
ρ= ∑ ∣ϕk ⟩⟨ϕk ∣.
100
k=0

Because we're talking about a qubit, the density matrix ρ is 2 × 2, so by the spectral
theorem we could alternatively write

ρ = p∣ψ0 ⟩⟨ψ0 ∣ + (1 − p)∣ψ1 ⟩⟨ψ1 ∣

for some real number p ∈ [0, 1] and an orthonormal basis {∣ψ0 ⟩, ∣ψ1 ⟩} — but
naturally the existence of this expression doesn't prohibit us from writing ρ as an
average of 100 pure states if we choose to do that.

Bloch sphere

There's a useful geometric way to represent pure states of qubits known as the Bloch
sphere. It's very convenient, but unfortunately it only works for qubits — once we have
three or more classical states in our system, the analogous representation no longer
corresponds to a spherical object.

Let's start by thinking about a quantum state vector of a qubit: α∣0⟩ + β∣1⟩. We can
restrict our attention to vectors for which α is a nonnegative real number because
every qubit state vector is equivalent up to a global phase to one for which α ≥ 0.
This allows us to write

∣ψ⟩ = cos(θ/2)∣0⟩ + eiϕ sin(θ/2)∣1⟩

for two real numbers θ ∈ [0, π] and ϕ ∈ [0, 2π). Here we're allowing θ to range from
0 to π and dividing by 2 in the expression of the vector because this is a conventional
way to parameterize vectors of this sort, and it will make things simpler a bit later on.

It isn't quite the case that the numbers θ and ϕ are uniquely determined by a given
quantum state vector α∣0⟩ + β∣1⟩, but it is nearly so. In particular, if θ = 0, then we
have ∣ψ⟩ = ∣0⟩, and it doesn't make any difference what value ϕ takes, so it can be
chosen arbitrarily. Similarly, if θ = π, then we have ∣ψ⟩ = e−ϕ ∣1⟩, which is
equivalent up to a global phase to ∣1⟩, so once again ϕ is irrelevant. If, however,
neither α nor β is 0, then there's a unique choice for the pair (θ, ϕ) for which ∣ψ⟩ is
equivalent to α∣0⟩ + β∣1⟩ up to a global phase.

Now let's think about the density matrix representation of this state.

cos2 (θ/2) e−iϕ cos(θ/2) sin(θ/2)


∣ψ⟩⟨ψ∣ = ( 2
)
eiϕ cos(θ/2) sin(θ/2) sin (θ/2)

We can use some trigonometric identities,

2 1 + cos(θ)
cos (θ/2) = ,
2
1 − cos(θ)
sin2 (θ/2) = ,
2
sin(θ)
cos(θ/2) sin(θ/2) = ,
2

as well as the formula eiϕ = cos(ϕ) + i sin(ϕ), to simplify the density matrix as
follows.

∣ψ⟩⟨ψ∣ = ( )
1 1 + cos(θ) (cos(ϕ) − i sin(ϕ)) sin(θ)
2 (cos(ϕ) + i sin(ϕ)) sin(θ) 1 − cos(θ)

This makes it easy to express this density matrix as a linear combination of the Pauli
matrices:

I=( ), σx = ( ), σy = ( ), σz = ( ).
1 0 0 1 0 −i 1 0
0 1 1 0 i 0 0 −1

Specifically, we conclude that

I + sin(θ) cos(ϕ)σx + sin(θ) sin(ϕ)σy + cos(θ)σz


∣ψ⟩⟨ψ∣ = .
2
Next let's take a look at the three coefficients of σx , σy , and σz in the numerator of
this expression. They're all real numbers and we can collect them together to form a 3
-dimensional vector.

(sin(θ) cos(ϕ), sin(θ) sin(ϕ), cos(θ))

This vector is written (1, θ, ϕ) in spherical coordinates: the first coordinate 1


represents the radius or radial distance, θ represents the polar angle, and ϕ
represents the azimuthal angle. In words, the polar angle θ is how far we rotate south
from the north pole, from 0 to π= 180∘ , while the azimuthal angle ϕ is how far we
rotate east from the prime meridian, from 0 to 2π = 360∘ , assuming that the prime
meridian is defined to be the curve on the surface of the sphere from one pole to the
other that passes through the positive x-axis.

We can describe every point on the sphere in this way, which is to say that the points
we obtain when we range over all possible pure states of a qubit correspond precisely
to a sphere in 3 real dimensions. (This sphere is typically called the unit 2-sphere
because the surface of this sphere is two-dimensional.) When we associate points on
the unit 2-sphere with pure states of qubits, we obtain the Bloch sphere
representation these states.

Six important states

1. The standard basis {∣0⟩, ∣1⟩}. Let's start with the state ∣0⟩. As a density matrix it
can be written like this.

I + σz
∣0⟩⟨0∣ =
2
By collecting the coefficients of the Pauli matrices in the numerator, we see that
the corresponding point on the unit 2-sphere using Cartesian coordinates is
(0, 0, 1). In spherical coordinates this point is (1, 0, ϕ) where ϕ can be any angle.
This is consistent with the expression

∣0⟩ = cos(0)∣0⟩ + eiϕ sin(0)∣1⟩,

which also works for any ϕ. Intuitively speaking, the polar angle θ is zero, so we're
at the north pole of the Bloch sphere, where the azimuthal angle is irrelevant.
Along similar lines, a density matrix for the state ∣1⟩ can be written like so.

I − σz
∣1⟩⟨1∣ =
2
This time the Cartesian coordinates are (0, 0, −1). In spherical coordinates this
point is (1, π, ϕ) where ϕ can be any angle. Intuitively speaking, the polar angle is
all the way to π, so we're at the south pole where the azimuthal angle is again
irrelevant.

2. The basis {∣+⟩, ∣−⟩}. This time we have these expressions.

I + σx
∣+⟩⟨+∣ =
2
I − σx
∣−⟩⟨−∣ =
2

The corresponding points on the unit 2-sphere have Cartesian coordinates


(1, 0, 0) and (−1, 0, 0), and spherical coordinates (1, π/2, 0) and (1, π/2, π),
respectively. In words, ∣+⟩ corresponds to the point where the positive x-axis
intersects the unit 2-sphere and ∣−⟩ to the point where the negative x-axis
intersects it. More intuitively, ∣+⟩ is on the equator of the Bloch sphere where it
meets the prime meridian, and ∣−⟩ is on the equator at the opposite side of the
sphere.

3. The basis {∣+i ⟩, ∣−i ⟩}. As we saw earlier in the lesson, these two states are
defined like this:

1 i
∣+i ⟩ = ∣0⟩ + ∣1⟩
2 2
1 i
∣−i ⟩ = ∣0⟩ − ∣1⟩.
2 2

This time we have these expressions.

I + σy
∣+i ⟩⟨+i ∣ =
2
I − σy
∣−i ⟩⟨−i ∣ =
2

The corresponding points on the unit 2-sphere have Cartesian coordinates


(0, 1, 0) and (0, −1, 0), and spherical coordinates (1, π/2, π/2) and
(1, π/2, 3π/2), respectively. In words, ∣+i ⟩ corresponds to the point where the
positive y -axis intersects the unit 2-sphere and ∣−i ⟩ to the point where the
negative y -axis intersects it.

Here's another class of quantum state vectors that has appeared from time to time
throughout this series, including previously in this lesson.

∣ψα ⟩ = cos(α)∣0⟩ + sin(α)∣1⟩ (for α ∈ [0, π))

The density matrix representation of each of these states is as follows.

cos2 (α) cos(α) sin(α)


∣ψα ⟩⟨ψα ∣ = ( )=
I + sin(2α)σx + cos(2α)σz
cos(α) sin(α) sin2 (α) 2

The following figure illustrates the corresponding points on the Bloch sphere for a few
choices for α.

Convex combinations of points

Similar to what we already discussed for density matrices, we can take convex
combinations of points on the Bloch sphere to obtain representations of qubit density
matrices. In general this results in points inside of the Bloch sphere, which represent
density matrices of states that are not pure. Sometimes we refer to the Bloch ball
when we wish to be explicit about the inclusion of points inside of the Bloch sphere as
representations of qubit density matrices.

For example, we have seen that the density matrix 12 I, which represents the
completely mixed state of a qubit, can be written in these two alternative ways:

1 1 1 1 1 1
I = ∣0⟩⟨0∣ + ∣1⟩⟨1∣ and I = ∣+⟩⟨+∣ + ∣−⟩⟨−∣.
2 2 2 2 2 2
We also have

1 1 1
I = ∣+ i ⟩⟨+i∣ + ∣− i⟩⟨−i∣,
2 2 2
and more generally we can use any two orthogonal qubit state vectors (which will
always correspond to two antipodal points on the Bloch sphere). If we average the
corresponding points on the Bloch sphere in a similar way we obtain the same point,
which in this case is at the center of the sphere. This is consistent with the observation
that

1 I + 0 ⋅ σx + 0 ⋅ σy + 0 ⋅ σz
I= ,
2 2
giving us the Cartesian coordinates (0, 0, 0).

A different example concerning convex combinations of Bloch sphere points is the one
discussed in the previous subsection.
3 1
∣0⟩⟨0∣ + ∣+⟩⟨+∣ = ( 1 )
1 1 4 4
= cos2 (π/8)∣ψπ/8 ⟩⟨ψπ/8 ∣ + sin2 (π/8)∣ψ5π/8 ⟩⟨ψ ∣
2 2 1
4 4

The following figure illustrates these two different ways of obtaining this density
matrix as a convex combination of pure states.

Plotting Bloch sphere points in Qiskit

Qiskit provides two functions for plotting points in the Bloch ball: plot_bloch_vector

and plot_bloch_multivector .

1 # Required imports for code cells


2
3 from qiskit.quantum_info import DensityMatrix
4 from qiskit.visualization import plot_bloch_multivector, plot_bloch_vector
5 from numpy import sin, cos, pi
6
7 print('Imports loaded.')

Authenticate to run code cells Sign in

Output:

Imports loaded.

The function plot_bloch_vector displays a Bloch ball point using either Cartesian or
spherical coordinates.

1 # Plot Bloch sphere points in Cartesian and


2 # spherical coordinates using plot_bloch_vector
3
4 display(plot_bloch_vector([sin(pi/4),0,cos(pi/4)]))
5 display(plot_bloch_vector([1, pi/4, 0], coord_type='spherical'))

Authenticate to run code cells Sign in

Output:

The center of the ball is indicated by the lack of an arrow (or an arrow of length zero).

1 # Plot the center point of the Bloch ball


2 # using plot_bloch_vector
3
4 display(plot_bloch_vector([0,0,0]))

Authenticate to run code cells Sign in

Output:

The plot_bloch_multivector function takes a Statevector or DensityMatrix as


input and outputs a Bloch sphere illustration (for each qubit in isolation).

1 # Plot a Bloch ball point using plot_bloch_multivector


2
3 rho = DensityMatrix([[3/4, 1/4],[1/4,1/4]])
4 display(plot_bloch_multivector(rho))

Authenticate to run code cells Sign in

Output:

This can equivalently be done through the draw method for Statevector and
DensityMatrix objects.

1 # Plot a Bloch ball point using the


2 # DensityMatrix draw method
3
4 display(rho.draw('bloch'))

Authenticate to run code cells Sign in

Output:

Multiple systems and reduced states

Now we'll turn our attention to how density matrices work for multiple systems,
including examples of different types of correlations they can express and how they
can be used to describe the states of isolated parts of compound systems.

Multiple systems

Density matrices can represent states of multiple systems in an analogous way to


state vectors in the simplified formulation of quantum information, following the same
basic idea that multiple systems can be viewed as if they're single, compound
systems. In mathematical terms, the rows and columns of density matrices
representing states of multiple systems are placed in correspondence with the
Cartesian product of the classical state sets of the individual systems.

For example, recall the state vector representations of the four Bell states.

1 1
∣ϕ+ ⟩ = ∣00⟩ + ∣11⟩
2 2
− 1 1
∣ϕ ⟩ = ∣00⟩ − ∣11⟩
2 2
1 1
∣ψ + ⟩ = ∣01⟩ + ∣10⟩
2 2
1 1
∣ψ − ⟩ = ∣01⟩ − ∣10⟩
2 2

The density matrix representations of these states are as follows.

1 1
2
0 0 2

+ +
0 0 0 0
∣ϕ ⟩⟨ϕ ∣ =
0 0 0 0
1 1
2
0 0 2
1
2
0 0 − 12

− −
0 0 0 0
∣ϕ ⟩⟨ϕ ∣ =
0 0 0 0
− 12 0 0 1
2

0 0 0 0
1 1
+ +
0 2 2
0
∣ψ ⟩⟨ψ ∣ = 1 1
0 2 2
0
0 0 0 0
0 0 0 0
1
− −
0 2
− 12 0
∣ψ ⟩⟨ψ ∣ =
0 − 12 1
2
0
0 0 0 0

Product states

Similar to what we had for state vectors, tensor products of density matrices
represent independence between the states of multiple systems. For instance, if X is
prepared in the state represented by the density matrix ρ and Y is independently
prepared in the state represented by σ, then the density matrix describing the state of
(X, Y) is the tensor product ρ ⊗ σ.
The same terminology is used here as in the simplified formulation of quantum
information: states of this form are referred to as product states.

Correlated and entangled states

States that cannot be expressed as product states represent correlations between


systems. There are, in fact, different types of correlations that can be represented by
density matrices. Here are a few examples.

1. Correlated classical states. For example, we can express the situation in which
Alice and Bob share a random bit like this:

1
2
0 0 0
1 1 0 0 0 0
∣0⟩⟨0∣ ⊗ ∣0⟩⟨0∣ + ∣1⟩⟨1∣ ⊗ ∣1⟩⟨1∣ =
2 2 0 0 0 0
1
0 0 0 2

2. Ensembles of quantum states. Suppose we have m density matrices


ρ0 , … , ρm−1 , all representing states of a system X, and we randomly choose one
of these states according to a probability vector (p0 , … , pm−1 ). Such a process is
represented by an ensemble of states, which includes the specification of the
density matrices ρ0 , … , ρm−1 as well as the probabilities (p0 , … , pm−1 ). We
can associate an ensemble of states with a single density matrix, describing both
the random choice of k and the corresponding density matrix ρk , like this:

m−1
∑ pk ∣k⟩⟨k∣ ⊗ ρk
k=0

To be clear, this is the state of a pair (Y, X) where Y represents the classical
selection of k — so we're assuming its classical state set is {0, … , m − 1}.
States of this form are sometimes called classical-quantum states.

3. Separable states. We can imagine situations in which we have a classical


correlation among the quantum states of two systems like this.

m−1
∑ pk ρk ⊗ σk
k=0

In words, for each k from 0 to m − 1, we have that with probability pk the system
on the left is in the state ρk and the system on the right is in the state σk . States
like this are called separable states. This concept can also be extended to more
than two systems.

4. Entangled states. Not all states of pairs of systems are separable. In the general
formulation of quantum information this is how entanglement is defined: states
that are not separable are said to be entangled. This terminology is consistent with
the terminology we used in Basics of quantum information. There we said that
quantum state vectors that are not product states represent entangled states —
and indeed, for any quantum state vector ∣ψ⟩ that is not a product state, we find
that the state represented by the density matrix ∣ψ⟩⟨ψ∣ is not separable.
Entanglement is much more complicated than this for states that are not pure.

Reduced states and the partial trace

There's a simple but important thing we can do with density matrices in the context of
multiple systems, which is to describe the states we obtain by ignoring some of the
systems. When multiple systems are in a quantum state, and we discard or choose to
ignore one or more of the systems, the state of the remaining systems is called the
reduced state of those systems. Density matrix descriptions of reduced states are
easily obtained through a mapping, known as the partial trace, from the density matrix
describing the state of the whole.

Example: reduced states for an e-bit

Suppose that we have a pair of qubits (A, B) that are together in the state

1 1
∣ϕ+ ⟩ = ∣00⟩ + ∣11⟩.
2 2
We can imagine that Alice holds the qubit A and Bob holds B, which is to say that
together they share an e-bit. We'd like to have a density matrix description of Alice's
qubit A in isolation, as if Bob decided to take his qubit and visit the stars, never to be
seen again.

First let's think about what would happen if Bob decided somewhere on his journey to
measure his qubit with respect to a standard basis measurement. If he did this, he
would obtain the outcome 0 with probability

+ 2 1 2 1
(IA ⊗ ⟨0∣)∣ϕ ⟩ = ∣0⟩ = ,
2 2

in which case the state of Alice's qubit becomes ∣0⟩; and he would obtain the outcome
1 with probability

+ 2 1 2 1
(IA ⊗ ⟨1∣)∣ϕ ⟩ = ∣1⟩ = ,
2 2

in which case the state of Alice's qubit becomes ∣1⟩.

So, if we ignore Bob's measurement outcome and focus on Alice's qubit, we conclude
that she obtains the state ∣0⟩ with probability 1/2 and the state ∣1⟩ with probability
1/2. This leads us to describe the state of Alice's qubit in isolation by the density
matrix

1 1 1
∣0⟩⟨0∣ + ∣1⟩⟨1∣ = IA .
2 2 2
That is, Alice's qubit is in the completely mixed state. To be clear, this description of
the state of Alice's qubit doesn't include Bob's measurement outcome; we're ignoring
Bob altogether.

Now, it might seem like the density matrix description of Alice's qubit in isolation that
we've just obtained relies on the assumption that Bob has measured his qubit, but this
is not actually so. What we've done is to use the possibility that Bob measures his
qubit to argue that the completely mixed state arises as the state of Alice's qubit,
based on what we've already learned. Of course, nothing says that Bob must measure
his qubit — but nothing says that he doesn't. And if he's light years away, then nothing
he does or doesn't do can possibly influence the state of Alice's qubit viewed it in
isolation. That is to say, the description we've obtained for the state of Alice's qubit is
the only description consistent with the impossibility of faster-than-light
communication.

We can also consider the state of Bob's qubit B, which happens to be the completely
mixed state as well. Indeed, for all four Bell states we find that the reduced state of
both Alice's qubit and Bob's qubit is the completely mixed state.

Reduced states for a general quantum state vector

Now let's generalize the example just discussed to two arbitrary systems A and B, not
necessarily qubits in the state ∣ϕ+ ⟩. We'll assume the classical state sets of A and B
are Σ and Γ, respectively. A density matrix ρ representing a state of the combined
system (A, B) therefore has row and column indices corresponding to the Cartesian
product Σ × Γ.

Suppose that the state of (A, B) is described by the quantum state vector ∣ψ⟩, so the
density matrix describing this state is ρ = ∣ψ⟩⟨ψ∣. We'll obtain a density matrix
description of the state of A in isolation, which is conventionally denoted ρA . (A
superscript is also sometimes used rather than a subscript.)

The state vector ∣ψ⟩ can be expressed in the form

∣ψ⟩ = ∑ ∣ϕb ⟩ ⊗ ∣b⟩


b∈Γ

for a uniquely determined collection of vectors {∣ϕb ⟩ : b ∈ Γ}. In particular, these


vectors can be determined through a simple formula.

∣ϕb ⟩ = (IA ⊗ ⟨b∣)∣ψ⟩

Reasoning similarly to the previous example of an e-bit, if we were to measure the


system B with a standard basis measurement, we would obtain each outcome b ∈ Γ
with probability ∥∣ϕb ⟩∥2 , in which case the state of A becomes

∣ϕb ⟩
.
∥∣ϕb ⟩∥

As a density matrix, this state can be written as follows.



∣ϕb ⟩ ∣ϕb ⟩ ∣ϕb ⟩⟨ϕb ∣
( )( ) =
∥∣ϕb ⟩∥ ∥∣ϕb ⟩∥ ∥∣ϕb ⟩∥2

Averaging the different states according to the probabilities of the respective


outcomes, we arrive at the density matrix

∣ϕb ⟩⟨ϕb ∣
ρA = ∑ ∥∣ϕb ⟩∥2 = ∑ ∣ϕb ⟩⟨ϕb ∣ = ∑(IA ⊗ ⟨b∣)∣ψ⟩⟨ψ∣(IA ⊗ ∣b⟩)
∥∣ϕb ⟩∥2
b∈Γ b∈Γ b∈Γ

The partial trace

The formula

ρA = ∑(IA ⊗ ⟨b∣)∣ψ⟩⟨ψ∣(IA ⊗ ∣b⟩)


b∈Γ

leads us to the description of the reduced state of A for any density matrix ρ of the
pair (A, B), not just a pure state.

ρA = ∑(IA ⊗ ⟨b∣)ρ(IA ⊗ ∣b⟩)


b∈Γ

This formula must work, simply by linearity together with the fact that every density
matrix can be written as a convex combination of pure states.

The operation being performed on ρ to obtain ρA in this equation is known as the


partial trace, and to be more precise we say that the partial trace is performed on B,
or that B is traced out. This operation is denoted TrB , so we can write

TrB (ρ) = ∑(IA ⊗ ⟨b∣)ρ(IA ⊗ ∣b⟩).


b∈Γ

We can also define the partial trace on A, so it's the system A that gets traced out
rather than B, like this.

TrA (ρ) = ∑(⟨a∣ ⊗ IB )ρ(∣a⟩ ⊗ IB )


a∈Σ

This gives us the density matrix description ρB of the state of B in isolation rather than
A.
To recapitulate, if (A, B) is any pair of systems and we have a density matrix ρ
describing a state of (A, B), the reduced states of the systems A and B are as follows.

ρA = TrB (ρ) = ∑(IA ⊗ ⟨b∣)ρ(IA ⊗ ∣b⟩)


b∈Γ

ρB = TrA (ρ) = ∑(⟨a∣ ⊗ IB )ρ(∣a⟩ ⊗ IB )


a∈Σ

If ρ is a density matrix, then ρA and ρB will also necessarily be density matrices.

Generalization to three or more systems

These notions can be generalized to any number of systems in place of two in a


natural way. In general, we can put the names of whatever systems we choose in the
subscript of a density matrix ρ to describe the reduced state of just those systems. For
example, if A, B, and C are systems and ρ is a density matrix describing a state of
(A, B, C), then we can define

ρAC = TrB (ρ) = ∑(IA ⊗ ⟨b∣ ⊗ IC )ρ(IA ⊗ ∣b⟩ ⊗ IC )


b∈Γ

ρC = TrAB (ρ) = ∑ ∑(⟨a∣ ⊗ ⟨b∣ ⊗ IC )ρ(∣a⟩ ⊗ ∣b⟩ ⊗ IC )


a∈Σ b∈Γ

and similarly for other choices for the systems.

Alternative description of the partial trace

An alternative way to describe the partial trace mappings TrA and TrB is that they
are the unique linear mappings that satisfy the formulas

TrA (M ⊗ N ) = Tr(M )N

TrB (M ⊗ N ) = Tr(N )M .

In these formulas, N and M are square matrices of the appropriate sizes: the rows
and columns of M correspond to the classical states of A and the rows and columns
of N correspond to the classical states of B.

This characterization of the partial trace is not only fundamental from a mathematical
viewpoint, but can also allow for quick calculations in some situations. For example,
consider this state of a pair of qubits (A, B).

1 1
ρ= ∣0⟩⟨0∣ ⊗ ∣0⟩⟨0∣ + ∣1⟩⟨1∣ ⊗ ∣+⟩⟨+∣
2 2
To compute the reduced state ρA for instance, we can use linearity together with the
fact that ∣0⟩⟨0∣ and ∣+⟩⟨+∣ have unit trace.

1 1 1 1
ρA = TrB (ρ) = Tr(∣0⟩⟨0∣) ∣0⟩⟨0∣ + Tr(∣+⟩⟨+∣)∣1⟩⟨1∣ = ∣0⟩⟨0∣ + ∣1⟩⟨1∣
2 2 2 2
The reduced state ρB can be computed similarly.

1 1 1 1
ρB = TrA (ρ) = Tr(∣0⟩⟨0∣) ∣0⟩⟨0∣ + Tr(∣1⟩⟨1∣)∣+⟩⟨+∣ = ∣0⟩⟨0∣ + ∣+⟩⟨+∣
2 2 2 2

The partial trace for two qubits

The partial trace can also be described explicitly in terms of matrices. Here we'll do
this just for two qubits, but this can also be generalized to larger systems. Assume
that we have two qubits (A, B), so that any density matrix describing a state of these
two qubits can be written as

α00 α01 α02 α03


α10 α11 α12 α13
ρ=
α20 α21 α22 α23
α30 α31 α32 α33

for some choice of complex numbers {αjk : 0 ≤ j, k ≤ 3}.


The partial trace over the first system has the following formula.

α00 α01 α02 α03


α00 + α22
=( )+( )=(
α10 α11 α12 α13 α00 α01 α22 α23
TrA
α20 α21 α22 α23 α10 α11 α32 α33 α10 + α32
α30 α31 α32 α33

One way to think about this formula begins by viewing 4 × 4 matrices as 2 × 2 block
matrices, where each block is 2 × 2. That is,

ρ=( )
M0,0 M0,1
M1,0 M1,1

for

=( ), =( ), =( ),
α00 α01 α02 α03 α20 α21
M0,0 M0,1 M1,0 M1,1 =
α10 α11 α12 α13 α30 α31

We then have

TrA ( ) = M0,0 + M1,1 .


M0,0 M0,1
M1,0 M1,1

Here is the formula when the second system is traced out rather than the first.

α00 α01 α02 α03


Tr ( ) Tr ( )
α00 α01 α02 α03
α +α
=(
α10 α11 α12 α13 α10 α11 α12 α13
TrB =
Tr ( ) Tr ( )
α20 α21 α22 α23 α20 α21 α22 α23 α +α
α30 α31 α32 α33 α30 α31 α32 α33

In terms of block matrices of a form similar to before, we have this formula.

TrB ( )=( )
M0,0 M0,1 Tr(M0,0 ) Tr(M0,1 )
M1,0 M1,1 Tr(M1,0 ) Tr(M1,1 )

The block matrix descriptions of these functions can be extended to systems larger
than qubits in a natural and direct way.

To finish the lesson let's apply these formulas to the same state we considered above.

1
2
0 0 0
1 1 0 0 0 0
ρ = ∣0⟩⟨0∣ ⊗ ∣0⟩⟨0∣ + ∣1⟩⟨1∣ ⊗ ∣+⟩⟨+∣ = .
2 2 0 0 1 1
4 4
1 1
0 0 4 4

The reduced state of the first system A is

1
0 0 0 1
Tr ( ) Tr ( )
2 2
0 0 0
1
0 0 0 0 0 0 0 0 0
=( )
2
TrB 1 1
= 1
1 1
Tr ( ) Tr ( 41 )
0 0 4 4 0 0 4
0 2
1
0 0 1 1 0 0 4 4
4 4

and the reduced state of the second system B is

1
2
0 0 0
3 1
0 0 0 0 1 1 1
=( ) + ( 41 ) (1 ).
2
0 4 4 4
TrA 1
=
0 0 1 1 0 0 4 4 4
1
4
4 4
1 1
0 0 4 4

Reduced states in Qiskit

The partial_trace function computes the partial trace over a collection of systems
given a DensityMatrix argument.

1 # Required imports for code cells


2
3 from qiskit.quantum_info import DensityMatrix, partial_trace
4 from qiskit.visualization import plot_bloch_multivector
5
6 print('Imports loaded.')

Authenticate to run code cells Sign in

Output:

Imports loaded.

1 # Define and display a density matrix for a two-qubit


2 # correlated state along with reduced states
3
4 rho_0 = DensityMatrix.from_label('0')
5 rho_1 = DensityMatrix.from_label('1')
6 rho_plus = DensityMatrix.from_label('+')
7 rho = 1/2 * rho_0.tensor(rho_0) + 1/2 * rho_1.tensor(rho_plus)
8
9 display(rho.draw('latex'))
10 display(partial_trace(rho, [0]).draw(output='latex'))
11 display(partial_trace(rho, [1]).draw(output='latex'))

Authenticate to run code cells Sign in

Output:

1
2 0 0 0
0 0 0 0
1 1
0 0 4 4
1 1
0 0 4 4
1
0
[2 1]
0 2
3 1
[ 41 4]
1
4 4

Note that partial_trace numbers the systems from right to left — so qubit 0 is the
one on the right and qubit 1 is the one on the left.

The plot_bloch_multivector function plots these reduced states as Bloch ball points
using a similar naming convention.

1 # Plot Bloch ball representations for


2 # the two reduced states
3
4 display(plot_bloch_multivector(rho))

Authenticate to run code cells Sign in

Output:

Was this page helpful?

Yes No

Sign in to track your progress


Complete

Channels (coming soon)

Terms Privacy Cookie preferences Support

You might also like