## 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 \(\complexes\) 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 \({\mathbb R}\text{.}\) 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 \(\complex{m}\text{.}\)

### 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 \(\complex{m}\) (DefinitionÂ CVA and DefinitionÂ CVSM). We can also extend the idea of the conjugate to vectors.

#### Definition CCCV. Complex Conjugate of a Column Vector.

Suppose that \(\vect{u}\) is a vector from \(\complex{m}\text{.}\) Then the conjugate of the vector, \(\conjugate{\vect{u}}\text{,}\) is defined by

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.

Suppose \(\vect{x}\) and \(\vect{y}\) are two vectors from \(\complex{m}\text{.}\) Then

#### Proof.

For each \(1\leq i\leq m\)

Then by DefinitionÂ CVE we have \(\conjugate{\vect{x}+\vect{y}}=\conjugate{\vect{x}}+\conjugate{\vect{y}}\text{.}\)

#### Theorem CRSM. Conjugation Respects Vector Scalar Multiplication.

Suppose \(\vect{x}\) is a vector from \(\complex{m}\text{,}\) and \(\alpha\in\complexes\) is a scalar. Then

#### Proof.

For \(1\leq i\leq m\)

Then by DefinitionÂ CVE we have \(\conjugate{\alpha\vect{x}}=\conjugate{\alpha}\,\conjugate{\vect{x}}\text{.}\)

These two theorems together tell us how we can â€śpushâ€ť complex conjugation through linear combinations.

### Subsection IP Inner products

#### Definition IP. Inner Product.

Given the vectors \(\vect{u},\,\vect{v}\in\complex{m}\) the inner product of \(\vect{u}\) and \(\vect{v}\) is the scalar quantity in \(\complexes\)

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 \(\complex{m}\) (rather than \({\mathbb R}^m\)).

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.

Suppose \(\vect{u},\,\vect{v},\,\vect{w}\in\complex{m}\text{.}\) Then

\(\innerproduct{\vect{u}+\vect{v}}{\vect{w}}=\innerproduct{\vect{u}}{\vect{w}}+\innerproduct{\vect{v}}{\vect{w}}\text{.}\)

\(\innerproduct{\vect{u}}{\vect{v}+\vect{w}}=\innerproduct{\vect{u}}{\vect{v}}+\innerproduct{\vect{u}}{\vect{w}}\text{.}\)

#### 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.

Suppose \(\vect{u},\,\vect{v}\in\complex{m}\) and \(\alpha\in\complexes\text{.}\) Then

\(\innerproduct{\alpha\vect{u}}{\vect{v}}=\conjugate{\alpha}\innerproduct{\vect{u}}{\vect{v}}\text{.}\)

\(\innerproduct{\vect{u}}{\alpha\vect{v}}=\alpha\innerproduct{\vect{u}}{\vect{v}}\text{.}\)

#### 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.

Suppose that \(\vect{u}\) and \(\vect{v}\) are vectors in \(\complex{m}\text{.}\) Then\(\innerproduct{\vect{u}}{\vect{v}}=\conjugate{\innerproduct{\vect{v}}{\vect{u}}}\text{.}\)

#### 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 \(c\) is a complex number, then \(\modulus{c}\) denotes its modulus (DefinitionÂ MCN).

#### Definition NV. Norm of a Vector.

The norm of the vector \(\vect{u}\) is the scalar quantity in \(\complexes\)

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.

Suppose that \(\vect{u}\) is a vector in \(\complex{m}\text{.}\) Then \(\norm{\vect{u}}^2=\innerproduct{\vect{u}}{\vect{u}}\text{.}\)

#### 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.

Suppose that \(\vect{u}\) is a vector in \(\complex{m}\text{.}\) Then \(\innerproduct{\vect{u}}{\vect{u}}\geq 0\) with equality if and only if \(\vect{u}=\zerovector\text{.}\)

#### 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 \(\innerproduct{\vect{u}}{\vect{u}}\) the result is a real number.)

The phrase, â€świth equality if and only ifâ€ť means that we want to show that the statement \(\innerproduct{\vect{u}}{\vect{u}}= 0\) (i.e. with equality) is equivalent (â€śif and only ifâ€ť) to the statement \(\vect{u}=\zerovector\text{.}\)

If \(\vect{u}=\zerovector\text{,}\) then it is a straightforward computation to see that \(\innerproduct{\vect{u}}{\vect{u}}= 0\text{.}\) In the other direction, assume that \(\innerproduct{\vect{u}}{\vect{u}}= 0\text{.}\) As before, \(\innerproduct{\vect{u}}{\vect{u}}\) 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, \(\modulus{\vectorentry{\vect{u}}{i}}=0\) will imply that \(\vectorentry{\vect{u}}{i}=0\text{,}\) since \(0+0i\) is the only complex number with zero modulus. Thus every entry of \(\vect{u}\) is zero and so \(\vect{u}=\zerovector\text{,}\) as desired.

Notice that TheoremÂ PIP contains *three* implications

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 \(10^{-16}\text{,}\) how can we be sure if it is zero or not?

Why discuss this now? What is \(\alpha=\sqrt{7/3}\text{?}\) 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 `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 \(\alpha\) above is one solution to the polynomial equation \(3x^2-7=0\) and thus is a number in `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 \(\alpha\) can be created with `QQbar(sqrt(7/3))`

and will print as `1.527525231651947`

?. Notice that complex numbers begin with the introduction of the imaginary number \(i\text{,}\) which is a root of the polynomial equation \(x^2+1=0\text{,}\) so the field of algebraic numbers contains many complex numbers. The downside of `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`

.

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.

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.

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 \(5*a\) where \(a\) is a root of the polynomial equation \(x^2-3=0\text{,}\) in other words it is \(5\sqrt{3}\text{.}\) 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 `I`

used for the imaginary number \(i\text{.}\) 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`

to its usual role.

We will finish with a verification of TheoremÂ IPN. To test equality it is best if we work with entries from `QQbar`

.

### 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.

A pair of vectors, \(\vect{u}\) and \(\vect{v}\text{,}\) from \(\complex{m}\) are orthogonal if their inner product is zero, that is, \(\innerproduct{\vect{u}}{\vect{v}}=0\text{.}\)

#### 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 \(S=\set{\vectorlist{u}{n}}\) is a set of vectors from \(\complex{m}\text{.}\) Then \(S\) is an orthogonal set if every pair of different vectors from \(S\) is orthogonal, that is \(\innerproduct{\vect{u}_i}{\vect{u}_j}=0\) whenever \(i\neq j\text{.}\)

We now define the prototypical orthogonal set, which we will reference repeatedly.

#### Definition SUV. Standard Unit Vectors.

Let \(\vect{e}_j\in\complex{m}\text{,}\) \(1\leq j\leq m\) denote the column vectors defined by

Then the set

is the set of standard unit vectors in \(\complex{m}\text{.}\)

Notice that \(\vect{e}_j\) is identical to column \(j\) of the \(m\times m\) identity matrix \(I_m\) (DefinitionÂ IM) and is a pivot column for \(I_m\text{,}\) since the identity matrix is in reduced row-echelon form. These observations will often be useful. We will reserve the notation \(\vect{e}_i\) 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 \(\vect{e}_i\text{,}\) \(\vect{e}_j\text{,}\) where \(i\neq j\)

So the set \(\set{\vectorlist{e}{m}}\) 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

\begin{align*} \innerproduct{\vect{x}_2}{\vect{x}_4}&= (1-5i)(-2-4i)+(6-5i)(6+i)+(-7+i)(4+3i)+(1+6i)(6-i)\\ &=(-22+6i)+(41-24i)+(-31-17i)+(12+35i)\\ &=0+0i\text{.} \end{align*}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.

Suppose that \(S\) is an orthogonal set of nonzero vectors. Then \(S\) is linearly independent.

#### Proof.

Let \(S=\set{\vectorlist{u}{n}}\) be an orthogonal set of nonzero vectors. To prove the linear independence of \(S\text{,}\) we can appeal to the definition (DefinitionÂ LICV) and begin with an arbitrary relation of linear dependence (DefinitionÂ RLDCV)

Then, for every \(1\leq i\leq n\text{,}\) we have

Because \(\vect{u}_i\) was assumed to be nonzero, TheoremÂ PIP says \(\innerproduct{\vect{u}_i}{\vect{u}_i}\) is nonzero and thus \(\alpha_i\) must be zero. So we conclude that \(\alpha_i=0\) for all \(1\leq i\leq n\) in any relation of linear dependence on \(S\text{.}\) But this says that \(S\) 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 \(p\) vectors, \(S\text{,}\) then we can do a number of calculations with these vectors and produce an orthogonal set of \(p\) vectors, \(T\text{,}\) so that \(\spn{S}=\spn{T}\text{.}\) 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.

Suppose that \(S=\set{\vectorlist{v}{p}}\) is a linearly independent set of vectors in \(\complex{m}\text{.}\) Define the vectors \(\vect{u}_i\text{,}\) \(1\leq i\leq p\) by

Let \(T=\set{\vectorlist{u}{p}}\text{.}\) Then \(T\) is an orthogonal set of nonzero vectors, and \(\spn{T}=\spn{S}\text{.}\)

#### Proof.

We will prove the result by using induction on \(p\) (Proof TechniqueÂ I). To begin, we prove that \(T\) has the desired properties when \(p=1\text{.}\) In this case \(\vect{u}_1=\vect{v}_1\) and \(T=\set{\vect{u}_1}=\set{\vect{v}_1}=S\text{.}\) Because \(S\) and \(T\) are equal, \(\spn{S}=\spn{T}\text{.}\) Equally trivial, \(T\) is an orthogonal set. If \(\vect{u}_1=\zerovector\text{,}\) then \(S\) would be a linearly dependent set, a contradiction.

Suppose that the theorem is true for any set of \(p-1\) linearly independent vectors. Let \(S=\set{\vectorlist{v}{p}}\) be a linearly independent set of \(p\) vectors. Then \(S^\prime=\set{\vectorlist{v}{p-1}}\) is also linearly independent. So we can apply the theorem to \(S^\prime\) and construct the vectors \(T^\prime=\set{\vectorlist{u}{p-1}}\text{.}\) \(T^\prime\) is therefore an orthogonal set of nonzero vectors and \(\spn{S^\prime}=\spn{T^\prime}\text{.}\) Define

and let \(T=T^\prime\cup\set{\vect{u}_p}\text{.}\) We need to now show that \(T\) has several properties by building on what we know about \(T^\prime\text{.}\) But first notice that the above equation has no problems with the denominators (\(\innerproduct{\vect{u}_i}{\vect{u}_i}\)) being zero, since the \(\vect{u}_i\) are from \(T^\prime\text{,}\) which is composed of nonzero vectors.

We show that \(\spn{T}=\spn{S}\text{,}\) by first establishing that \(\spn{T}\subseteq\spn{S}\text{.}\) Suppose \(\vect{x}\in\spn{T}\text{,}\) so

The term \(a_p\vect{u}_p\) is a linear combination of vectors from \(T^\prime\) and the vector \(\vect{v}_p\text{,}\) while the remaining terms are a linear combination of vectors from \(T^\prime\text{.}\) Since \(\spn{T^\prime}=\spn{S^\prime}\text{,}\) any term that is a multiple of a vector from \(T^\prime\) can be rewritten as a linear combination of vectors from \(S^\prime\text{.}\) The remaining term \(a_p\vect{v}_p\) is a multiple of a vector in \(S\text{.}\) So we see that \(\vect{x}\) can be rewritten as a linear combination of vectors from \(S\text{,}\) i.e. \(\vect{x}\in\spn{S}\text{.}\)

To show that \(\spn{S}\subseteq\spn{T}\text{,}\) begin with \(\vect{y}\in\spn{S}\text{,}\) so

Rearrange our defining equation for \(\vect{u}_p\) by solving for \(\vect{v}_p\text{.}\) Then the term \(a_p\vect{v}_p\) is a multiple of a linear combination of elements of \(T\text{.}\) The remaining terms are a linear combination of \(\vectorlist{v}{p-1}\text{,}\) hence an element of \(\spn{S^\prime}=\spn{T^\prime}\text{.}\) Thus these remaining terms can be written as a linear combination of the vectors in \(T^\prime\text{.}\) So \(\vect{y}\) is a linear combination of vectors from \(T\text{,}\) i.e. \(\vect{y}\in\spn{T}\text{.}\)

The elements of \(T^\prime\) are nonzero, but what about \(\vect{u}_p\text{?}\) Suppose to the contrary that \(\vect{u}_p=\zerovector\)

Since \(\spn{S^\prime}=\spn{T^\prime}\) we can write the vectors \(\vectorlist{u}{p-1}\) on the right side of this equation in terms of the vectors \(\vectorlist{v}{p-1}\) and we then have the vector \(\vect{v}_p\) expressed as a linear combination of the other \(p-1\) vectors in \(S\text{,}\) implying that \(S\) is a linearly dependent set (TheoremÂ DLDS), contrary to our lone hypothesis about \(S\text{.}\)

Finally, it is a simple matter to establish that \(T\) 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 \(T^\prime\) is an orthogonal set by induction, most pairs of elements in \(T\) are already known to be orthogonal. We just need to test â€śnewâ€ť inner products, between \(\vect{u}_p\) and \(\vect{u}_i\text{,}\) for \(1\leq i\leq p-1\text{.}\) 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 \(\spn{T}=\spn{S}\) (all by TheoremÂ GSP). Of course, as a by-product of orthogonality, the set \(T\) is also linearly independent (TheoremÂ OSLI).

One final definition related to orthogonal vectors.

#### Definition ONS. OrthoNormal Set.

Suppose \(S=\set{\vectorlist{u}{n}}\) is an orthogonal set of vectors such that \(\norm{\vect{u}_i}=1\) for all \(1\leq i\leq n\text{.}\) Then \(S\) is an orthonormal set of vectors.

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.

The set

from ExampleÂ GSTV is an orthogonal set.

We compute the norm of each vector

Converting each vector to a norm of \(1\text{,}\) 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.

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.

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.

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.

Notice that we asked for orthonormal output, so the rows of `G`

are the vectors \(\set{\vect{w}_1,\,\vect{w}_2,\,\vect{w}_3}\) in ExampleÂ ONTV. Exactly. We can restrict ourselves to `QQ`

and forego the â€śnormalityâ€ť to obtain just the orthogonal set \(\set{\vect{u}_1,\,\vect{u}_2,\,\vect{u}_3}\) of ExampleÂ GSTV.

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.

### Reading Questions O Reading Questions

#### 1.

Is the set

an orthogonal set? Why?

#### 2.

What is the distinction between an orthogonal set and an orthonormal set?

#### 3.

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.

Verify that the set \(T\) created in ExampleÂ GSTV by the Gram-Schmidt Procedure is an orthogonal set.

#### M60.

Suppose that \(\set{\vect{u},\,\vect{v},\,\vect{w}}\subseteq\complex{n}\) is an orthonormal set. Prove that \(\vect{u}+\vect{v}\) is not orthogonal to \(\vect{v}+\vect{w}\text{.}\)

#### T10.

Prove part 2 of the conclusion of TheoremÂ IPVA.

#### T11.

Prove part 2 of the conclusion of TheoremÂ IPSM.

#### T20.

Suppose that \(\vect{u},\,\vect{v},\,\vect{w}\in\complex{n}\text{,}\) \(\alpha,\,\beta\in\complexes\) and \(\vect{u}\) is orthogonal to both \(\vect{v}\) and \(\vect{w}\text{.}\) Prove that \(\vect{u}\) is orthogonal to \(\alpha\vect{v}+\beta\vect{w}\text{.}\)

Vectors are orthogonal if their inner product is zero (DefinitionÂ OV), so we compute

So by DefinitionÂ OV, \(\vect{u}\) and \(\alpha\vect{v}+\beta\vect{w}\) are an orthogonal pair of vectors.

#### T30.

Suppose that the set \(S\) in the hypothesis of TheoremÂ GSP is not just linearly independent, but is also orthogonal. Prove that the set \(T\) created by the Gram-Schmidt procedure is equal to \(S\text{.}\) (Note that we are getting a stronger conclusion than \(\spn{T}=\spn{S}\) â€” the conclusion is that \(T=S\text{.}\)) In other words, it is pointless to apply the Gram-Schmidt procedure to a set that is already orthogonal.

#### T31.

Suppose that the set \(S\) is linearly independent. Apply the Gram-Schmidt procedure (TheoremÂ GSP) twice, creating first the linearly independent set \(T_1\) from \(S\text{,}\) and then creating \(T_2\) from \(T_1\text{.}\) As a consequence of ExerciseÂ O.T30, prove that \(T_1=T_2\text{.}\) In other words, it is pointless to apply the Gram-Schmidt procedure twice.