# fcla / src / section-O.xml

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 
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 , ). 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'll explain as we go along how things get easier for the real numbers ${\mathbb R}$. If you haven't already, now would be a good time to review some of the basic properties of arithmetic with complex numbers described in . With that done, we can extend the basics of complex number arithmetic to our study of vectors in $\complex{m}$.

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}$ ( and ). We can also extend the idea of the conjugate to vectors.

Complex Conjugate of a Column Vector

Suppose that $\vect{u}$ is a vector from $\complex{m}$. Then the conjugate of the vector, $\conjugate{\vect{u}}$, is defined by \vectorentry{\conjugate{\vect{u}}}{i}

Complex Conjugate of a Column Vector $\conjugate{\vect{u}}$

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.

Suppose $\vect{x}$ and $\vect{y}$ are two vectors from $\complex{m}$. Then \conjugate{\vect{x}+\vect{y}}=\conjugate{\vect{x}}+\conjugate{\vect{y}}

For each $1\leq i\leq m$, \vectorentry{\conjugate{\vect{x}+\vect{y}}}{i} \text{}\\ \text{}\\ \text{}\\ \text{}\\ \text{}

Then by we have $\conjugate{\vect{x}+\vect{y}}=\conjugate{\vect{x}}+\conjugate{\vect{y}}$.

Conjugation Respects Vector Scalar Multiplication

Suppose $\vect{x}$ is a vector from $\complex{m}$, and $\alpha\in\complexes$ is a scalar. Then \conjugate{\alpha\vect{x}}=\conjugate{\alpha}\,\conjugate{\vect{x}}

For $1\leq i\leq m$, \vectorentry{\conjugate{\alpha\vect{x}}}{i} \text{}\\ \text{}\\ \text{}\\ \text{}\\ \text{}\\

Then by we have $\conjugate{\alpha\vect{x}}=\conjugate{\alpha}\,\conjugate{\vect{x}}$.

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

Inner products 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 $\complex{\null}$, \innerproduct{\vect{u}}{\vect{v}}= \conjugate{\vectorentry{\vect{u}}{1}}\vectorentry{\vect{v}}{1}+ \conjugate{\vectorentry{\vect{u}}{2}}\vectorentry{\vect{v}}{2}+ \conjugate{\vectorentry{\vect{u}}{3}}\vectorentry{\vect{v}}{3}+ \cdots+ \conjugate{\vectorentry{\vect{u}}{m}}\vectorentry{\vect{v}}{m} = \sum_{i=1}^{m}\conjugate{\vectorentry{\vect{u}}{i}}\vectorentry{\vect{v}}{i}

Inner Product $\innerproduct{\vect{u}}{\vect{v}}$

This operation is a bit different in that we begin with two vectors but produce a scalar. Computing one is straightforward.

Computing some inner products

The inner product of \vect{v}=\colvector{1+2i\\-4+5i\\0+5i} is \innerproduct{\vect{u}}{\vect{v}}

The inner product of \vect{x}=\colvector{3\\1\\0\\-1\\-2} is (\conjugate{2})3+(\conjugate{4})1+(\conjugate{-3})0+(\conjugate{2})(-1)+(\conjugate{8})(-2)\\

In the case where the entries of our vectors are all real numbers (as in the second part of ), 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 (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.

Suppose $\vect{u},\,\vect{v},\,\vect{w}\in\complex{m}$. Then

1. $\innerproduct{\vect{u}+\vect{v}}{\vect{w}}=\innerproduct{\vect{u}}{\vect{w}}+\innerproduct{\vect{v}}{\vect{w}}$
2. $\innerproduct{\vect{u}}{\vect{v}+\vect{w}}=\innerproduct{\vect{u}}{\vect{v}}+\innerproduct{\vect{u}}{\vect{w}}$

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 (). \innerproduct{\vect{u}+\vect{v}}{\vect{w}} \text{}\\ \vectorentry{\vect{v}}{i}}\right)\vectorentry{\vect{w}}{i} \text{}\\ \conjugate{\vectorentry{\vect{v}}{i}}\right)\vectorentry{\vect{w}}{i} \text{}\\ + \conjugate{\vectorentry{\vect{v}}{i}}\vectorentry{\vect{w}}{i} \text{}\\ +\sum_{i=1}^{m}\conjugate{\vectorentry{\vect{v}}{i}}\vectorentry{\vect{w}}{i} \text{}\\ \text{}

Inner Product and Scalar Multiplication

Suppose $\vect{u},\,\vect{v}\in\complex{m}$ and $\alpha\in\complex{\null}$. Then

1. $\innerproduct{\alpha\vect{u}}{\vect{v}}=\conjugate{\alpha}\innerproduct{\vect{u}}{\vect{v}}$
2. $\innerproduct{\vect{u}}{\alpha\vect{v}}=\alpha\innerproduct{\vect{u}}{\vect{v}}$

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 (). \innerproduct{\alpha\vect{u}}{\vect{v}} \text{}\\ \text{}\\ \text{}\\ \text{}\\ \text{}

Inner Product is Anti-Commutative

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

\innerproduct{\vect{u}}{\vect{v}} \text{}\\ \text{}\\ \text{}\\ \text{}\\ \text{}\\ \text{}\\

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 ().

Norm of a Vector

The norm of the vector $\vect{u}$ is the scalar quantity in $\complex{\null}$ \norm{\vect{u}}= \sqrt{ \modulus{\vectorentry{\vect{u}}{1}}^2+ \modulus{\vectorentry{\vect{u}}{2}}^2+ \modulus{\vectorentry{\vect{u}}{3}}^2+ \cdots+ \modulus{\vectorentry{\vect{u}}{m}}^2 } = \sqrt{\sum_{i=1}^{m}\modulus{\vectorentry{\vect{u}}{i}}^2}

Norm of a Vector $\norm{\vect{v}}$

Computing a norm is also easy to do.

Computing the norm of some vectors

The norm of \vect{u}=\colvector{3+2i\\1-6i\\2+4i\\2+i} is \sqrt{\modulus{3+2i}^2+\modulus{1-6i}^2+\modulus{2+4i}^2+\modulus{2+i}^2}\\

The norm of \vect{v}=\colvector{3\\-1\\2\\4\\-3} is \norm{\vect{v}}= \sqrt{\modulus{3}^2+\modulus{-1}^2+\modulus{2}^2+\modulus{4}^2+\modulus{-3}^2} =\sqrt{3^2+1^2+2^2+4^2+3^2}=\sqrt{39}.

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.

Inner Products and Norms

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

\norm{\vect{u}}^2 \text{}\\ \text{Definition of square root}\\ \text{}\\ \text{}

When our vectors have entries only from the real numbers says that the dot product of a vector with itself is equal to the length of the vector squared.

Positive Inner Products

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

From the proof of we see that \innerproduct{\vect{u}}{\vect{u}} = \modulus{\vectorentry{\vect{u}}{1}}^2+ \modulus{\vectorentry{\vect{u}}{2}}^2+ \modulus{\vectorentry{\vect{u}}{3}}^2+ \cdots+ \modulus{\vectorentry{\vect{u}}{m}}^2

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$ ( with equality) is equivalent (if and only if) to the statement $\vect{u}=\zerovector$.

If $\vect{u}=\zerovector$, then it is a straightforward computation to see that $\innerproduct{\vect{u}}{\vect{u}}= 0$. In the other direction, assume that $\innerproduct{\vect{u}}{\vect{u}}= 0$. As before, $\innerproduct{\vect{u}}{\vect{u}}$ is a sum of moduli. So we have 0=\innerproduct{\vect{u}}{\vect{u}}= \modulus{\vectorentry{\vect{u}}{1}}^2+ \modulus{\vectorentry{\vect{u}}{2}}^2+ \modulus{\vectorentry{\vect{u}}{3}}^2+ \cdots+ \modulus{\vectorentry{\vect{u}}{m}}^2

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$, since $0+0i$ is the only complex number with zero modulus. Thus every entry of $\vect{u}$ is zero and so $\vect{u}=\zerovector$, as desired.

Notice that contains three implications:

The results contained in are summarized by saying the inner product is positive definite.

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

Why discuss this now? What is $\alpha=\sqrt{\frac{7}{3}}$? 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$, which is a root of the polynomial equation $x^2+1=0$, 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.
Conjugates, Norms and Inner Products Conjugates, of complex numbers and of vectors, are straightforward, in QQbar or in CDF. alpha = QQbar(2 + 3*I) alpha.conjugate() 2 - 3*I beta = CDF(2+3*I) beta.conjugate() 2.0 - 3.0*I v = vector(QQbar, [5-3*I, 2+6*I]) v.conjugate() (5 + 3*I, 2 - 6*I) w = vector(CDF, [5-3*I, 2+6*I]) w.conjugate() (5.0 + 3.0*I, 2.0 - 6.0*I) 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.

Furthermore, Sage defines the Hermitian inner product by conjugating entries from the first vector, rather than the second vector as defined in the text. This is not as big a problem as it might seem. First, , tells us that we can counteract a difference in order by just taking the conjugate, so you can translate between Sage and the text by taking conjugates of results achieved from a Hermitian inner product. Second, we will mostly be interested in when a Hermitian inner product is zero, which is its own conjugate, so no adjustment is required. Third, most theorems are true as stated with either definition, although there are exceptions, like .

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 . Notice that the syntax is a bit asymmetric. 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) 3 + 19*I Again, notice that the result is the conjugate of what we have in the text.

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 reprised. entries = [3+2*I, 1-6*I, 2+4*I, 2+I] u = vector(QQbar, entries) u.norm() 8.66025403784439? u = vector(CDF, entries) u.norm() 8.66025403784 numerical_approx(5*sqrt(3), digits = 30) 8.66025403784438646763723170753 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$, in other words it is $5\sqrt{3}$. 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$. 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. alpha = QQbar(5 - 6*I) I = identity_matrix(2) beta = QQbar(2+5*I) Traceback (most recent call last): ... TypeError: Illegal initializer for algebraic number restore() I^2 -1 We will finish with a verification of . To test equality it is best if we work with entries from QQbar. v = vector(QQbar, [2-3*I, 9+5*I, 6+2*I, 4-7*I]) v.hermitian_inner_product(v) == v.norm()^2 True
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.

Orthogonal Vectors

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

Two orthogonal vectors

The vectors are orthogonal since \innerproduct{\vect{u}}{\vect{v}}

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.

Orthogonal Set of Vectors

Suppose that $S=\set{\vectorlist{u}{n}}$ is a set of vectors from $\complex{m}$. 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$.

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

Standard Unit Vectors

Let $\vect{e}_j\in\complex{m}$, $1\leq j\leq m$ denote the column vectors defined by \vectorentry{\vect{e}_j}{i} \begin{cases} \end{cases}

Then the set is the set of standard unit vectors in $\complex{m}$.

Standard Unit Vectors $\vect{e}_i$

Notice that $\vect{e}_j$ is identical to column $j$ of the $m\times m$ identity matrix $I_m$ (). This observation will often be useful. It is not hard to see that the set of standard unit vectors is an orthogonal set. We will reserve the notation $\vect{e}_i$ for these vectors.

Standard Unit Vectors are an Orthogonal Set

Compute the inner product of two distinct vectors from the set of standard unit vectors (), say $\vect{e}_i$, $\vect{e}_j$, where $i\neq j$, \conjugate{0}0+ \conjugate{0}0+\cdots+ \conjugate{1}0+\cdots+ \conjugate{0}0+\cdots+ \conjugate{0}1+\cdots+ \conjugate{0}0+ \conjugate{0}0\\

So the set $\set{\vectorlist{e}{m}}$ is an orthogonal set.

An orthogonal set

The set \set{\vect{x}_1,\,\vect{x}_2,\,\vect{x}_3,\,\vect{x}_4}= \set{ \colvector{1+i\\1\\1-i\\i},\, \colvector{1+5i\\6+5i\\-7-i\\1-6i},\, \colvector{-7+34i\\-8-23i\\-10+22i\\30+13i},\, \colvector{-2-4i\\6+i\\4+3i\\6-i} } is an orthogonal set.

Since the inner product is anti-commutative () 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'll do two and you can practice your inner products on the other four. (1-i)(-7+34i)+(1)(-8-23i)+(1+i)(-10+22i)+(-i)(30+13i)\\ and (1-5i)(-2-4i)+(6-5i)(6+i)+(-7+i)(4+3i)+(1+6i)(6-i)\\

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.

Orthogonal Sets are Linearly Independent

Suppose that $S$ is an orthogonal set of nonzero vectors. Then $S$ is linearly independent.

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

Then, for every $1\leq i\leq n$, we have \text{}\\ \alpha_1\innerproduct{\vect{u}_i}{\vect{u}_1}+ \cdots+ \alpha_i\innerproduct{\vect{u}_i}{\vect{u}_i}+ \cdots+ \alpha_n\innerproduct{\vect{u}_i}{\vect{u}_n} \text{}\\ \innerproduct{\vect{u}_i}{\alpha_1\vect{u}_1}+ \innerproduct{\vect{u}_i}{\alpha_2\vect{u}_2}+ \cdots+ \innerproduct{\vect{u}_i}{\alpha_n\vect{u}_n} \text{}\\ \innerproduct{\vect{u}_i}{\lincombo{\alpha}{u}{n}} \text{}\\ \innerproduct{\vect{u}_i}{\zerovector} \text{}\\ \text{}

Because $\vect{u}_i$ was assumed to be nozero, 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$. 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 (). Boom!

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$, then we can do a number of calculations with these vectors and produce an orthogonal set of $p$ vectors, $T$, so that $\spn{S}=\spn{T}$. 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 . So study the simple example described in first.

Gram-Schmidt Procedure

Suppose that $S=\set{\vectorlist{v}{p}}$ is a linearly independent set of vectors in $\complex{m}$. Define the vectors $\vect{u}_i$, $1\leq i\leq p$ by \vect{u}_i=\vect{v}_i -\frac{\innerproduct{\vect{u}_1}{\vect{v}_i}}{\innerproduct{\vect{u}_1}{\vect{u}_1}}\vect{u}_1 -\frac{\innerproduct{\vect{u}_2}{\vect{v}_i}}{\innerproduct{\vect{u}_2}{\vect{u}_2}}\vect{u}_2 -\frac{\innerproduct{\vect{u}_3}{\vect{v}_i}}{\innerproduct{\vect{u}_3}{\vect{u}_3}}\vect{u}_3 -\cdots -\frac{\innerproduct{\vect{u}_{i-1}}{\vect{v}_i}}{\innerproduct{\vect{u}_{i-1}}{\vect{u}_{i-1}}}\vect{u}_{i-1}

Then if $T=\set{\vectorlist{u}{p}}$, then $T$ is an orthogonal set of non-zero vectors, and $\spn{T}=\spn{S}$.

We will prove the result by using induction on $p$ (). To begin, we prove that $T$ has the desired properties when $p=1$. In this case $\vect{u}_1=\vect{v}_1$ and $T=\set{\vect{u}_1}=\set{\vect{v}_1}=S$. Because $S$ and $T$ are equal, $\spn{S}=\spn{T}$. Equally trivial, $T$ is an orthogonal set. If $\vect{u}_1=\zerovector$, 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}}$. $T^\prime$ is therefore an orthogonal set of nonzero vectors and $\spn{S^\prime}=\spn{T^\prime}$. Define \vect{u}_p=\vect{v}_p -\frac{\innerproduct{\vect{u}_1}{\vect{v}_p}}{\innerproduct{\vect{u}_1}{\vect{u}_1}}\vect{u}_1 -\frac{\innerproduct{\vect{u}_2}{\vect{v}_p}}{\innerproduct{\vect{u}_2}{\vect{u}_2}}\vect{u}_2 -\frac{\innerproduct{\vect{u}_3}{\vect{v}_p}}{\innerproduct{\vect{u}_3}{\vect{u}_3}}\vect{u}_3 -\cdots -\frac{\innerproduct{\vect{u}_{p-1}}{\vect{v}_p}}{\innerproduct{\vect{u}_{p-1}}{\vect{u}_{p-1}}}\vect{u}_{p-1} and let $T=T^\prime\cup\set{\vect{u}_p}$. We need to now show that $T$ has several properties by building on what we know about $T^\prime$. 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$, which is composed of nonzero vectors.

We show that $\spn{T}=\spn{S}$, by first establishing that $\spn{T}\subseteq\spn{S}$. Suppose $\vect{x}\in\spn{T}$, so \vect{x}=\lincombo{a}{u}{p} The term $a_p\vect{u}_p$ is a linear combination of vectors from $T^\prime$ and the vector $\vect{v}_p$, while the remaining terms are a linear combination of vectors from $T^\prime$. Since $\spn{T^\prime}=\spn{S^\prime}$, any term that is a multiple of a vector from $T^\prime$ can be rewritten as a linear combination of vectors from $S^\prime$. The remaining term $a_p\vect{v}_p$ is a multiple of a vector in $S$. So we see that $\vect{x}$ can be rewritten as a linear combination of vectors from $S$, $\vect{x}\in\spn{S}$.

To show that $\spn{S}\subseteq\spn{T}$, begin with $\vect{y}\in\spn{S}$, so \vect{y}=\lincombo{a}{v}{p}

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

The elements of $T^\prime$ are nonzero, but what about $\vect{u}_p$? Suppose to the contrary that $\vect{u}_p=\zerovector$, -\frac{\innerproduct{\vect{u}_1}{\vect{v}_p}}{\innerproduct{\vect{u}_1}{\vect{u}_1}}\vect{u}_1 -\frac{\innerproduct{\vect{u}_2}{\vect{v}_p}}{\innerproduct{\vect{u}_2}{\vect{u}_2}}\vect{u}_2 -\frac{\innerproduct{\vect{u}_3}{\vect{v}_p}}{\innerproduct{\vect{u}_3}{\vect{u}_3}}\vect{u}_3 -\cdots -\frac{\innerproduct{\vect{u}_{p-1}}{\vect{v}_p}}{\innerproduct{\vect{u}_{p-1}}{\vect{u}_{p-1}}}\vect{u}_{p-1}\\ \frac{\innerproduct{\vect{u}_1}{\vect{v}_p}}{\innerproduct{\vect{u}_1}{\vect{u}_1}}\vect{u}_1 +\frac{\innerproduct{\vect{u}_2}{\vect{v}_p}}{\innerproduct{\vect{u}_2}{\vect{u}_2}}\vect{u}_2 +\frac{\innerproduct{\vect{u}_3}{\vect{v}_p}}{\innerproduct{\vect{u}_3}{\vect{u}_3}}\vect{u}_3 +\cdots +\frac{\innerproduct{\vect{u}_{p-1}}{\vect{v}_p}}{\innerproduct{\vect{u}_{p-1}}{\vect{u}_{p-1}}}\vect{u}_{p-1}

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$, implying that $S$ is a linearly dependent set (), contrary to our lone hypothesis about $S$.

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$, for $1\leq i\leq p-1$. Here we go, using summation notation, \innerproduct{\vect{u}_i}{ \vect{v}_p-\sum_{k=1}^{p-1}\frac{\innerproduct{\vect{u}_k}{\vect{v}_p}}{\innerproduct{\vect{u}_k}{\vect{u}_k}}\vect{u}_k } \\ \innerproduct{\vect{u}_i}{\vect{v}_p} - \innerproduct{\vect{u}_i}{ \sum_{k=1}^{p-1}\frac{\innerproduct{\vect{u}_k}{\vect{v}_p}}{\innerproduct{\vect{u}_k}{\vect{u}_k}}\vect{u}_k } \text{}\\ \innerproduct{\vect{u}_i}{\vect{v}_p} - \sum_{k=1}^{p-1}\innerproduct{\vect{u}_i}{ \frac{\innerproduct{\vect{u}_k}{\vect{v}_p}}{\innerproduct{\vect{u}_k}{\vect{u}_k}}\vect{u}_k } \text{}\\ \innerproduct{\vect{u}_i}{\vect{v}_p} - \sum_{k=1}^{p-1}\frac{\innerproduct{\vect{u}_k}{\vect{v}_p}}{\innerproduct{\vect{u}_k}{\vect{u}_k}}\innerproduct{\vect{u}_i}{\vect{u}_k} \text{}\\ \innerproduct{\vect{u}_i}{\vect{v}_p} - \frac{\innerproduct{\vect{u}_i}{\vect{v}_p}}{\innerproduct{\vect{u}_i}{\vect{u}_i}}\innerproduct{\vect{u}_i}{\vect{u}_i} - \sum_{k\neq i}\frac{\innerproduct{\vect{u}_k}{\vect{v}_p}}{\innerproduct{\vect{u}_k}{\vect{u}_k}}(0) \innerproduct{\vect{u}_i}{\vect{v}_p} - \innerproduct{\vect{u}_i}{\vect{v}_p} - \sum_{k\neq i}0\\

Gram-Schmidt of three vectors

We will illustrate the Gram-Schmidt process with three vectors. Begin with the linearly independent (check this!) set S=\set{\vect{v}_1,\,\vect{v}_2,\,\vect{v}_3}=\set{ \colvector{1\\1+i\\1},\, \colvector{-i\\1\\1+i},\, \colvector{0\\i\\i} }

Then -\frac{\innerproduct{\vect{u}_1}{\vect{v}_2}}{\innerproduct{\vect{u}_1}{\vect{u}_1}}\vect{u}_1 =\frac{1}{4}\colvector{-2-3i\\1-i\\2+5i}\\ -\frac{\innerproduct{\vect{u}_1}{\vect{v}_3}}{\innerproduct{\vect{u}_1}{\vect{u}_1}}\vect{u}_1 -\frac{\innerproduct{\vect{u}_2}{\vect{v}_3}}{\innerproduct{\vect{u}_2}{\vect{u}_2}}\vect{u}_2 =\frac{1}{11}\colvector{-3-i\\1+3i\\-1-i} and T=\set{\vect{u}_1,\,\vect{u}_2,\,\vect{u}_3} =\set{ \colvector{1\\1+i\\1},\, \frac{1}{4}\colvector{-2-3i\\1-i\\2+5i},\, \frac{1}{11}\colvector{-3-i\\1+3i\\-1-i} } is an orthogonal set (which you can check) of nonzero vectors and $\spn{T}=\spn{S}$ (all by ). Of course, as a by-product of orthogonality, the set $T$ is also linearly independent ().

One final definition related to orthogonal vectors.

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$. 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 ).

Orthonormal set, three vectors

The set T=\set{\vect{u}_1,\,\vect{u}_2,\,\vect{u}_3} =\set{ \colvector{1\\1+i\\1},\, \frac{1}{4}\colvector{-2-3i\\1-i\\2+5i},\, \frac{1}{11}\colvector{-3-i\\1+3i\\-1-i} } from is an orthogonal set.

We compute the norm of each vector, \norm{\vect{u}_3}=\frac{\sqrt{2}}{\sqrt{11}}

Converting each vector to a norm of 1, yields an orthonormal set,

Orthonormal set, four vectors

As an exercise convert the linearly independent set S=\set{ \colvector{1+i\\1\\1-i\\i},\, \colvector{i\\1+i\\-1\\-i},\, \colvector{i\\-i\\ -1+i\\1},\, \colvector{-1-i\\i\\1\\-1} } to an orthogonal set via the Gram-Schmidt Process () 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 to become an orthonormal set.

We will see orthonormal sets again in . They are intimately related to unitary matrices () through . Some of the utility of orthonormal sets is captured by in . Orthonormal sets appear once again in where they are key in orthonormal diagonalization.

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 . 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]) True 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. ips = [S[i].hermitian_inner_product(S[i]) for i in range(3)] all([ip == 1 for ip in ips]) False 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 . We will illustrate with the vectors from . 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) [ -0.5 -0.5 - 0.5*I -0.5] [ 0.30151 + 0.45227*I -0.15076 + 0.15076*I -0.30151 - 0.75378*I] [ 0.6396 + 0.2132*I -0.2132 - 0.6396*I 0.2132 + 0.2132*I] 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's 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. 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) [ 0.50000000000000000?, 0.50000000000000000? + 0.50000000000000000?*I, 0.50000000000000000?, -0.3015113445777636? - 0.4522670168666454?*I, 0.1507556722888818? - 0.1507556722888818?*I, 0.3015113445777636? + 0.7537783614444091?*I, -0.6396021490668313? - 0.2132007163556105?*I, 0.2132007163556105? + 0.6396021490668313?*I, -0.2132007163556105? - 0.2132007163556105?*I ] 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 . 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 . 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) [ 1, I + 1, 1, -0.50000000000000000? - 0.75000000000000000?*I, 0.25000000000000000? - 0.25000000000000000?*I, 0.50000000000000000? + 1.2500000000000000?*I, -0.2727272727272728? - 0.0909090909090909?*I, 0.0909090909090909? + 0.2727272727272728?*I, -0.0909090909090909? - 0.0909090909090909?*I ] 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. v1 = vector(QQ, [1, 1]) v2 = vector(QQ, [2, 3]) A = matrix([v1,v2]) G, M = A.gram_schmidt(orthonormal=True) Traceback (most recent call last): ... TypeError: QR decomposition unable to compute square roots in Rational Field
1. Is the set \set{\colvector{1\\-1\\2},\,\colvector{5\\3\\-1},\,\colvector{8\\4\\-2}} 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?
Complete by verifying that the four remaining inner products are zero. Verify that the set $T$ created in by the Gram-Schmidt Procedure is an orthogonal set. 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}$. Prove part 2 of the conclusion of . Prove part 2 of the conclusion of . Suppose that $\vect{u},\,\vect{v},\,\vect{w}\in\complex{n}$, $\alpha,\,\beta\in\complexes$ and $\vect{u}$ is orthogonal to both $\vect{v}$ and $\vect{w}$. Prove that $\vect{u}$ is orthogonal to $\alpha\vect{v}+\beta\vect{w}$. Vectors are orthogonal if their inner product is zero (), so we compute, \innerproduct{\vect{u}}{\alpha\vect{v}+\beta\vect{w}} \innerproduct{\vect{u}}{\alpha\vect{v}}+ \innerproduct{\vect{u}}{\beta\vect{w}} \text{}\\ \alpha\innerproduct{\vect{u}}{\vect{v}}+ \beta\innerproduct{\vect{u}}{\vect{w}} \text{}\\ \alpha\left(0\right)+\beta\left(0\right) \text{}\\ So by , $\vect{u}$ and $\alpha\vect{v}+\beta\vect{w}$ are an orthogonal pair of vectors. Suppose that the set $S$ in the hypothesis of is not just linearly independent, but is also orthogonal. Prove that the set $T$ created by the Gram-Schmidt procedure is equal to $S$. (Note that we are getting a stronger conclusion than $\spn{T}=\spn{S}$ the conclusion is that $T=S$.) In other words, it is pointless to apply the Gram-Schmidt procedure to a set that is already orthogonal.