-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paththree_iv.tex
1749 lines (1606 loc) · 34.4 KB
/
three_iv.tex
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
% see: https://groups.google.com/forum/?fromgroups#!topic/comp.text.tex/s6z9Ult_zds
\makeatletter\let\ifGm@compatii\relax\makeatother
\documentclass[10pt,t]{beamer}
\usefonttheme{professionalfonts}
\usefonttheme{serif}
\PassOptionsToPackage{pdfpagemode=FullScreen}{hyperref}
\PassOptionsToPackage{usenames,dvipsnames}{xcolor}
% \DeclareGraphicsRule{*}{mps}{*}{}
\usepackage{../linalgjh}
\usepackage{present}
\usepackage{xr}\externaldocument{../map4} % read refs from .aux file
\usepackage{xr}\externaldocument{../map2} % read refs from .aux file
\usepackage{catchfilebetweentags}
\usepackage{etoolbox} % from http://tex.stackexchange.com/questions/40699/input-only-part-of-a-file-using-catchfilebetweentags-package
\makeatletter
\patchcmd{\CatchFBT@Fin@l}{\endlinechar\m@ne}{}
{}{\typeout{Unsuccessful patch!}}
\makeatother
\mode<presentation>
{
\usetheme{boxes}
\setbeamercovered{invisible}
\setbeamertemplate{navigation symbols}{}
}
\addheadbox{filler}{\ } % create extra space at top of slide
\hypersetup{colorlinks=true,linkcolor=blue}
\title[Matrix Operations] % (optional, use only with long paper titles)
{Three.IV Matrix Operations}
\author{\textit{Linear Algebra} \\ {\small Jim Hef{}feron}}
\institute{
\texttt{http://joshua.smcvt.edu/linearalgebra}
}
\date{}
\subject{Matrix Operations}
% This is only inserted into the PDF information catalog. Can be left
% out.
\begin{document}
\begin{frame}
\titlepage
\end{frame}
% =============================================
% \begin{frame}{Reduced Echelon Form}
% \end{frame}
% ..... Three.IV.1 .....
\section{Sums and Scalar Products}
%..........
\begin{frame}{Representing operations on linear functions}
Recall that the collection of linear functions
between two spaces $\linmaps{V}{W}$ is a vector space.
That is, given
a linear map $\map{f}{V}{W}$ then
the scalar multiple $rf$
\begin{equation*}
\vec{v}\mapsunder{r\cdot f} r\cdot (\,f(\vec{v})\,)
\end{equation*}
is a linear map $\map{rf}{V}{W}$.
And, where $\map{f,g}{V}{W}$ are
linear then their sum
\begin{equation*}
\vec{v}\mapsunder{f+g} f(\vec{v})+g(\vec{v})
\end{equation*}
is also linear $\map{f+g}{V}{W}$.
\pause
We now see how the matrix representation of
$\rep{f}{B,D}$
is related to that of $\rep{rf}{B,D}$,
and how the representations of
$\rep{f}{B,D}$ and $\rep{g}{B,D}$
combine to give the representation of $\rep{f+g}{B,D}$.
\end{frame}
\begin{frame}
\ex
Fix a domain~$V$ and codomain~$W$ with bases
$B=\sequence{\vec{\beta}_1,\vec{\beta}_2}$
and $D=\sequence{\vec{\delta}_1,\vec{\delta}_2}$.
Let $\map{f}{V}{W}$ be the linear map represented
by a matrix~$H$
We will find the matrix representing the map $\map{6f}{V}{W}$.
\begin{equation*}
\vec{v}\mapsunder{6f} 6\cdot f(\vec{v})
\end{equation*}
Let
this be the representation
of an output vector~$f(\vec{v})$.
\begin{equation*}
% \rep{\vec{v}}{B}=\colvec{v_1 \\ v_2}
% \qquad
\rep{\,f(\vec{v})\,}{D}=\colvec{w_1 \\ w_2}
% =\colvec{2v_1+v_2 \\ 3v_1+4v_2}
\end{equation*}
Note that
$6\cdot f(\vec{v})=6\cdot (w_1\vec{\delta}_1+w_2\vec{\delta}_2)
=(6w_1)\cdot\vec{\delta}_1+(6w_2)\cdot\vec{\delta}_2$,
so $6f\:(\vec{v})$ has
this representation.
\begin{equation*}
% \rep{6f(\vec{v})}{D}
% =
\rep{6f\;(\vec{v})}{D}=\colvec{6w_1 \\ 6w_2}
\end{equation*}
Entries of the
representation of $6f\:(\vec{v})$ are
$6$ times as big as the entries of the representation of~$f(\vec{v})$.
So the matrix representing $6f$ needs entries that are $6$~times as big
as those of the matrix representing~$f$.
\end{frame}
\begin{frame}
\noindent For example, if~$f$ is represented by this matrix
\begin{equation*}
H=\rep{f}{B,D}=
\begin{mat}
2 &1 \\
3 &4
\end{mat}
\end{equation*}
then this is the matrix-vector representation of the action of~$f$.
\begin{equation*}\
% \rep{f}{B,D}\cdot \rep{\vec{v}}{B}=
\begin{mat}
2 &1 \\
3 &4
\end{mat}
\colvec{v_1 \\ v_2}
=\colvec{2v_1+v_2 \\ 3v_1+4v_2}
\end{equation*}
and this is the matrix-vector representation of the action of~$6f$.
\begin{equation*}
\rep{6f}{B,D}\cdot
\colvec{v_1 \\ v_2}
=\colvec{12v_1+6v_2 \\ 18v_1+24v_2}
\end{equation*}
So this is the matrix representing~$6f$.
\begin{equation*}
\rep{6f}{B,D}
=
\begin{mat}
12 &6 \\
18 &24
\end{mat}
\end{equation*}
\end{frame}
\begin{frame}
\ex
Next consider the representation of the sum~$f+g$ of two linear maps
$\map{f,g}{V}{W}$.
For a domain vector~$\vec{v}$ let the outputs $f(\vec{v})$ and $g(\vec{v})$
have these representations.
\begin{equation*}
\rep{f(\vec{v})}{D}=\colvec{u_1 \\ u_2}
\qquad
\rep{g(\vec{v})}{D}=\colvec{w_1 \\ w_2}
\end{equation*}
The action of $f+g$ is this.
\begin{align*}
\vec{v}
\mapsunder{f+g}
\vec{u}+\vec{v}
&=(u_1\vec{\delta}_1+u_2\vec{\delta}_2)
+
(w_1\vec{\delta}_1+w_2\vec{\delta}_2) \\
&=(u_1+w_1)\cdot\vec{\delta}_1+(u_2+w_2)\cdot\vec{\delta}_2
\end{align*}
The effect on the representations
of adding the functions is to add the column vectors.
\begin{equation*}
\rep{\,(f+g)\,(\vec{v})\,}{D}=\colvec{u_1+w_1 \\ u_2+w_2}
\end{equation*}
Therefore, the matrix representing $f+g$ needs entries that are the sum
of those of the two matrix representations.
\end{frame}
\begin{frame}
\noindent
For instance,
suppose that the maps are represented by these.
\begin{equation*}
\rep{f}{B,D}=
\begin{mat}
2 &1 \\
3 &4
\end{mat}
\qquad
\rep{g}{B,D}=
\begin{mat}
5 &8 \\
7 &6
\end{mat}
\end{equation*}
The functions given have
this effect.
\begin{align*}
\rep{f(\vec{v})}{D}=
\begin{mat}
2 &1 \\
3 &4
\end{mat}
\colvec{v_1 \\ v_2}
=\colvec{2v_1+v_2 \\ 3v_1+4v_2}
\\
\rep{g(\vec{v})}{D}=
\begin{mat}
5 &8 \\
7 &6
\end{mat}
\colvec{v_1 \\ v_2}
=\colvec{5v_1+8v_2 \\ 7v_1+6v_2}
\end{align*}
The $f+g$ matrix acts in this way
\begin{equation*}
\rep{\,(f+g)\,(\vec{v})\,}{D}
\colvec{v_1 \\ v_2}
=\colvec{7v_1+9v_2 \\ 10v_1+10v_2}
\end{equation*}
so this is its matrix representation.
\begin{equation*}
\rep{f+g}{B,D}=
\begin{mat}
7 &9 \\
10 &10
\end{mat}
\end{equation*}
\end{frame}
\begin{frame}{Definition of matrix sum and scalar multiple}
\df[def:SumScalarProdMats]
\ExecuteMetaData[../map4.tex]{df:SumScalarProdMats}
\pause
\ex
Where
\begin{equation*}
A=
\begin{mat}
1 &-1 \\
2 &3
\end{mat}
\quad
B=
\begin{mat}
0 &0 &2 \\
9 &-1/2 &5
\end{mat}
\quad
C=
\begin{mat}
1 &0 \\
8 &-1
\end{mat}
\end{equation*}
Then
\begin{equation*}
A+C=
\begin{mat}
2 &-1 \\
10 &2
\end{mat}
\qquad
5B=
\begin{mat}
0 &0 &10 \\
45 &-5/2 &25
\end{mat}
\end{equation*}
None of these is defined: $A+B$, $B+A$,
$B+C$, $C+B$, because the sizes don't match.
\end{frame}
%..........
\begin{frame}
\th[th:MatOpsRepMapOps]
\ExecuteMetaData[../map4.tex]{th:MatOpsRepMapOps}
\pause
\pf
Generalize the earlier examples.
See \nearbyexercise{exer:CorrspMapMatOps}\hspace{-0.25em}.
\qed
\pause
\medskip
\df[df:ZeroMatrix]
\ExecuteMetaData[../map4.tex]{df:ZeroMatrix}
\pause
\medskip
\ex
The zero matrix is the identity element for matrix addition.
\begin{equation*}
\begin{mat}
3 &1 &2 \\
5 &0 &9
\end{mat}
+
\begin{mat}
0 &0 &0 \\
0 &0 &0
\end{mat}
=
\begin{mat}
3 &1 &2 \\
5 &0 &9
\end{mat}
\end{equation*}
A zero function
$\map{Z}{V}{W}$ is the identity element for
function addition, and the matrix fact accords with the map fact.
\end{frame}
% ..... Three.IV.2 .....
\section{Matrix Multiplication}
%..........
\begin{frame}{Representing composition}
Another function operation,
besides scalar multiplication and addition,
is composition.
\pause
\lm[lm:CompositionOfLinearMapsIsLinear]
\ExecuteMetaData[../map4.tex]{lm:CompositionOfLinearMapsIsLinear}
\pause
\pf
\ExecuteMetaData[../map4.tex]{pf:CompositionOfLinearMapsIsLinear}
\qed
\pause
\medskip
We next do an exploratory calculation to see how the matrix
representations of the two functions combine to make
the matrix representation of their composition.
\end{frame}
%..........
\begin{frame}
\ex
Consider two linear functions $\map{h}{V}{W}$ and $\map{g}{W}{X}$
represented as here.
\begin{equation*}
\rep{h}{B,C}=
\begin{mat}
3 &1 \\
2 &5 \\
4 &6
\end{mat}
\qquad
\rep{g}{C,D}=
\begin{mat}
8 &7 &11 \\
9 &10 &12
\end{mat}
\end{equation*}
% The sizes of the matrices show that
% $V$ has dimension~$2$,
% $W$ has dimension~$3$,
% and $X$ has dimension~$2$.
We want to see how these two representations combine to
give the representation of the map
$\map{\composed{g}{h}}{V}{X}$.
\pause
We start with the action
of~$h$ on a~$\vec{v}\in V$.
\begin{align*}
\rep{h(\vec{v})}{C}
&=\rep{h}{B,C}\cdot\rep{\vec{v}}{B} \\
&=
\begin{mat}
3 &1 \\
2 &5 \\
4 &6
\end{mat}
\colvec{v_1 \\ v_2}
=
\colvec{3v_1+v_2 \\ 2v_1+5v_2 \\ 4v_1+6v_2}
\end{align*}
Of course we represent application of~$h$ by doing the matrix vector
multiplication.
\end{frame}
\begin{frame}
\noindent Next apply $g$.
\begin{multline*}
\rep{g}{C,D}\cdot \rep{h(\vec{v})}{C}
=
\begin{mat}
8 &7 &11 \\
9 &10 &12
\end{mat}
\colvec{3v_1+v_2 \\ 2v_1+5v_2 \\ 4v_1+6v_2} \\
=
\colvec{8(3v_1+v_2)+7(2v_1+5v_2)+11(4v_1+6v_2) \\
9(3v_1+v_2)+10(2v_1+5v_2)+12(4v_1+6v_2)}
\end{multline*}
Gather terms.
\begin{equation*}
=\colvec{(8\cdot 3+7\cdot 2+11\cdot 4)v_1+(8\cdot 1+7\cdot 5+11\cdot 6)v_2 \\
(9\cdot 3+10\cdot 2+12\cdot 4)v_1+(9\cdot 1+10\cdot 5+12\cdot 6)v_2}
\end{equation*}
Rewrite as a matrix-vector multiplication.
\begin{equation*}
=\begin{mat}
8\cdot 3+7\cdot 2+11\cdot 4 &8\cdot 1+7\cdot 5+11\cdot 6 \\
9\cdot 3+10\cdot 2+12\cdot 4 &9\cdot 1+10\cdot 5+12\cdot 6
\end{mat}
\colvec{v_1 \\ v_2}
\end{equation*}
So here is how the two starting matrices combine.
\begin{equation*}
\begin{mat}
8 &7 &11 \\
9 &10 &12
\end{mat}
\begin{mat}
3 &1 \\
2 &5 \\
4 &6
\end{mat}
=
\begin{mat}
8\cdot 3+7\cdot 2+11\cdot 4 &8\cdot 1+7\cdot 5+11\cdot 6 \\
9\cdot 3+10\cdot 2+12\cdot 4 &9\cdot 1+10\cdot 5+12\cdot 6
\end{mat}
\end{equation*}
\end{frame}
%..........
\begin{frame}{Definition of matrix multiplication}
\df[def:MatMult]
\ExecuteMetaData[../map4.tex]{df:MatMult}
\ex
\begin{equation*}
\begin{mat}
3 &1 &6 \\
2 &5 &9
\end{mat}
\begin{mat}
2 &0 &4 \\
1 &-3 &5 \\
4 &2 &7
\end{mat}
=
\begin{mat}
31 &9 &59 \\
45 &3 &96
\end{mat}
\end{equation*}
\end{frame}
\begin{frame}
\ex
This product is not defined because
the number of columns on the left must equal the number of rows on the right.
\begin{equation*}
\begin{mat}
1 &3 &-1 \\
0 &0 &0 \\
2 &0 &0
\end{mat}
\begin{mat}
5 &7 &1 \\
2 &2 &0
\end{mat}
\end{equation*}
\pause
\ex
Square matrices of the same size have a defined product.
\begin{equation*}
\begin{mat}
1 &3 &-1 \\
0 &0 &0 \\
2 &0 &0
\end{mat}
\begin{mat}
5 &7 &1 \\
2 &2 &0 \\
1 &-1 &2
\end{mat}
=
\begin{mat}
10 &14 &-1 \\
0 &0 &0 \\
10 &14 &2
\end{mat}
\end{equation*}
This reflects the fact that we can compose two
functions from a space to itself $\map{f,g}{V}{V}$.
\end{frame}
%..........
\begin{frame}{Matrix multiplication represents composition}
\th[th:MatMultRepComp]
\ExecuteMetaData[../map4.tex]{th:MatMultRepComp}
\iftoggle{showallproofs}{
\pause
\pf
\ExecuteMetaData[../map4.tex]{pf:MatMultRepComp0}
}{
\bigskip
The book has the proof, which retraces the steps of the example.
}
\end{frame}
\iftoggle{showallproofs}{
\begin{frame}
\ExecuteMetaData[../map4.tex]{pf:MatMultRepComp1}
\qed
\end{frame}
}{}
%..........
\begin{frame}{Arrow diagrams}
% \ExecuteMetaData[../map4.tex]{MatMultArrowDiag0}
This pictures the relationship between maps and matrices.
\centergraphic{../ch3.20}
\pause
\ExecuteMetaData[../map4.tex]{MatMultArrowDiag1}
\end{frame}
\begin{frame}
\ex
Let $V=\Re^2$, $W=\polyspace_2$, and~$X=\matspace_{\nbyn{2}}$.
Fix these bases.
\begin{gather*}
B=\sequence{\colvec{1 \\ 1}, \colvec{1 \\ -1}}
\qquad
C=\sequence{x^2, x^2+x, x^2+x+1} \\
D=\sequence{
\begin{mat}
1 &0 \\
0 &0
\end{mat},
\begin{mat}
0 &2 \\
0 &0
\end{mat},
\begin{mat}
0 &0 \\
3 &0
\end{mat},
\begin{mat}
0 &0 \\
0 &4
\end{mat}}
\end{gather*}
Suppose that $\map{f}{\Re^2}{\polyspace_2}$ and
$\map{g}{\polyspace_2}{\matspace_{\nbyn{2}}}$ have these actions.
\begin{equation*}
\colvec{a \\ b}\mapsunder{f} ax^2+(a+b)
\qquad
px^2+qx+r\mapsunder{g}
\begin{mat}
p &p+q \\
0 &r
\end{mat}
\end{equation*}
Then the composition does this.
\begin{equation*}
\colvec{a \\ b}\mapsunder{f}ax^2+(a+b)\mapsunder{g}
\begin{mat}
a &a \\
0 &a+b
\end{mat}
\end{equation*}
Here is the same statement in the other notation.
\begin{equation*}
\composed{g}{f}\,(\colvec{a \\ b})=
\begin{mat}
a &a \\
0 &a+b
\end{mat}
\end{equation*}
\end{frame}
\begin{frame}
So far in this example we have given the maps above the arrows, $f$, $g$,
and $\composed{g}{f}$.
\centergraphic{../ch3.20}
We next compute the matrices representing those maps, and we will
finish by checking that the product of $H$ and~$G$ is the matrix
representing $\composed{g}{h}$.
\pause
First, find $H=\rep{f}{B,D}$: compute the action of $h$
on the domain basis vectors,
\begin{equation*}
\colvec{1 \\ 1}\mapsunder{f}x^2+2
\quad
\colvec{1 \\ -1}\mapsunder{f}x^2
\end{equation*}
represent the results with respect to $D$, and make the matrix.
\begin{equation*}
\rep{x^2+2}{C}=\colvec{1 \\ -2 \\ 2}
\quad
\rep{x^2}{C}=\colvec{1 \\ 0 \\ 0}
\qquad
H=
\begin{mat}
1 &1 \\
-2 &0 \\
2 &0
\end{mat}
\end{equation*}
\end{frame}
\begin{frame}
Do the same for~$g$: see where it maps its domain basis
\begin{equation*}
x^2\mapsto
\begin{mat}
1 &1 \\
0 &0
\end{mat}
\quad
x^2+x\mapsto
\begin{mat}
1 &2 \\
0 &0
\end{mat}
\quad
x^2+x+1\mapsto
\begin{mat}
1 &2 \\
0 &1
\end{mat}
\end{equation*}
and represent those with respect to its codomain basis.
\begin{equation*}
G=
\begin{mat}
1 &1 &1 \\
1/2 &1 &1 \\
0 &0 &0 \\
0 &0 &1/4
\end{mat}
\end{equation*}
\pause
Next, $\composed{g}{f}$ has this action.
\begin{equation*}
\colvec{1 \\ 1}\mapsto
\begin{mat}
1 &1 \\
0 &2
\end{mat}
\colvec{1 \\ -1}\mapsto
\begin{mat}
1 &1 \\
0 &0
\end{mat}
\end{equation*}
This represents the composition.
\begin{equation*}
\rep{\composed{g}{h}}{B,D}
=
\begin{mat}
1 &1 \\
1/2 &1/2 \\
0 &0 \\
1/2 &0
\end{mat}
\end{equation*}
\end{frame}
\begin{frame}
To finish the example, check that the product of $G$ with~$H$
equals the matrix representing~$\composed{g}{h}$.
\begin{align*}
\rep{g}{C,D}\cdot\rep{h}{B,C}
&=\rep{\composed{g}{h}}{B,D} \\
\begin{mat}
1 &1 &1 \\
1/2 &1 &1 \\
0 &0 &0 \\
0 &0 &1/4
\end{mat}
\begin{mat}
1 &1 \\
-2 &0 \\
2 &0
\end{mat}
&=
\begin{mat}
1 &1 \\
1/2 &1/2 \\
0 &0 \\
1/2 &0
\end{mat}
\end{align*}
\bigskip
\centergraphic{../ch3.20}
\end{frame}
\begin{frame}{Order, dimensions, and sizes}
These two functions can be composed
\begin{equation*}
\map{h}{V}{W}
\qquad
\map{g}{W}{X}
\end{equation*}
because the codomain of~$f$ is the domain of~$g$.
Observe about the order of the notation:~in
writing the composition~$\composed{g}{h}$,
the function $g$ is written first (meaning leftmost)
but it is applied second.
\begin{equation*}
\vec{v}\mapsunder{h} h(\vec{v}) \mapsunder{g} g( h(\vec{v}))
\end{equation*}
% We write $g$ first to match the definition
% $g(\,h(\vec{v})\,)$.
That order carries over to matrices:~$\composed{g}{h}$
is represented by $GH$.
\pause
Also consider the dimensions of the spaces.
\begin{equation*}
\text{dimension \( n \) space}
\;\stackrel{h}{\longrightarrow}\;
\text{dimension \( r \) space}
\;\stackrel{g}{\longrightarrow}\;
\text{dimension \( m \) space}
\end{equation*}
The $\nbym{m}{n}$ matrix~$GH$ is the product of
an $\nbym{m}{r}$ matrix~$G$
and a $\nbym{r}{n}$ matrix~$H$.
Briefly,
$\nbym{m}{r}\text{\ times\ }\nbym{r}{n}\text{\ equals\ }\nbym{m}{n}$.
\end{frame}
\begin{frame}{Matrix multiplication is not commutative}
Function composition is in general not a commutative
operation\Dash $\cos(\sqrt{x})$
is different than $\sqrt{\cos(x)}$.
This holds even in the special case of
composition of linear functions.
\pause
\ex
Changing the order in which we multiply these matrices
\begin{equation*}
\begin{mat}
3 &3 \\
0 &4
\end{mat}
\begin{mat}
-2 &6 \\
6 &5
\end{mat}
=
\begin{mat}
12 &33 \\
24 &20
\end{mat}
\end{equation*}
changes the result.
\begin{equation*}
\begin{mat}
-2 &6 \\
6 &5
\end{mat}
\begin{mat}
3 &3 \\
0 &4
\end{mat}
=
\begin{mat}
-6 &18 \\
18 &38
\end{mat}
\end{equation*}
\pause
\ex
The product of these matrices
\begin{equation*}
\begin{mat}
3 &4 \\
0 &2
\end{mat}
\qquad
\begin{mat}
8 &12 &0 \\
-4 &0 &1/2
\end{mat}
\end{equation*}
is defined in one order and not defined in the other.
\end{frame}
%..........
\begin{frame}
Although the matrix operation of multiplication does not have
the property of being commutative,
it does have some nice algebraic properties.
\th[th:MatMultWellBehaved]
\ExecuteMetaData[../map4.tex]{th:MatMultWellBehaved}
\pause
\pf
\ExecuteMetaData[../map4.tex]{pf:MatMultWellBehaved0}
\pause
\ExecuteMetaData[../map4.tex]{pf:MatMultWellBehaved1}
\qed
\end{frame}
% ..... Three.IV.3 .....
\section{Mechanics of Matrix Multiplication}
%..........
\begin{frame}{Combinatorics of multiplication}
The striking thing about matrix multiplication is the
way rows and columns combine.
The \( i,j \) entry of the matrix product $GH$ is the dot product of
row~$i$ of the left matrix $G$ with column~$j$
of the right one~$H$.
\begin{equation*} %
p_{i,j}
=
g_{i,\text{\textcolor{red}{$1$}}}h_{\text{\textcolor{red}{$1 $}},j}
+g_{i,\text{\textcolor{red}{$2$}}}h_{\text{\textcolor{red}{$2 $}},j}
+\dots+g_{i,\text{\textcolor{red}{$r $}}}h_{\text{\textcolor{red}{$r $}},j}
\end{equation*}
Here a second row and a third column combine to make a $2,3$~entry.
\begin{equation*}
\setlength{\fboxsep}{1.5pt}
\begin{mat}
\begin{array}{@{}cc@{}} 1 &1 \end{array} \\
{\color{blue} \begin{array}{@{}cc@{}} 0 &1 \end{array}} \\
% \text{\highlight{\( \begin{array}{@{}cc@{}} 0 &1 \end{array} \)}} \\
\begin{array}{@{}cc@{}} 1 &0 \end{array}
\end{mat}
\begin{mat}
\begin{array}{@{}c@{}} 4 \\ 5 \end{array}
&{\color{blue}\begin{array}{@{}c@{}} 6 \\ 7 \end{array}}
% &\text{\highlight{\(\begin{array}{@{}c@{}} 8 \\ 9 \end{array}\)}}
\end{mat}
=
\begin{mat}
9 &13 \\
% 5 &\text{\highlight{ \(7\) }} \\
5 &{\color{blue} 7 } \\
4 &6
\end{mat}
\end{equation*}
We can view this as the left matrix acting
by multiplying its rows into the columns of the right matrix.
Or we could see it as
the right matrix using its columns to
act on the left matrix's rows.
\end{frame}
%..........
\begin{frame}
\df[df:UnitMatrix]
\ExecuteMetaData[../map4.tex]{df:UnitMatrix}
\ex
The $2,1$ unit $\nbym{2}{3}$ matrix multiplies from the left
\begin{equation*}
\begin{mat}
0 &0 &0 \\
1 &0 &0
\end{mat}
\begin{mat}
2 &1 &3 \\
5 &6 &4 \\
7 &8 &9
\end{mat}
=
\begin{mat}
0 &0 &0 \\
2 &1 &3
\end{mat}
\end{equation*}
to copy row~$1$ of the multiplicand into row~$2$ of the result.
\pause
\ex
From the right the $2,1$ unit $\nbym{2}{3}$ matrix
\begin{equation*}
\begin{mat}
3 &4 \\
6 &5
\end{mat}
\begin{mat}
0 &0 &0 \\
1 &0 &0
\end{mat}
=
\begin{mat}
4 &0 &0 \\
5 &0 &0
\end{mat}
\end{equation*}
copies column~$2$ of the first matrix into column~$1$ of the result.
\pause
\ex
Rescaling the unit matrix rescales the result.
\begin{equation*}
\begin{mat}
3 &4 \\
6 &5
\end{mat}
\begin{mat}
0 &0 &0 \\
3 &0 &0
\end{mat}
=
\begin{mat}
12 &0 &0 \\
15 &0 &0
\end{mat}
\end{equation*}
\end{frame}
%..........
\begin{frame}
\lm[lm:ColsAndRowsInMatrixMult]
\ExecuteMetaData[../map4.tex]{lm:ColsAndRowsInMatrixMult}
\end{frame}
\begin{frame}
\pf
\ExecuteMetaData[../map4.tex]{pf:ColsAndRowsInMatrixMult}
\qed
\end{frame}
%..........
\begin{frame}
\df[df:MainDiagonal]
\ExecuteMetaData[../map4.tex]{df:MainDiagonal}
\pause
\df[df:IdentityMatrix]
\ExecuteMetaData[../map4.tex]{df:IdentityMatrix}
\pause
Taking the product with an identity matrix returns the multiplicand.
\ex
Multiplication by an identity from the left
\begin{equation*}
\begin{mat}
1 &0 \\
0 &1
\end{mat}
\begin{mat}
3 &2 \\
-1 &5
\end{mat}
=
\begin{mat}
3 &2 \\
-1 &5
\end{mat}
\end{equation*}
or from the right leaves the matrix unchanged.
\begin{equation*}
\begin{mat}
3 &2 \\
-1 &5
\end{mat}
\begin{mat}