Section O Orthogonality
In this section we define a couple more operations with vectors, and prove a few theorems. At first blush these definitions and results will not appear central to what follows, but we will make use of them at key points in the remainder of the course (such as Section MINM, Section OD). Because we have chosen to use as our set of scalars, this subsection is a bit more, uh, … complex than it would be for the real numbers. We will explain as we go along how things get easier for the real numbers If you have not already, now would be a good time to review some of the basic properties of arithmetic with complex numbers described in Section CNO. With that done, we can extend the basics of complex number arithmetic to our study of vectors in
Subsection CAV Complex Arithmetic and Vectors
We know how the addition and multiplication of complex numbers is employed in defining the operations for vectors in (Definition CVA and Definition CVSM). We can also extend the idea of the conjugate to vectors.
With this definition we can show that the conjugate of a column vector behaves as we would expect with regard to vector addition and scalar multiplication.
Theorem CRVA. Conjugation Respects Vector Addition.
Proof.
For each
Then by Definition CVE we have
Theorem CRSM. Conjugation Respects Vector Scalar Multiplication.
Proof.
For
Then by Definition CVE we have
These two theorems together tell us how we can “push” complex conjugation through linear combinations.
Subsection IP Inner products
Definition IP. Inner Product.
This operation is a bit different in that we begin with two vectors but produce a scalar. Computing one is straightforward.
Example CSIP. Computing some inner products.
The inner product of
is
The inner product of
is
In the case where the entries of our vectors are all real numbers (as in the second part of Example CSIP), the computation of the inner product may look familiar and be known to you as a dot product or scalar product. So you can view the inner product as a generalization of the scalar product to vectors from (rather than ).
Note that we have chosen to conjugate the entries of the first vector listed in the inner product, while it is almost equally feasible to conjugate entries from the second vector instead. In particular, prior to Version 2.90, we did use the latter definition, and this has now changed to the former, with resulting adjustments propogated up through Section CB (only). However, conjugating the first vector leads to much nicer formulas for certain matrix decompositions and also shortens some proofs.
There are several quick theorems we can now prove, and they will each be useful later.
Theorem IPVA. Inner Product and Vector Addition.
Proof.
The proofs of the two parts are very similar, with the second one requiring just a bit more effort due to the conjugation that occurs. We will prove part 1 and you can prove part 2 (Exercise O.T10).
Theorem IPSM. Inner Product and Scalar Multiplication.
Proof.
The proofs of the two parts are very similar, with the second one requiring just a bit more effort due to the conjugation that occurs. We will prove part 1 and you can prove part 2 (Exercise O.T11).
Theorem IPAC. Inner Product is Anti-Commutative.
Proof.
Subsection N Norm
If treating linear algebra in a more geometric fashion, the length of a vector occurs naturally, and is what you would expect from its name. With complex numbers, we will define a similar function. Recall that if is a complex number, then denotes its modulus (Definition MCN).
Definition NV. Norm of a Vector.
Computing a norm is also easy to do.
Example CNSV. Computing the norm of some vectors.
The norm of
is
The norm of
is
Notice how the norm of a vector with real number entries is just the length of the vector. Inner products and norms are related by the following theorem.
Theorem IPN. Inner Products and Norms.
Proof.
When our vectors have entries only from the real numbers Theorem IPN says that the dot product of a vector with itself is equal to the length of the vector squared.
Theorem PIP. Positive Inner Products.
Proof.
From the proof of Theorem IPN we see that
Since each modulus is squared, every term is positive, and the sum must also be positive. (Notice that in general the inner product is a complex number and cannot be compared with zero, but in the special case of the result is a real number.)
The phrase, “with equality if and only if” means that we want to show that the statement (i.e. with equality) is equivalent (“if and only if”) to the statement
If then it is a straightforward computation to see that In the other direction, assume that As before, is a sum of moduli. So we have
Now we have a sum of squares equaling zero, so each term must be zero. Then by similar logic, will imply that since is the only complex number with zero modulus. Thus every entry of is zero and so as desired.
The results contained in Theorem PIP are summarized by saying “the inner product is positive definite.”
Sage EVIC. Exact Versus Inexact Computations.
We are now at a crossroads in our use of Sage. So far our computations have involved rational numbers: fractions of two integers. Sage is able to work with integers of seemingly unlimited size, and then can work with rational numbers exactly. So all of our computations have been exactly correct so far. In practice, many computations, especially those that originate with data, are not so precise. Then we represent real numbers by floating point numbers. Since the real numbers are infinite, finite computers must fake it with an extremely large, but still finite, collection of numbers. The price we pay is that some computations will be just slightly imprecise when there is no number available that represents the exact answer.
You should now appreciate two problems that occur. If we were to row-reduce a matrix with floating point numbers, there are potentially many computations and if a small amount of imprecision arises in each one, these errors can accumulate and lead to wildly incorrect answers. When we row-reduce a matrix, whether or not an entry is zero or not is critically important in the decisions we make about which row operation to perform. If we have an extremely small number, such as how can we be sure if it is zero or not?
Why discuss this now? What is Hard to say exactly, but it is definitely not a rational number. Norms of vectors will feature prominently in all our discussions about orthogonal vectors, so we now have to recognize the need to work with square roots properly. We have two strategies in Sage.
The number system above is one solution to the polynomial equation and thus is a number in can be created with which is a root of the polynomial equation so the field of algebraic numbers contains many complex numbers. The downside of
QQbar
, also known as the field of algebraic numbers, is a truly amazing feature of Sage. It contains the rational numbers, plus every root of every polynomial with coefficients that are rational numbers. For example, notice that QQbar
, so Sage can work with it exactly. These numbers are called “algebraic numbers” and you can recognize them since they print with a question mark near the end to remind you that when printed as a decimal they are approximations of numbers that Sage carries internally as exact quantities. For example QQbar(sqrt(7/3))
and will print as 1.527525231651947?
. Notice that complex numbers begin with the introduction of the imaginary number QQbar
is that computations are slow (relatively speaking), so this number system is most useful for examples and demonstrations.The other strategy is to work strictly with approximate numbers, cognizant of the potential for inaccuracies. Sage has two such number systems:
RDF
and CDF
, which are comprised of double precision floating point numbers, first limited to just the reals, then expanded to the complexes. Double-precision refers to the use of 64 bits to store the sign, mantissa and exponent in the representation of a real number. This gives 53 bits of precision. Do not confuse these fields with RR
and CC
, which are similar in appearance but very different in implementation. Sage has implementations of several computations designed exclusively for RDF
and CDF
, such as the norm. And they are very, very fast. But some computations, like echelon form, can be wildly unreliable with these approximate numbers. We will have more to say about this as we go. In practice, you can use CDF
, since RDF
is a subset and only different in very limited cases.In summary,
QQbar
is an extension of QQ
which allows exact computations, but can be slow for large examples. RDF
and CDF
are fast, with special algorithms to control much of the imprecision in some, but not all, computations. So we need to be vigilant and skeptical when we work with these approximate numbers. We will use both strategies, as appropriate.
Sage CNIP. Conjugates, Norms and Inner Products.
Conjugates, of complex numbers and of vectors, are straightforward, in
QQbar
or in CDF
.xxxxxxxxxx
alpha = QQbar(2 + 3*I)
alpha.conjugate()
xxxxxxxxxx
beta = CDF(2+3*I)
beta.conjugate()
xxxxxxxxxx
v = vector(QQbar, [5-3*I, 2+6*I])
v.conjugate()
xxxxxxxxxx
w = vector(CDF, [5-3*I, 2+6*I])
w.conjugate()
The term inner product means slightly different things to different people. For some, it is the dot product that you may have seen in a calculus or physics course. Our inner product could be called the Hermitian inner product to emphasize the use of vectors over the complex numbers and conjugating some of the entries. So Sage has a
.dot_product()
, .inner_product()
, and .hermitian_inner_product()
— we want to use the last one.From now on, when we mention an inner product in the context of using Sage, we will mean
.hermitian_inner_product()
. We will redo the first part of Example CSIP. Notice that the syntax is a bit asymmetric.xxxxxxxxxx
u = vector(QQbar, [2+3*I, 5+2*I, -3+I])
v = vector(QQbar, [1+2*I, -4+5*I, 5*I])
u.hermitian_inner_product(v)
Norms are as easy as conjugates. Easier maybe. It might be useful to realize that Sage uses entirely distinct code to compute an exact norm over
QQbar
versus an approximate norm over CDF
, though that is totally transparent as you issue commands. Here is Example CNSV reprised.xxxxxxxxxx
entries = [3+2*I, 1-6*I, 2+4*I, 2+I]
u = vector(QQbar, entries)
u.norm()
xxxxxxxxxx
u = vector(CDF, entries)
u.norm()
xxxxxxxxxx
numerical_approx(5*sqrt(3), digits = 30)
We have three different numerical approximations, the latter 30-digit number being an approximation to the answer in the text. But there is no inconsistency between them. The first, an algebraic number, is represented internally as where is a root of the polynomial equation in other words it is The
CDF
value prints with a few digits less than what is carried internally. Notice that our different definitions of the inner product make no difference in the computation of a norm.One warning now that we are working with complex numbers. It is easy to “clobber” the symbol In other words, Sage will allow you to assign it to something else, rendering it useless. An identity matrix is a likely reassignment. If you run the next compute cell, be sure to evaluate the compute cell afterward to restore
I
used for the imaginary number I
to its usual role.xxxxxxxxxx
alpha = QQbar(5 - 6*I)
I = identity_matrix(2)
beta = QQbar(2+5*I)
xxxxxxxxxx
restore()
I^2
We will finish with a verification of Theorem IPN. To test equality it is best if we work with entries from
QQbar
.xxxxxxxxxx
v = vector(QQbar, [2-3*I, 9+5*I, 6+2*I, 4-7*I])
v.hermitian_inner_product(v) == v.norm()^2
Subsection OV Orthogonal Vectors
Orthogonal is a generalization of perpendicular. You may have used mutually perpendicular vectors in a physics class, or you may recall from a calculus class that perpendicular vectors have a zero dot product. We will now extend these ideas into the realm of higher dimensions and complex scalars.
Definition OV. Orthogonal Vectors.
Example TOV. Two orthogonal vectors.
The vectors
are orthogonal since
We extend this definition to whole sets by requiring vectors to be pairwise orthogonal. Despite using the same word, careful thought about what objects you are using will eliminate any source of confusion.
Definition OSV. Orthogonal Set of Vectors.
Suppose that is a set of vectors from Then is an orthogonal set if every pair of different vectors from is orthogonal, that is whenever
We now define the prototypical orthogonal set, which we will reference repeatedly.
Definition SUV. Standard Unit Vectors.
Notice that is identical to column of the identity matrix (Definition IM) and is a pivot column for since the identity matrix is in reduced row-echelon form. These observations will often be useful. We will reserve the notation for these vectors. It is not hard to see that the set of standard unit vectors is an orthogonal set.
Example SUVOS. Standard Unit Vectors are an Orthogonal Set.
Compute the inner product of two distinct vectors from the set of standard unit vectors (Definition SUV), say where
So the set is an orthogonal set.
Example AOS. An orthogonal set.
The set
is an orthogonal set.
Since the inner product is anti-commutative (Theorem IPAC) we can test pairs of different vectors in any order. If the result is zero, then it will also be zero if the inner product is computed in the opposite order. This means there are six different pairs of vectors to use in an inner product computation. We will do two and you can practice your inner products on the other four.
and
So far, this section has seen lots of definitions, and lots of theorems establishing un-surprising consequences of those definitions. But here is our first theorem that suggests that inner products and orthogonal vectors have some utility. It is also one of our first illustrations of how to arrive at linear independence as the conclusion of a theorem.
Theorem OSLI. Orthogonal Sets are Linearly Independent.
Proof.
Let be an orthogonal set of nonzero vectors. To prove the linear independence of we can appeal to the definition (Definition LICV) and begin with an arbitrary relation of linear dependence (Definition RLDCV)
Then, for every we have
Because was assumed to be nonzero, Theorem PIP says is nonzero and thus must be zero. So we conclude that for all in any relation of linear dependence on But this says that is a linearly independent set since the only way to form a relation of linear dependence is the trivial way (Definition LICV). Boom!
Subsection GSP Gram-Schmidt Procedure
The Gram-Schmidt Procedure is really a theorem. It says that if we begin with a linearly independent set of vectors, then we can do a number of calculations with these vectors and produce an orthogonal set of vectors, so that Given the large number of computations involved, it is indeed a procedure to do all the necessary computations, and it is best employed on a computer. However, it also has value in proofs where we may on occasion wish to replace a linearly independent set by an orthogonal set.
This is our first occasion to use the technique of mathematical induction for a proof, a technique we will see again several times, especially in Chapter D. So study the simple example described in Proof Technique I first.
Theorem GSP. Gram-Schmidt Procedure.
Proof.
We will prove the result by using induction on (Proof Technique I). To begin, we prove that has the desired properties when In this case and Because and are equal, Equally trivial, is an orthogonal set. If then would be a linearly dependent set, a contradiction.
Suppose that the theorem is true for any set of linearly independent vectors. Let be a linearly independent set of vectors. Then is also linearly independent. So we can apply the theorem to and construct the vectors is therefore an orthogonal set of nonzero vectors and Define
and let We need to now show that has several properties by building on what we know about But first notice that the above equation has no problems with the denominators ( ) being zero, since the are from which is composed of nonzero vectors.
We show that by first establishing that Suppose so
The term is a linear combination of vectors from and the vector while the remaining terms are a linear combination of vectors from Since any term that is a multiple of a vector from can be rewritten as a linear combination of vectors from The remaining term is a multiple of a vector in So we see that can be rewritten as a linear combination of vectors from i.e.
To show that begin with so
Rearrange our defining equation for by solving for Then the term is a multiple of a linear combination of elements of The remaining terms are a linear combination of hence an element of Thus these remaining terms can be written as a linear combination of the vectors in So is a linear combination of vectors from i.e.
The elements of are nonzero, but what about Suppose to the contrary that
Since we can write the vectors on the right side of this equation in terms of the vectors and we then have the vector expressed as a linear combination of the other vectors in implying that is a linearly dependent set (Theorem DLDS), contrary to our lone hypothesis about
Finally, it is a simple matter to establish that is an orthogonal set, though it will not appear so simple looking. Think about your objects as you work through the following — what is a vector and what is a scalar. Since is an orthogonal set by induction, most pairs of elements in are already known to be orthogonal. We just need to test “new” inner products, between and for Here we go, using summation notation
Example GSTV. Gram-Schmidt of three vectors.
We will illustrate the Gram-Schmidt process with three vectors. Begin with the linearly independent (check this!) set
Then
and
is an orthogonal set (which you can check) of nonzero vectors and (all by Theorem GSP). Of course, as a by-product of orthogonality, the set is also linearly independent (Theorem OSLI).
One final definition related to orthogonal vectors.
Definition ONS. OrthoNormal Set.
Once you have an orthogonal set, it is easy to convert it to an orthonormal set — multiply each vector by the reciprocal of its norm, and the resulting vector will have norm 1. This scaling of each vector will not affect the orthogonality properties (apply Theorem IPSM).
Example ONTV. Orthonormal set, three vectors.
We compute the norm of each vector
Converting each vector to a norm of yields an orthonormal set
Example ONFV. Orthonormal set, four vectors.
As an exercise convert the linearly independent set
to an orthogonal set via the Gram-Schmidt Process (Theorem GSP) and then scale the vectors to norm 1 to create an orthonormal set. You should get the same set you would if you scaled the orthogonal set of Example AOS to become an orthonormal set.
We will see orthonormal sets again in Subsection MINM.UM. They are intimately related to unitary matrices (Definition UM) through Theorem CUMOS. Some of the utility of orthonormal sets is captured by Theorem COB in Subsection B.OBC. Orthonormal sets appear once again in Section OD where they are key in orthonormal diagonalization.
Sage OGS. Orthogonality and Gram-Schmidt.
It is easy enough to check a pair of vectors for orthogonality (is the inner product zero?). To check that a set is orthogonal, we just need to do this repeatedly. This is a redo of Example AOS.
xxxxxxxxxx
x1 = vector(QQbar, [ 1+I, 1, 1-I, I])
x2 = vector(QQbar, [ 1+5*I, 6+5*I, -7-I, 1-6*I])
x3 = vector(QQbar, [-7+34*I, -8-23*I, -10+22*I, 30+13*I])
x4 = vector(QQbar, [ -2-4*I, 6+I, 4+3*I, 6-I])
S = [x1, x2, x3, x4]
ips = [S[i].hermitian_inner_product(S[j])
for i in range(3) for j in range(i+1,3)]
all([ip == 0 for ip in ips])
Notice how the list comprehension computes each pair just once, and never checks the inner product of a vector with itself. If we wanted to check that a set is orthonormal, the “normal” part is less involved. We will check the set above, even though we can clearly see that the four vectors are not even close to being unit vectors. Be sure to run the above definitions of
S
before running the next compute cell.xxxxxxxxxx
ips = [S[i].hermitian_inner_product(S[i]) for i in range(3)]
all([ip == 1 for ip in ips])
Applying the Gram-Schmidt procedure to a set of vectors is the type of computation that a program like Sage is perfect for. Gram-Schmidt is implemented as a method for matrices, where we interpret the rows of the matrix as the vectors in the original set. The result is two matrices, where the first has rows that are the orthogonal vectors. The second matrix has rows that provide linear combinations of the orthogonal vectors that equal the original vectors. The original vectors do not need to form a linearly independent set, and when the set is linearly dependent, then zero vectors produced are not part of the returned set.
Over
CDF
the set is automatically orthonormal, and since a different algorithm is used (to help control the imprecisions), the results will look different than what would result from Theorem GSP. We will illustrate with the vectors from Example GSTV.xxxxxxxxxx
v1 = vector(CDF, [ 1, 1+I, 1])
v2 = vector(CDF, [-I, 1, 1+I])
v3 = vector(CDF, [ 0, I, I])
A = matrix([v1,v2,v3])
G, M = A.gram_schmidt()
G.round(5)
We formed the matrix A with the three vectors as rows, and of the two outputs we are interested in the first one, whose rows form the orthonormal set. We round the numbers to 5 digits, just to make the result fit nicely on your screen. Let us do it again, now exactly over
QQbar
. We will output the entries of the matrix as list, working across rows first, so it fits nicely.xxxxxxxxxx
v1 = vector(QQbar, [ 1, 1+I, 1])
v2 = vector(QQbar, [-I, 1, 1+I])
v3 = vector(QQbar, [ 0, I, I])
A = matrix([v1,v2,v3])
G, M = A.gram_schmidt(orthonormal=True)
Sequence(G.list(), cr=True)
Notice that we asked for orthonormal output, so the rows of in Example ONTV. Exactly. We can restrict ourselves to of Example GSTV.
G
are the vectors QQ
and forego the “normality” to obtain just the orthogonal set xxxxxxxxxx
v1 = vector(QQbar, [ 1, 1+I, 1])
v2 = vector(QQbar, [-I, 1, 1+I])
v3 = vector(QQbar, [ 0, I, I])
A = matrix([v1, v2, v3])
G, M = A.gram_schmidt(orthonormal=False)
Sequence(G.list(), cr=True)
Notice that it is an error to ask for an orthonormal set over
QQ
since you cannot expect to take square roots of rationals and stick with rationals.xxxxxxxxxx
v1 = vector(QQ, [1, 1])
v2 = vector(QQ, [2, 3])
A = matrix([v1,v2])
G, M = A.gram_schmidt(orthonormal=True)
Reading Questions O Reading Questions
1. Given set orthogonal?
2. Orthogonal vs orthonormal.
What is the distinction between an orthogonal set and an orthonormal set?
3. Output of Gram-Schmidt process.
What is nice about the output of the Gram-Schmidt process?
Exercises O Exercises
C20.
Complete Example AOS by verifying that the four remaining inner products are zero.
C21.
M60.
T10.
Prove part 2 of the conclusion of Theorem IPVA.
T11.
Prove part 2 of the conclusion of Theorem IPSM.
T20.
Solution.
Vectors are orthogonal if their inner product is zero (Definition OV), so we compute
T21.
Solution.
Vectors are orthogonal if their inner product is zero (Definition OV), so we compute
So by Definition OV, and are an orthogonal pair of vectors. Notice how this proof uses theorems about vectors, and never considers individual entries of those vectors.
T30.
Suppose that the set in the hypothesis of Theorem GSP is not just linearly independent, but is also orthogonal. Prove that the set created by the Gram-Schmidt procedure is equal to (Note that we are getting a stronger conclusion than — the conclusion is that ) In other words, it is pointless to apply the Gram-Schmidt procedure to a set that is already orthogonal.
T31.
Suppose that the set is linearly independent. Apply the Gram-Schmidt procedure (Theorem GSP) twice, creating first the linearly independent set from and then creating from As a consequence of Exercise O.T30, prove that In other words, it is pointless to apply the Gram-Schmidt procedure twice.
You have attempted 1 of 4 activities on this page.