Single systems
Download the slides for this lesson.
Introduction
This lesson introduces the basic framework of , including the description of quantum states as vectors with complex number entries, measurements that allow classical information to be extracted from quantum states, and operations on quantum states that are described by unitary matrices. We will restrict our attention in this lesson to the comparatively simple setting in which a single system is considered in isolation. In the next lesson, we will expand our view to multiple systems, which can interact with one another and be correlated, for instance.
There are, in fact, two common mathematical descriptions of quantum information. The one introduced in this lesson is the simpler of the two. This description is sufficient for understanding many (or perhaps most) quantum algorithms, and is a natural place to start from a pedagogical viewpoint.
A more general, and ultimately more powerful description of quantum information, in which quantum states are represented by density matrices, will be introduced in a later lesson. The density matrix description is essential to the study of quantum information, for several reasons. As examples, they can be used to model the effects of on quantum computations, or the state of one piece of an entangled pair. More generally, density matrices serve as a mathematical basis for quantum information theory and quantum cryptography, and are quite beautiful from a mathematical perspective. For these reasons, we encourage you to learn more about it when the time is right, but for now our focus will be on the simpler description of quantum information.
Pre-course Survey
Before we begin, please take a moment to complete our pre-course survey, which is important to help improve our content offerings and user experience.
Classical information
To describe quantum information and how it works, we will begin with an overview of information. Some readers may wonder why we choose to devote so much attention to classical information in a course on quantum information, but there are good reasons. For one, although quantum and classical information are different in some pretty spectacular ways, their mathematical descriptions are actually quite similar.
Classical information also serves as a familiar point of reference when studying quantum information, as well as a source of analogy that goes a surprisingly long way. It is common that people ask questions about quantum information that have natural classical analogs — often with simple answers that can provide both clarity and insight into the original questions about quantum information. Indeed, it is not at all unreasonable to claim that one cannot truly understand quantum information without understanding classical information.
Some readers may already be familiar with the material to be discussed in this section, while others may not — but the discussion is meant for both audiences. In addition to highlighting the aspects of classical information that are most relevant to an introduction to quantum information, this section introduces the Dirac notation, which is often used to describe vectors and matrices in quantum information and computation. As it turns out, the Dirac notation is not specific to quantum information: it can equally well be used in the context of classical information, as well as for many other settings in which vectors and matrices arise.
Classical states and probability vectors
Suppose that we have a that stores information. More specifically, let's assume that this system can be in one of a finite number of classical states at each instant. Here, the term "classical state" should be understood in intuitive terms, as a configuration that can be recognized and described unambiguously.
The archetypal example, which we will come back to repeatedly, is that of a bit, which is a system whose classical states are and Other examples include a standard six-sided die, whose classical states are and a nucleobase in a strand of DNA, whose classical states are A, C, G, and T; and a switch on an electric fan, whose classical states are (commonly) high, medium, low, and off. In mathematical terms, the specification of the classical states of a system are, in fact, the starting point: we define a bit to be a system that has classical states and and likewise for systems having different classical state sets.
For the sake of this discussion, let us give the name to the system being considered, and let us use the symbol to refer to the set of classical states of As well as the assumption that is finite, as mentioned earlier, we naturally assume that is nonempty: it is nonsensical for a physical system to have no states at all. Although it does make sense to consider physical systems having infinitely many classical states, we will ignore this possibility for now. There are plenty of interesting ideas to explore even within only a finite number of states. For the sake of convenience and brevity, we will hereafter use the term classical state set to mean any finite and nonempty set.
Here are a few examples:
- If is a bit, then In words, we'll refer to this set as the binary alphabet.
- If is a six-sided die, then
- If is an electric fan switch, then
When thinking about as a carrier of information, the different classical states of could be assigned certain meanings, leading to different outcomes or consequences. In such cases, it may be sufficient to describe as simply being in one of its possible classical states. For instance, if is a fan switch, we might happen to know with certainty that it is set to high.
Often in information processing, however, our knowledge of is uncertain. We represent our knowledge of the classical state of by assigning probabilities to each classical state, resulting in a probabilistic state. For example, suppose is a bit. Based on what we know or expect about what has happened to in the past, perhaps we believe that is in the classical state with probability and in the state with probability We may represent such a belief by writing this:
A more succinct way to represent this probabilistic state is by a column vector.
The probability of the bit being is placed at the top of the vector and the probability of the bit being is placed at the bottom, simply because this is the conventional way to order the set
In general, we can represent a probabilistic state of a system having any classical state set in the same way, as a vector of probabilities. The probabilities can be ordered in any way we choose — which is typically determined by some natural or default way to order the classical state set we're working with. To be precise, we can represent any probabilistic state through a column vector satisfying two properties:
- All entries of the vector are nonnegative real numbers.
- The sum of the entries is equal to
Conversely, any column vector that satisfies these two properties can be taken as a representation of a probabilistic state. Hereafter, we will refer to vectors of this form as probability vectors.
Alongside the succinctness of this notation, identifying probabilistic states as column vectors has the advantage that operations on probabilistic states are represented through matrix–vector multiplication, as will be discussed below.
Measuring probabilistic states
Now let us briefly consider what happens if we measure a system when it is in a probabilistic state. By measuring a system, we mean that we look at the system and unambiguously recognize whatever classical state it is in. Intuitively, we can never "see" a system in a probabilistic state; a measurement will yield exactly one of the allowed classical states.
Measurement changes our knowledge of the system, and therefore changes the probabilistic state that we associate with that system: if we recognize that is in the classical state then the new probability vector representing our knowledge of becomes a vector having a in the entry corresponding to and for all other entries. This vector indicates that is in the classical state with certainty, which we know having just recognized it.
We denote the vector just described, meaning the vector having a in the entry corresponding to and for all other entries, by This vector is read as "ket " for a reason that will be explained shortly. Vectors of this sort are also called standard basis vectors.
For example, assuming that the system we have in mind is a bit, the standard basis vectors are given by
Notice that any two-dimensional column vector can be expressed as a linear combination of these two vectors. For example, we have
This fact naturally generalizes to any classical state set: any column vector is a linear combination over the classical states. We will often express vectors in this way.
Returning to the change of a probabilistic state upon being measured, we may note the following connection to our everyday experiences. Suppose we flip a fair coin, but cover up the coin before looking at it. We would then say that its probabilistic state is
Here, the classical state set of our coin is We'll choose to order these states as heads first, tails second.
If we were to uncover the coin and look at it, we would see one of the two classical states: heads or tails. Supposing that the result were tails, we would naturally update our description of the probabilistic state of the coin so that it becomes Of course, if we were then to cover up the coin, and then uncover it and look at it again, the classical state would still be tails, which is consistent with the probabilistic state being described by the vector This may seem trivial, and in some sense it is. However, quantum systems behave in an entirely analogous way, yet their measurement properties are frequently considered unusual or "spooky." By establishing the measurement properties of classical systems, the analogous behavior for quantum information might seem less unusual.
One final remark concerning measurements of probabilistic states: they may describe knowledge or belief, not necessarily something actual. The state of our coin after we flip it, but before we look, is either heads or tails, and we simply don't know which until we look. Doing so doesn't actually change the state, but only our knowledge of it. Upon seeing that the classical state is tails, we naturally update our knowledge by assigning the vector to the coin, but to someone else who didn't see the coin when it was uncovered, the probabilistic state remains unchanged. This is not a cause for concern: different individuals may have different knowledge or beliefs about a particular system, and hence describe that system by different probability vectors.
Classical operations
In the last part of this brief summary of classical information, we will consider the sorts of operations one might perform on a classical system.
Deterministic operations
First, there are operations, where each classical state is transformed into for some function of the form
For example, if there are four functions of this form, and which can be represented by tables of values as follows:
The first and last of these functions are constant: and for each The middle two are not constant, they are balanced, in the sense that the two possible output values occur the same number of times as we range over the possible inputs. The function is the : for each And is the function and which is better-known as the NOT function.
The actions of deterministic operations on probabilistic states can be represented by matrix-vector multiplication. Specifically, the matrix that represents a given function is the one that satisfies
for every Such a matrix always exists and is unique.
For example, the matrices corresponding to the functions above are as follows:
Matrices that represent deterministic operations always have exactly one in each column, and for all other entries.
A convenient way to represent matrices of these and other forms makes use of an analogous notation for row vectors to the one for column vectors discussed previously. We denote by the row vector having a in the entry corresponding to and zero for all other entries, for each This vector is read as "bra "
For example, if then
For an arbitrary choice of a classical state set viewing row vectors and column vectors as matrices and performing the matrix multiplication one obtains a square matrix having a in the entry corresponding to the pair meaning that the row of the entry corresponds to and the column corresponds to and for all other entries. For example,
Using this notation, for any function we may express the matrix corresponding to the function as
Now, if we again think about vectors as matrices, but this time consider the multiplication then we obtain a matrix, which we can think about as a scalar (i.e., a number). For the sake of tidiness we write this product as rather than This product satisfies the following simple formula:
Using this observation, together with the fact that matrix multiplication is associative and linear, we obtain
for each which is what we require of
As we will discuss in greater detail in Lesson 3, may also be seen as an inner product between the vectors and Inner products are critically important in quantum information, but we will delay a discussion of them until they are needed.
At this point the names "bra" and "ket" may be evident: putting a "bra" together with a "ket" yields a "bracket" This notation and terminology is due to , and for this reason is known as the Dirac notation.
Probabilistic operations and stochastic matrices
In addition to deterministic operations, we have probabilistic operations.
For example, consider an operation on a bit where, if the classical state of the bit is it is left alone, and if the classical state of the bit is it is flipped to with probability This operation is represented by the matrix
We can check that this matrix does the correct thing by multiplying with the standard basis vectors.
For an arbitrary choice of a classical state set, we can describe the set of all probabilistic operations in mathematical terms as those that are represented by matrices, which are matrices satisfying these two properties:
- All entries are nonnegative real numbers.
- The entries in every column sum to
Equivalently, stochastic matrices are matrices whose columns all form probability vectors.
We can think about probabilistic operations at an intuitive level as ones where randomness might somehow be used or introduced during the operation, just like in the example above. With respect to the stochastic matrix description of a probabilistic operation, each column can be viewed as a vector representation of the probabilistic state that is generated given whatever classical state input corresponds to that column.
We can also think about stochastic matrices as being exactly those matrices that always map probability vectors to probability vectors. That is, stochastic matrices always map probability vectors to probability vectors, and any matrix that always maps probability vectors to probability vectors must be a stochastic matrix.
Finally, another way to think about probabilistic operations is that they are random choices of deterministic operations. For instance, we can think about the operation in the example above as applying either the identity function or the constant 0 function, each with probability This is consistent with the equation
Such an expression is always possible, for an arbitrary choice of a classical state set and any stochastic matrix with rows and columns identified with that classical state set.
Compositions of probabilistic operations
Suppose that is a system having classical state set and are stochastic matrices representing probabilistic operations on the system
If the first operation is applied to the probabilistic state represented by a probability vector the resulting probabilistic state is represented by the vector If we then apply the second probabilistic operation to this new probability vector, we obtain the probability vector
The equality follows from the fact that matrix multiplication (which includes matrix-vector multiplication as a special case) is an operation. Thus, the probabilistic operation obtained by the first and second probabilistic operations, where we first apply and then apply is represented by the matrix which is necessarily stochastic.
More generally, composing the probabilistic operations represented by the matrices in that order, meaning that is applied first, is applied second, and so on, with applied last, is represented by the matrix
Note that the ordering is important here: although matrix multiplication is associative, it is not a operation in general.
For example, if we have
then
That is, the order in which probabilistic operations are composed matters: changing the order in which operations are applied in a composition can change the resulting operation.
Quantum information
Now we move on to quantum information, where we make a different choice for the type of vector that represents a state — in this case a quantum state — of the system being considered. As in the previous section, we'll be concerned with systems having finite and nonempty sets of classical states, and we will make use of much of the notation that was introduced in that section.
Quantum state vectors
A quantum state of a system is represented by a column vector, similar to probabilistic states. As before, the indices of the vector label the classical states of the system. Vectors representing quantum states are characterized by these two properties:
- The entries of a quantum state vector are complex numbers.
- The sum of the absolute values squared of the entries of a quantum state vector is
Thus, in contrast to the probabilistic case, vectors representing quantum states need not have nonnegative real number entries, and it is the sum of the absolute values squared of the entries (as opposed to the sum of the entries) that must equal Simple as these changes are, they give rise to all the differences between quantum and classical information. Any speedup from a quantum computer, or improvement in a communication protocol, ultimately derives from these simple mathematical changes.
The Euclidean norm of a column vector
is denoted and defined as follows:
The condition that the sum of the absolute values squared of a quantum state vector equals is therefore equivalent to that vector having Euclidean norm equal to That is, quantum state vectors are unit vectors with respect to the Euclidean norm.
Examples of qubit states
The term qubit refers to a quantum system whose classical state set is That is, a qubit is really just a bit — but by using this name we explicitly recognize that this bit can be in a quantum state.
These are examples of quantum states of a qubit:
and
The first two examples, and illustrate that standard basis elements are valid quantum state vectors: their entries are complex numbers (where the imaginary part of these numbers happens to be ) and computing the sum of the absolute values squared of the entries yields
as required. Similar to the classical setting, we associate the quantum state vectors and with a qubit being in the classical state or respectively, with certainty.
For the other two examples, we again have complex number entries, and computing the sum of the absolute value squared of the entries yields
and
These are therefore valid quantum state vectors. Note that they are linear combinations of the states and We often say that these states are superpositions of the and states. Within the context of quantum states, "superposition" and "linear combination" are essentially synonymous.
The example of a qubit state vector above is very commonly encountered — it is called the plus state and is denoted as follows:
We also use the notation
to refer to a related quantum state vector where the second entry is negative rather than positive, and we call this state the minus state. This sort of notation, where some symbol other than one referring to a classical state appears inside of a ket, is common — we can use whatever name we wish inside of a ket to name a vector. Indeed, it is quite common to use the notation or other names in place of to refer to an arbitrary vector that may not necessarily be a standard basis vector.
Notice that if we have a vector whose indices correspond to some classical state set and if is an element of this classical state set, then the (matrix) product is equal to the entry of the vector whose index corresponds to As we did when is a standard basis vector, we write rather than for the sake of readability.
For example, if and
then
It must be understood when using this notation that refers to the row vector obtained by taking the conjugate-transpose of the column vector where the vector is transposed from a column vector to a row vector and each entry is replaced by its complex conjugate.
For example, if is the vector defined in then
The reason we take the complex conjugate, in addition to the transpose, will become more clear in Lesson 3 when we discuss the inner product.
Quantum states of other systems
We can consider quantum states of systems having arbitrary classical state sets.
For example, here is a quantum state vector for an electrical fan switch:
The assumption here is that the classical states are ordered as high, medium, low, off. There may be no particular reason why one would want to consider a quantum state of an electrical fan switch, but it is possible in principle.
Here's another example, this time of a quantum decimal digit whose classical states are
This example illustrates the convenience of writing state vectors using the Dirac notation. For this particular example, the column vector representation is merely cumbersome — but if there were significantly more classical states it would become unusable. The Dirac notation, in contrast, supports precise descriptions of large and complicated vectors in a compact form.
The Dirac notation also allows for the expression of vectors where different aspects of the vectors are indeterminate (meaning unknown or not yet established). For example, for an arbitrary classical state set we can consider the quantum state vector
which is a uniform superposition over the classical states in (Here, the notation refers to the number of elements in )
We'll encounter much more complicated expressions of quantum state vectors in later lessons, where the use of column vectors would be impractical or impossible. In fact, we'll mostly abandon the column vector representation of state vectors, except for vectors having a small number of entries (often in the context of examples), where it may be helpful to display and examine the entries explicitly.
There is one more reason why expressing state vectors using the Dirac notation is generally more convenient: it alleviates the need to explicitly specify an ordering of the classical states (or, equivalently, the correspondence between classical states and vector indices). For example, a quantum state vector for a system having classical state set such as
is unambiguously described by this expression, and there really is no need to choose or specify an ordering of this classical state set in order to make sense of the expression. In this case, it is not difficult to simply specify an ordering of the standard card suits — for instance, we could order them as follows: If we choose this particular ordering, the quantum state vector above would be represented by the column vector
In general, however, it is convenient to simply ignore the question of how classical state sets are ordered, and take the view that quantum state vectors are directly indexed by classical states.
Measuring quantum states
Next let us consider what happens when a quantum state is measured, focusing on a simple type of measurement known as a standard basis measurement. (There are more general notions of measurement that will be discussed later on.)
Similar to the probabilistic setting, when a system in a quantum state is measured, the observer performing the measurement won't see a quantum state vector, but rather some classical state. In this sense, measurements act as the interface between quantum and classical information, through which classical information is extracted from quantum states.
The rule is simple: if a quantum state is measured, each classical state of the system results with probability equal to the absolute value squared of the entry in the quantum state vector corresponding to that classical state. This is known as the Born rule in quantum mechanics. Notice that this rule is consistent with the requirement that the absolute values squared of the entries in a quantum state vector sum to as it implies that the probabilities of different classical state measurement outcomes sum to
For example, measuring the plus state
results in the two possible outcomes, and with probabilities as follows.
Interestingly, measuring the minus state
results in exactly the same probabilities for the two outcomes.
This suggests that, as far as standard basis measurements are concerned, the plus and minus states are exactly the same. Why should we care to make a distinction, then? We will begin to address this question in the subsection following this one.
Of course, measuring the quantum state results in the classical state with certainty, and likewise measuring the quantum state results in the classical state with certainty. This is consistent with the identification of these quantum states with the system being in the corresponding classical state, as was suggested previously.
As a final example, measuring the state
has probabilities given by
and
Unitary operations
Thus far, it may not be evident why quantum information is fundamentally different from classical information. That is, when a quantum state is measured, the probability to obtain each classical state is given by the absolute value squared of the corresponding vector entry — so why not simply record these probabilities in a probability vector?
The answer, at least in part, is that the set of allowable operations that can be performed on a quantum state is different than it is for classical information. Similar to the probabilistic setting, operations on quantum states are linear mappings — but rather than being represented by stochastic matrices as in the classical case, operations on quantum state vectors are represented by unitary matrices.
A square matrix having complex number entries is unitary if it satisfies the equations
Here, is the identity matrix, and is the conjugate transpose of meaning the matrix obtained by transposing and taking the complex conjugate of each entry.
If either of the two equalities numbered above is true, then the other must also be true. Both equalities are equivalent to being the inverse of
(Warning: if is not a square matrix, then it could be that and for instance. The equivalence of the two equalities in the first equation above is only true for square matrices.)
The condition that is unitary is equivalent to the condition that multiplication by does not change the Euclidean norm of any vector. That is, an matrix is unitary if and only if for every -dimensional column vector with complex number entries. Thus, because the set of all quantum state vectors is the same as the set of vectors having Euclidean norm equal to multiplying a unitary matrix to a quantum state vector results in another quantum state vector.
Indeed, unitary matrices are exactly the set of linear mappings which always transform quantum state vectors to other quantum state vectors. Notice here a resemblance to the classical probabilistic case, where operations are associated with stochastic matrices, which are the ones that always transform probability vectors into probability vectors.
Important examples of unitary operations on qubits
The following list describes some important unitary operations on qubits.
Pauli operations. The four Pauli matrices are as follows:
A common notation, which we will often use, is and — but be aware that the letters and are also commonly used for other purposes. The operation is also called a bit flip or a NOT operation because it induces this action on bits:
The operation is also called a phase flip because it has this action:
Hadamard operation. The Hadamard operation is described by this matrix:
Phase operations. A phase operation is one described by the matrix
for any choice of a real number The operations
are particularly important examples. Other examples include and
All of the matrices just defined are unitary, and therefore represent quantum operations on a single qubit.
For example, here is a calculation that verifies that is unitary:
Here's the action of the Hadamard operation on a few commonly encountered qubit state vectors.
It's well worth listing these four equations more succinctly.
And here's one final example for a state vector that was mentioned previously.
It's worth pausing to consider the fact that and Consider a situation in which a qubit is prepared in one of the two quantum states and but where it is not known to us which one it is. Measuring either state produces the same output distribution as the other: and both appear with equal probability So, doing this provides no information about which of the two states and was originally prepared. However, if we apply a Hadamard operation and then measure, we obtain the outcome with certainty if the original state was and we obtain the outcome again with certainty, if the original state was
Thus, the quantum states and can be discriminated perfectly. This reveals that sign changes, or more generally changes to the phases (which are also traditionally called arguments) of the complex number entries of a quantum state vector, can significantly change that state.
Here's another example, this time of the action of a operation on a plus state.
Notice here that we did not bother to convert to the equivalent matrix/vector forms, and instead used the linearity of matrix multiplication together with the formulas
Along similar lines, we may compute the result of applying a Hadamard operation to the quantum state vector just obtained:
The two approaches — one where we explicitly convert to matrix representations and the other where we use linearity and plug in the actions of an operation on standard basis states — are equivalent. We can use whichever one is more convenient in the case at hand.
Compositions of qubit unitary operations
Compositions of unitary operations are represented by matrix multiplication, just like we had in the probabilistic setting. For example, if we first apply a Hadamard operation, followed by the operation, followed by another Hadamard operation, the resulting operation (which we'll name ) is as follows:
This unitary operation is an interesting example. By applying this operation twice, which is equivalent to squaring its matrix representation, we obtain a NOT operation:
That is, is a square root of NOT operation. Such a behavior, where the same operation is applied twice to yield a NOT operation, is not possible for a classical operation on a single bit. This is related to the fact that you can't take the square root of a negative number and stay on the real line.
Unitary operations on larger systems
In later lessons, we will see many examples of unitary operations on systems having more than two classical states. An example of a unitary operation on a system having three classical states is given by the following matrix.
Assuming that the classical states of the system are and we can describe this operation as addition modulo
The matrix is an example of a permutation matrix, which is a matrix in which every row and column has exactly one Such matrices only rearrange, or permute, the entries of the vector it acts on. The identity is the simplest permutation matrix; another example is the NOT operation on a bit or qubit. Every permutation matrix, in any positive integer dimension, is unitary. These are the only examples of matrices that represent both classical and quantum operations: a matrix is both stochastic and unitary if and only if it is a permutation matrix.
Another example of a unitary matrix, this time being a matrix, is this one:
This matrix describes an operation known as the quantum Fourier transform, specifically in the case. The quantum Fourier transform can be defined more generally, for any positive integer dimension and will play a key role in the second unit of this series.
Qiskit examples
In this section we present some examples of Qiskit implementations of the concepts introduced in this lesson.
Vectors and matrices in Python
Qiskit uses the Python programming language, so before discussing Qiskit specifically it may be helpful to very briefly discuss matrix and vector computations in Python. In Python, matrix and vector computations can be performed using the
Here is an example of a code cell that defines two vectors,
Output:
array([0.5, 0.5])
It is not actually necessary to explicitly use the
Output:
array([0.5, 0.5])
This code cell also illustrates that running code cells sequentially on a given page of this textbook has a cumulative effect, so it is not necessary to reload the
As a general guideline, code cells within each subsection of this course are intended to be run sequentially. So, if running a code cell generates an error, be sure to first run all previous code cells within the subsection in which that code cell appears.
We can also use
Output:
array([[1. , 1. ],
[0.5, 0. ]])
Matrix multiplication (including matrix-vector multiplication as a special case) can be performed using the
Output:
array([1, 0])
array([[2, 1],
[0, 0]])
array([[1, 1],
[1, 1]])
States, measurements, and operations
Qiskit includes several classes that allow for states, measurements, and operations to be easily created and manipulated — so starting from scratch and programming everything that is needed to simulate quantum states, measurements, and operations in Python is not required. Some examples to get started are included below.
Defining and displaying state vectors
Qiskit's
Output:
State vectors u, v, and w have been defined.
The
Output:
[ 0.33333333+0.66666667j,-0.66666667+0.j ]
The
Output:
True
False
Simulating measurements using Statevector
Next we will see one way that measurements of quantum states can be simulated in Qiskit, using the
First, we create a qubit state vector
Output:
Code cells can be modified — so go ahead and change the specification of the vector if you wish.
Next, running the
Output:
('1',
Statevector([ 0.+0.j, -1.+0.j],
dims=(2,)))
Measurement outcomes are probabilistic, so the same method can return different results. Try running the cell a few times to see this.
For the particular example of the vector
(rather than ) or
(rather than ), depending on the measurement outcome. In both cases the alternatives are, in fact, equivalent — they are said to differ by a global phase because one is equal to the other multiplied by a complex number on the unit circle. This issue is discussed in greater detail in Lesson 3, and can safely be ignored for now.
As an aside,
Output:
{'0': 554, '1': 446}
Running the cell multiple times and trying different numbers of samples in place of may be helpful for developing some intuition for how the number of trials influences the estimated probabilities.
Performing operations with Operator and Statevector
Unitary operations can be defined and performed on state vectors in Qiskit using the
Output:
[ 0.85355339+0.35355339j,-0.35355339+0.14644661j]
Looking ahead toward quantum circuits
Quantum circuits won't be formally introduced until Lesson 3, but we can nevertheless experiment with composing qubit unitary operations using Qiskit's
Output:
The operations are applied sequentially, starting on the left and ending on the right in the figure. Let us first initialize a starting quantum state vector and then evolve that state according to the sequence of operations.
Output:
[ 0.85355339+0.35355339j,-0.35355339+0.14644661j]
Finally, let's simulate the result of running this experiment (i.e., preparing the state applying the sequence of operations represented by the circuit, and measuring) 4000 times.
Output:
Was this page helpful?