-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunit08.tex
817 lines (816 loc) · 32.5 KB
/
unit08.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
\providecommand{\main}{..}
\documentclass[\main/notes.tex]{subfiles}
\begin{document}
\ifSubfilesClassLoaded{\setcounter{chapter}{7}}{}
\addtocontents{toc}{\protect\newpage}
\chapter{Operations}
\section{Binary Operation}
\begin{definition}[width=0.9\textwidth]{Binary Operation}
If $f: X \times X \rightarrow X$, then $f$ is called a \concept{binary operation} on $X$.\\
In other words, a binary operation takes in a pair, and returns a single value.
\end{definition}
\begin{sidenote}{Operations Notation}
An operation is just a function, which means it can be written in normal function \emph{prefix} notation: $f(x, y)$. However, it is more conventional to write it in \emph{infix} notation: $x f y$.
\begin{example}
Addition of numbers is a binary operation. If $(x, y) = (3, 4)$, then it could be written $+(3, 4)$, but it is more conventional to write $3 + 4$.
\end{example}
\end{sidenote}
By convention, the elements of a binary operation are all the same set.
\subsection[Finite and Infinite Sets]{Finite and Infinite Sets (Informal Definition)}
\begin{definition}[width=0.8\textwidth]{Finite Set}
A set whose cardinality is a non-negative number. Meaning one can count the number of elements in the set.\par
\begin{example}[hbox]
$A = \{1, 2, 3, 4\}$, where $\left\lvert A\right\rvert = 4$
\end{example}
\end{definition}
\begin{definition}[width=0.8\textwidth]{Infinite Set}
A set that is not finite. Meaning one \emph{cannot} count the number of elements in the set.\par
\begin{example}[hbox]
The set of real numbers $\mathbb{R}$ is an infinite set.
\end{example}
\end{definition}
\pagebreak
\subsection{Tables For Binary Operations}
A way to describe a binary operation is to use a table, where the rows are based on the \emph{first} element, and the columns on the \emph{second}. The operator (the symbol used to describe the operation) is written in the top left corner.
\begin{example}
Let $A = \{a, b, c, d\}$.\\
A binary operation called $+$ (NB: This is \emph{not} addition) could be written as follows:
\begin{center}
\begin{tblr}{colspec={|c|cccc|}, row{1}={font=\bfseries}, column{1}={font=\bfseries}}
\toprule
$+$ & a & b & c & d\\
\midrule
a & a & b & c & d \\
b & b & c & d & a \\
c & c & d & a & b \\
d & d & a & b & c \\
\bottomrule
\end{tblr}
\end{center}
This would be read (row, column). +(b, d) = a.
\begin{center}
\begin{tblr}{colspec={|c|cccc|}, row{1}={font=\bfseries}, column{1}={font=\bfseries}, row{3}={Lavender}, column{5}={Lavender}, cell{3}{5}={Orchid}}
\toprule
$+$ & a & b & c & d\\
\midrule
a & a & b & c & d \\
b & b & c & d & a \\
c & c & d & a & b \\
d & d & a & b & c \\
\bottomrule
\end{tblr}
\end{center}
\begin{sidenote}{Extra Notes for this operation}
Applying concepts from later to the operation:
\begin{description}[nosep]
\item[Identity] This operation has an identity element, which is a.
\item[Commutativity] This operation is commutative.
\item[Associativity] This operation is associative.
\end{description}
\end{sidenote}
Another binary operation, called $\bullet$ could be written as follows:
\begin{center}
\begin{tblr}{colspec={|c|c c c c|}, row{1}={font=\bfseries}, column{1}={font=\bfseries}}
\toprule
$\bullet$ & a & b & c & d\\
\midrule
a & a & b & c & d \\
b & b & a & d & c \\
c & c & d & a & b \\
d & d & c & b & a \\
\bottomrule
\end{tblr}
\end{center}
\begin{sidenote}{Extra Notes for this operation}
Applying concepts from later to the operation:
\begin{description}[nosep]
\item[Identity] This operation has an identity element, which is a.
\item[Commutativity] This operation is commutative.
\item[Associativity] This operation is associative.
\end{description}
\end{sidenote}
\end{example}
\pagebreak
\section{Properties of Binary Operations}
For examples below, the following binary operation has been used:
\begin{indentparagraph}
$*: \{1, 2\} \times \{1, 2\} \rightarrow \{1, 2\}$ is defined by:
\begin{align*}
\Bigl\{\bigl((1, 1), 1\bigr), \bigl((1, 2), 2\bigr), \bigl((2, 1), 2\bigr), \bigl((2, 2), 1\bigr)\Bigr\}
\end{align*}
In table form this would be:
\begin{center}
\begin{tblr}{colspec={|c|c c|}, row{1}={font=\bfseries}, column{1}={font=\bfseries}}
\toprule
$*$ & $1$ & $2$\\
\midrule
$1$ & 1 & 2 \\
$2$ & 2 & 1 \\
\bottomrule
\end{tblr}
\end{center}
\end{indentparagraph}
\subsection{Commutative Binary Operation}
\begin{definition}{Commutativity}
A binary operation $\Diamond: X \times X \rightarrow X$ is \concept{commutative} iff $x \Diamond y = y \Diamond x$ for all $x, y \in X$.
\end{definition}
The easiest way to check this is it will be commutative if it is symmetrical across the diagonal from the top left to the bottom right.
\begin{example}[width=0.35\textwidth] $
\begin{aligned}[t]
1 * 1 = 1 * 1 = 1\\
1 * 2 = 2 * 1 = 2\\
2 * 2 = 2 * 2 = 1
\end{aligned} $\\
Therefore $*$ is commutative.
\end{example}
\subsection{Associative Binary Operation}
\begin{definition}{Associativity}
A binary operation $\Diamond: X \times X \rightarrow X$ is \concept{associative} iff $(x \Diamond y) \Diamond z = x \Diamond (y \Diamond z)$ for all $x, y, z \in X$.
\end{definition}
Unfortunately, for this one, you have to check each instance.
\begin{example}[width=0.65\textwidth] $
\begin{aligned}[t]
(1 * 1) * 1 = 1 * 1 = 1 &\text{ and } 1 * (1 * 1) = 1 * 1 = 1\\
(1 * 1) * 2 = 1 * 2 = 2 &\text{ and } 1 * (1 * 2) = 1 * 2 = 2\\
(1 * 2) * 1 = 2 * 1 = 2 &\text{ and } 1 * (2 * 1) = 2 * 1 = 2\\
(1 * 2) * 2 = 2 * 2 = 1 &\text{ and } 1 * (2 * 2) = 1 * 1 = 1\\
(2 * 1) * 1 = 2 * 1 = 2 &\text{ and } 2 * (1 * 1) = 2 * 1 = 2\\
(2 * 1) * 2 = 2 * 2 = 1 &\text{ and } 2 * (1 * 2) = 2 * 2 = 1\\
(2 * 2) * 1 = 1 * 1 = 1 &\text{ and } 2 * (2 * 1) = 2 * 2 = 1\\
(2 * 2) * 2 = 1 * 2 = 2 &\text{ and } 2 * (2 * 2) = 2 * 1 = 2
\end{aligned} $\\
Therefore $*$ is associative.
\end{example}
\pagebreak
\subsection{Identity Element of a Binary Operation}
\begin{definition}{Identity Element}
An element $e$ of $X$ is an \concept{identity element} in respect of the binary operation $\Diamond: X \times X \rightarrow X$ iff $e \Diamond x = x \Diamond e = x$ for all $x \in X$.
\end{definition}
The easiest way to check this is if there is a row and column in the table that is identical to the header. (NB: It needs to be \emph{both} row and column, which contain the same element.)
\begin{example}[hbox] $
\begin{aligned}[t]
\mathbf{1} * 1 = 1 &\text{ and } 1 * \mathbf{1} = 1\\
1 * \mathbf{2} = 2 &\text{ and } 2 * \mathbf{1} = 2
\end{aligned} $
\end{example}
\begin{exercise}{Self Assessment Exercise \thechapter.3}
\begin{questions}
\item Let $X$ be $\{2, 7\}$.
\begin{questions}
\item Provide 3 binary operations on $X$, both in list notation and in tabular form.
\begin{answer}
\begin{align*}
\triangle = \Bigl\{\bigl((2, 2), 2\bigr), \bigl((2, 7), 2\bigr), \bigl((7, 2), 2\bigr), \bigl((7, 7), 7\bigr)\Bigr\}
\end{align*}
\begin{center}
\begin{tblr}{colspec={|c | c c|}, row{1}={font=\bfseries}, column{1}={font=\bfseries}}
\toprule
$\triangle$ & $2$ & $7$\\
\midrule
$2$ & 2 & 2\\
$7$ & 2 & 7\\
\bottomrule
\end{tblr}
\end{center}
\begin{align*}
\triangledown = \Bigl\{\bigl((2, 2), 2\bigr), \bigl((2, 7), 7\bigr), \bigl((7, 2), 7\bigr), \bigl((7, 7), 7\bigr)\Bigr\}
\end{align*}
\begin{center}
\begin{tblr}{colspec={|c | c c|}, row{1}={font=\bfseries}, column{1}={font=\bfseries}}
\toprule
$\triangledown$ & $2$ & $7$\\
\midrule
$2$ & 2 & 7\\
$7$ & 7 & 7\\
\bottomrule
\end{tblr}
\end{center}
\begin{align*}
\square = \Bigl\{\bigl((2, 2), 2\bigr), \bigl((2, 7), 2\bigr), \bigl((7, 2), 7\bigr), \bigl((7, 7), 7\bigr)\Bigr\}
\end{align*}
\begin{center}
\begin{tblr}{colspec={|c | c c|}, row{1}={font=\bfseries}, column{1}={font=\bfseries}}
\toprule
$\square$ & $2$ & $7$\\
\midrule
$2$ & 2 & 2\\
$7$ & 7 & 7\\
\bottomrule
\end{tblr}
\end{center}
\end{answer}
\pagebreak
\item Check the three operations for commutativity and associativity.
\begin{answer}
\begin{description}
\item[Commutativity] $\triangle$ is commutative, as it is symmetric about the diagonal.\\
$\triangledown$ is commutative, as it is symmetric about the diagonal.\\
$\square$ is \emph{not} commutative.
\item[Associativity] $\triangle$ is associative.
\begin{alignat*}{3}
x = 2, y = 2, z = 2 \qquad & (2 \triangle 2) \triangle 2 &= 2 \qquad & 2 \triangle (2 \triangle 2) &= 2\\
x = 2, y = 2, z = 7 \qquad & (2 \triangle 2) \triangle 7 &= 2 \qquad & 2 \triangle (2 \triangle 7) &= 2\\
x = 2, y = 7, z = 2 \qquad & (2 \triangle 7) \triangle 2 &= 2 \qquad & 2 \triangle (7 \triangle 2) &= 2\\
x = 2, y = 7, z = 7 \qquad & (2 \triangle 7) \triangle 7 &= 2 \qquad & 2 \triangle (7 \triangle 7) &= 2\\
x = 7, y = 2, z = 2 \qquad & (7 \triangle 2) \triangle 2 &= 2 \qquad & 7 \triangle (2 \triangle 2) &= 2\\
x = 7, y = 2, z = 7 \qquad & (7 \triangle 2) \triangle 7 &= 2 \qquad & 7 \triangle (2 \triangle 7) &= 2\\
x = 7, y = 7, z = 2 \qquad & (7 \triangle 7) \triangle 2 &= 2 \qquad & 7 \triangle (7 \triangle 2) &= 2\\
x = 7, y = 7, z = 7 \qquad & (7 \triangle 7) \triangle 7 &= 7 \qquad & 7 \triangle (7 \triangle 7) &= 7
\end{alignat*}
Doing the same for $\triangledown$ and $\square$. Both are associative as well.
\end{description}
\end{answer}
\item Provide $2$ binary operations on $X = \{a, b, c\}$ and check them for commutativity and associativity.
\begin{answer}
\begin{center}
\begin{tblr}{colspec={| c | c c c |}, row{1}={font=\bfseries}, column{1}={font=\bfseries}}
\toprule
$\bigstar$ & a & b & c\\
\midrule
a & a & a & a\\
b & b & b & b\\
c & c & c & c\\
\bottomrule
\end{tblr}
\begin{tblr}{colspec={| c | c c c |}, row{1}={font=\bfseries}, column{1}={font=\bfseries}}
\toprule
$\heartsuit$ & a & b & c\\
\midrule
a & a & a & a\\
b & a & a & a\\
c & a & a & a\\
\bottomrule
\end{tblr}
\end{center}
\begin{description}
\item[Commutativity] $\bigstar$ is not commutative.\\
$\heartsuit$ is not commutative.
\item[Associativity] $\bigstar$ is associative.\\
$\heartsuit$ is associative.
\end{description}
\end{answer}
\end{questions}
\item Consider the $\bullet$ operation defined in the example above on $A = \{a, b, c, d\}$
\begin{questions}
\item Examine $y \bullet x$ and $x \bullet y$ for each $x, y \in A$. Is $\bullet$ commutative?\\
{\answer Yes, as it is symmetric about the diagonal.}
\item Does $A$ have an identity element for $\bullet$?\\
{\answer Yes, as the row and column for $a$ matches the headers. So $a$ is an identity element.}
\end{questions}
\end{questions}
\end{exercise}
\pagebreak
\section{Operations on Vectors}
\subsection{Vector}
\begin{definition}{Vector}
In this course, a \concept{vector} is considered to be an ordered \emph{n-tuple} of numbers.\\
A \concept{vector} is represented by an n-tuple $u$ in the following way:
\begin{align*}
u = (u_{1}, u_{2}, u_{3}, \ldots, u_{n}) \text{ for some } n \geq 2
\end{align*}
\end{definition}
\subsection{Vector Sum}
\begin{definition}{Vector Sum}
If $u$ and $v$ are vectors with the \emph{same number of coordinates}, then their \concept{sum}, written $u + v$ is the vector obtained by adding the corresponding coordinates of $u$ and $v$.
\begin{align*}
u + v &= (u_{1}, u_{2}, \ldots, u_{n}) + (v_{1}, v_{2}, \ldots, v_{n})\\
&= (u_{1} + v_{2}, u_{2} + v_{2}, \ldots, u_{n} + v_{n})
\end{align*}
\end{definition}
\begin{example}[width=0.5\textwidth]
Let $u = (1, 2, 3)$ and $v = (4, 5, 6)$.\\
Then
\begin{align*}
u + v &= (1, 2, 3) + (4, 5, 6)\\
&= (1 + 4, 2 + 5, 3 + 6)\\
&= (5, 7, 9)
\end{align*}
\end{example}
\begin{sidenote}{Vector addition is not defined for vectors of different sizes}
If two vectors have a different number of coordinates, you cannot add those two vectors together.
\end{sidenote}
\pagebreak
\subsection{Scalar-Vector Product}
\begin{definition}{Scalar-Vector Product}
If $u$ is a vector and $r$ is some scalar number, then the \concept{product} of the number $r$ and the vector $u$ is the vector $r \cdot u$ obtained by multiplying each coordinate of $u$ by $r$.
\begin{align*}
r\cdot u &= r(u_{1}, u_{2}, \ldots, u_{n})\\
&= (ru_{1}, ru_{2}, \ldots, ru_{n})
\end{align*}
\end{definition}
\begin{example}[width=0.5\textwidth]
Let $u = (7, 8, 9)$ and $r = 2$.\\
Then
\begin{align*}
r \cdot u &= 2(7, 8, 9)\\
&= (14, 16, 18)
\end{align*}
\end{example}
\begin{exercise}{Self Assessment Exercise \thechapter.6}
\begin{questions}
\item If $u = (3, 1)$, $v = (-4, -4)$ and $w = (0, -1)$, determine:
\begin{questions}
\item $2u + v$ \hfill
\begin{answer}
$ \begin{aligned}[t]
2u + v &= 2(3, 1) + (-4, -4)\\
&= (6, 2) + (-4, -4)\\
&= (2, -2)
\end{aligned} $ \hfill \phantom{}
\end{answer}
\item $u - 3v$ \hfill
\begin{answer}
$ \begin{aligned}[t]
u - 3v &= (3, 1) - 3(-4, -4)\\
&= (3, 1) + (12, 12)\\
&= (15, 13)
\end{aligned} $ \hfill \phantom{}
\end{answer}
\item $-3(v + w)$ \hfill
\begin{answer}
$ \begin{aligned}[t]
-3(v + w) &= -3\bigl((-4, -4) + (0, -1)\bigr)\\
&= -3(-4, -5)\\
&= (12, 15)
\end{aligned} $ \hfill \phantom{}
\end{answer}
\end{questions}
\end{questions}
\end{exercise}
\pagebreak
\subsection{Dot Product}
\begin{definition}[width=0.87\textwidth]{Dot Product}
The \concept{dot product} (also called the \concept{inner product}) of vectors $u = (u_{1}, u_{2}, \ldots, u_{n})$ and \\$v = (v_{1}, v_{2}, \ldots, v_{n})$ is written $u \cdot v$ and defined by:
\begin{align*}
u \cdot v = u_{1}v_{1} + u_{2}v_{2} + \ldots + u_{n}v_{n}
\end{align*}
\end{definition}
\begin{sidenote}{The result of the dot product is a number}
Unlike the other operations, which result in vectors, the dot product produces a single number.
\end{sidenote}
\begin{example}[width=0.6\textwidth]
Let $u = (2, 4, 6)$ and $v = (1, 3, 5)$. Then
\begin{align*}
u \cdot v &= (2, 4, 6)(1, 3, 5)\\
&= (2 \cdot 1) + (4 \cdot 3) + (6 \cdot 5)\\
&= 2 + 12 + 30\\
&= 44
\end{align*}
\end{example}
\begin{sidenote}{The dot product is not defined for vectors of different sizes}
As with addition, if two vectors have a different number of coordinates, you cannot calculate the dot product.
\end{sidenote}
\begin{exercise}{Self Assessment Exercise \thechapter.7}
\begin{questions}
\item If $u = (1, 2, 5)$ and $v = (2, 3, 5)$, determine:
\begin{questions}
\item $u \cdot v$ \hfill
\begin{answer}
$ \begin{aligned}[t]
u \cdot v &= (1, 2, 5) \cdot (2, 3, 5)\\
&= (1 \cdot 2) + (2 \cdot 3) + (5 \cdot 5)\\
&= 2 + 6 + 25\\
&= 33
\end{aligned} $\hfill \phantom{}
\end{answer}
\item $v(2u)$ \hfill
\begin{answer}
$ \begin{aligned}[t]
v(2u) &= (2, 3, 5)\bigl(2(1, 2, 5)\bigr)\\
&= (2, 3, 5) \cdot (2, 4, 10)\\
&= (2 \cdot 2) + (3 \cdot 4) + (5 \cdot 10)\\
&= 4 + 12 + 50\\
&= 66
\end{aligned} $ \hfill \phantom{}
\end{answer}
\end{questions}
\end{questions}
\end{exercise}
\pagebreak
\section{Operations on Matrices}
\subsection{Matrix}
\begin{definition}{Matrix}
A \concept{matrix} is an array of numbers organised into rows and columns, and enclosed within brackets.\\
The number of rows is written with the letter $m$ and the number of columns with the letter $n$. So a matrix is said to have the size $m \times n$.
\end{definition}
\begin{example}[hbox]
$\begin{bmatrix}
3 & 2\\
1 & 5
\end{bmatrix}$ is a $2 \times 2$ matrix, and
$\begin{bmatrix}
-1 & 3 & 0 & 5\\
0 & 2 & 0 & 6\\
1 & - 1& 0 & 13
\end{bmatrix}$ is a $3 \times 4$ matrix.
\end{example}
Matrices (pronounced \emph{may-trisseez}) have the form
\begin{align*}
\begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{bmatrix}
\end{align*}
\subsection{Matrix Addition}
\begin{definition}{Matrix Addition}
Let $A$ and $B$ be two matrices of the same size. Then the matrix \concept{$A + B$} is:
\begin{align*}
A + B &= \begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{bmatrix} + \begin{bmatrix}
b_{11} & b_{12} & \cdots & b_{1n}\\
b_{21} & b_{22} & \cdots & b_{2n}\\
\vdots & \vdots & & \vdots\\
b_{m1} & b_{m2} & \cdots & b_{mn}
\end{bmatrix}\\
&= \begin{bmatrix}
a_{11} + b_{11} & a_{12} + b_{12} & \cdots & a_{1n} + b_{1n}\\
a_{21} + b_{21} & a_{22} + b_{22} & \cdots & a_{2n} + b_{2n}\\
\vdots & \vdots & & \vdots\\
a_{m1} + b_{m1} & a_{m2} + b_{m2} & \cdots & a_{mn} + b_{mn}
\end{bmatrix}
\end{align*}
\end{definition}
\begin{example}[width=0.5\textwidth]
Let $A = \begin{bmatrix}
1 & 2\\
3 & 4
\end{bmatrix}$ and
$B = \begin{bmatrix}
5 & 6\\
7 & 8
\end{bmatrix}$
\begin{align*}
A + B &= \begin{bmatrix}
1 & 2\\
3 & 4
\end{bmatrix} + \begin{bmatrix}
5 & 6\\
7 & 8
\end{bmatrix}\\
&= \begin{bmatrix}
1 + 5 & 2 + 6\\
3 + 7 & 4 + 8
\end{bmatrix}\\
&= \begin{bmatrix}
6 & 8\\
10 & 12
\end{bmatrix}
\end{align*}
\end{example}
\begin{exercise}{Self Assessment Exercise \thechapter.8}
\begin{questions}
\item For each pair $A$ and $B$ determine $A + B$ (if possible):
\begin{multicols}{2}
\begin{questions}
\item $A = \begin{bmatrix}-1 & 0\\ 0 & 1\end{bmatrix}$ and $B = \begin{bmatrix}5 & 5 \\ 4 & -1\end{bmatrix}$\\
\begin{answer}
$ \begin{aligned}[t]
A + B &= \begin{bmatrix}
-1 & 0 \\ 0 & 1
\end{bmatrix} + \begin{bmatrix}
5 & 5 \\ 4 & -1
\end{bmatrix}\\
&= \begin{bmatrix}
4 & 5\\ 4 & 0
\end{bmatrix}
\end{aligned} $
\end{answer}
\item $A = \begin{bmatrix}-1 & 0\\ 0 & 1\end{bmatrix}$ and $B = \begin{bmatrix}3 & 2 & 0 \\ 1 & 0 & 0\end{bmatrix}$\\
{\answer This operation is not defined, as the matrices are different sizes.}
\item $A = \begin{bmatrix}2 & 0 & 3\\ 0 & 7 & 1\end{bmatrix}$ and $B = \begin{bmatrix}1 & 1 & -2 \\ 2 & 0 & 6\end{bmatrix}$\\
\begin{answer}
$ \begin{aligned}[t]
A + B &= \begin{bmatrix}
2 & 0 & 3 \\ 0 & 7 & 1
\end{bmatrix} + \begin{bmatrix}
1 & 1 & -2 \\ 2 & 0 & 6
\end{bmatrix}\\
&= \begin{bmatrix}
3 & 1 & 1 \\ 2 & 7 & 7
\end{bmatrix}
\end{aligned} $
\end{answer}
\item $A = \begin{bmatrix}3 & 1\\ -2 & -5\end{bmatrix}$ and $B = \begin{bmatrix}1 & 2 & 0 \\ 2 & 5 & 1\end{bmatrix}$\\
{\answer This operation is not defined, as the matrices are different sizes.}
\end{questions}
\end{multicols}
\end{questions}
\end{exercise}
\subsection{Scalar-Matrix Multiplication}
\begin{definition}[width=0.7\textwidth]{Scalar-Matrix Multiplication}
Let $A$ be a matrix, and $r$ be some scalar number.\\
Then the product \concept{$rA$} is defined as:
\begin{align*}
rA = r \begin{bmatrix}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & & \vdots\\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{bmatrix}
= \begin{bmatrix}
ra_{11} & ra_{12} & \cdots & ra_{1n}\\
ra_{21} & ra_{22} & \cdots & ra_{2n}\\
\vdots & \vdots & & \vdots\\
ra_{m1} & ra_{m2} & \cdots & ra_{mn}
\end{bmatrix}
\end{align*}
\end{definition}
\begin{example}[width=0.42\textwidth]
Let $r = 3$ and $A = \begin{bmatrix}
1 & 2\\
3 & 4
\end{bmatrix}$
\begin{align*}
rA &= 3\begin{bmatrix}
1 & 2\\
3 & 4
\end{bmatrix}
= \begin{bmatrix}
3 & 6\\
9 & 12
\end{bmatrix}
\end{align*}
\end{example}
\begin{exercise}{Self Assessment Exercise \thechapter.9}
\begin{questions}
\item Perform the indicated operation:
$ 2\begin{bmatrix}
-1 \\ 2 \\ 3
\end{bmatrix} - 3 \begin{bmatrix}
2 \\ 1 \\ 0
\end{bmatrix} + 4 \begin{bmatrix}
2 \\ 1 \\ 5
\end{bmatrix} $
\begin{answer}
\begin{align*}
2\begin{bmatrix}
-1 \\ 2 \\ 3
\end{bmatrix} - 3 \begin{bmatrix}
2 \\ 1 \\ 0
\end{bmatrix} + 4 \begin{bmatrix}
2 \\ 1 \\ 5
\end{bmatrix} &= \begin{bmatrix}
-2 \\ 4 \\ 6
\end{bmatrix} + \begin{bmatrix}
-6 \\ -3 \\ 0
\end{bmatrix} + \begin{bmatrix}
8 \\ 4 \\ 20
\end{bmatrix} = \begin{bmatrix}
0 \\ 5 \\ 26
\end{bmatrix}
\end{align*}
\end{answer}
\end{questions}
\end{exercise}
\pagebreak
\subsection{Matrix Multiplication}
\begin{definition}{Matrix Multiplication}
Let $A$ and $B$ both be matrices.
In order for the product \concept{$AB$} to be defined,
\begin{itemize}
\item The number of columns of $A$ needs to be equal to the number of rows of $B$, i.e. $A_{n} = B_{m}$.
\end{itemize}
If the product is defined, then it will result in a matrix that is the size $A_{m} \times B_{n}$.
\begin{center}
\tikz[baseline=(am.base)]\node[inner xsep=0pt] (am) {$A_{m}$}; $\times$ \tikz[baseline=(an.base)]\node[inner xsep=0pt] (an) {$A_{n}$}; $\quad \cdot \quad$ \tikz[baseline=(bm.base)]\node[inner xsep=0pt] (bm) {$B_{m}$}; $\times$ \tikz[baseline=(bn.base)]\node[inner xsep=0pt] (bn) {$B_{n}$}; $= A_{m} \times B_{n}$
\end{center}
\begin{tikzpicture}[overlay]
\draw[<->] (an.south) -- ++(0,-1.5ex) -| (bm.south);
\draw[<->] (am.south) -- ++(0,-2.5ex) -| (bn.south);
\end{tikzpicture}\\
When multiplying matrics, it is row of first multiplied by column of second.
\end{definition}
\begin{example}[width=0.76\textwidth] $
\begin{aligned}[t]
\begin{bmatrix}
-1 & 3\\
4 & 2\\
5 & -7
\end{bmatrix}\begin{bmatrix}
6 & 9\\
-8 & 1
\end{bmatrix} &= \begin{bmatrix}
(-1 \cdot 6) + (3 \cdot -8) & (-1 \cdot 9) + (3 \cdot 1)\\
(4 \cdot 6) + (2 \cdot -8) & (4 \cdot 9) + (2 \cdot 1) \\
(5 \cdot 6) + (-7 \cdot -8) & (5 \cdot 9) + (-7 \cdot 1)
\end{bmatrix}\\
&= \begin{bmatrix}
-6 - 24 & -9 + 3\\
24 - 16 & 36 + 2\\
30 + 56 & 45 - 7
\end{bmatrix}\\
&= \begin{bmatrix}
-30 & -6\\
8 & 38\\
86 & 38
\end{bmatrix}
\end{aligned} $
\end{example}
\subsection{Identity Matrix}
\begin{definition}{Identity Matrix}
If $A$ is matrix, then an \concept{identity matrix} $I$ with respect to $A$ is a matrix such that $IA = AI = A$.\\
For the identity matrix to be defined,
\begin{itemize}
\item $A$ must be a square matrix, because matrix multiplication is \emph{not} commutative.
\item $I$ must therefore also be a square matrix with the same number of rows and columns as $A$.
\end{itemize}
Then the identity matrix would have $1$'s for the main diagonal, and $0$'s elsewhere.
\end{definition}
\begin{example}[width=0.7\textwidth]
For a $2 \times 2$ matrix, the identity matrix would be:
\begin{align*}
I = \begin{bmatrix}
1 & 0\\
0 & 1
\end{bmatrix}
\end{align*}
\end{example}
\pagebreak
\begin{exercise}{Self Assessment Exercise \thechapter.10}
\begin{questions}
\item Perform the indicated matrix operations (if possible)
\begin{questions}
\item
$ \begin{aligned}[t]
{\begin{bmatrix}
31 & -3 & 2\\
2 & 5 & 1\\
3 & 0 & 0
\end{bmatrix} \begin{bmatrix}
0 \\ 1 \\ 5
\end{bmatrix}}
\end{aligned}$
\begin{answer}
$ = \begin{aligned}[t]
\begin{bmatrix}
(31 \cdot 0) + (-3 \cdot 1) + (2 \cdot 5)\\
(2 \cdot 0) + (5 \cdot 1) + (1 \cdot 5)\\
(3 \cdot 0) + (0 \cdot 1) + (0 \cdot 5)
\end{bmatrix}
= \begin{bmatrix}
0 - 3 + 10\\
0 + 5 + 5\\
0 + 0 + 0
\end{bmatrix}
= \begin{bmatrix}
7\\
10\\
0
\end{bmatrix}
\end{aligned} $
\end{answer}
\item $\begin{bmatrix}9 & 3\\ 1 & 5\\ 3 & 0\end{bmatrix}\begin{bmatrix}1 & 0\\ 2 & 4\\ 5 & 1\end{bmatrix}$\\
{\answer This operation is not defined.}
\item $\begin{bmatrix}
1 & -3 & 2\\
0 & 6 & 4\\
3 & 0 & 3
\end{bmatrix} \begin{bmatrix}
0 & -1 & 3\\
1 & \frac{1}{3} & 1\\
\frac{1}{2} & 5 & 0
\end{bmatrix}$ \\
\begin{answer}
$ \begin{aligned}[t]
= \, &\begin{bmatrix}
(1 \cdot 0) + (-3 \cdot 1) + \left(2 \cdot \frac{1}{2}\right) & (1 \cdot - 1) + \left(-3 \cdot \frac{1}{3}\right) + (2 \cdot 5) & (1 \cdot 3) + (-3 \cdot 1) + (2 \cdot 0)\\
(0 \cdot 0) + (6 \cdot 1) + \left(4 \cdot \frac{1}{2}\right) & (0 \cdot -1) + \left(6 \cdot \frac{1}{3}\right) + (4 \cdot 5) & (0 \cdot 3) + (6 \cdot 1) + (4 \cdot 0)\\
(3 \cdot 0) + (0 \cdot 1) + \left(3 \cdot \frac{1}{2}\right) & (3 \cdot -1) + \left(0 \cdot \frac{1}{3}\right) + (3 \cdot 5) & (3 \cdot 3) + (0 \cdot 1) + (3 \cdot 0)
\end{bmatrix}\\
= \, &\begin{bmatrix}
(0 - 3 + 1) & (- 1 - 1 + 10) & (3 - 3 + 0)\\
(0 + 6 + 2) & (0 + 2 + 20) & (0 + 6 + 0)\\
\left(0 + 0 + \frac{3}{2}\right) & (-3 + 0 + 15) & (9 + 0 + 0)
\end{bmatrix}\\
= \, &\begin{bmatrix}
-2 & 8 & 0\\
8 & 22 & 6\\
\frac{3}{2} & 12 & 9
\end{bmatrix}
\end{aligned}$
\end{answer}
\end{questions}
\item Provide examples of matrices $X$ and $Y$ such that $XY$ is a $3 \times 3$ matrix, but $YX$ is a $2 \times 2$~matrix.\\
\begin{answer}
Any matrices $X$ and $Y$ such that $X$ is a $2 \times 3$ matrix, and $Y$ is a $3 \times 2$ matrix.\\
Two examples: \quad
$ \begin{aligned}[t]
A_{1} = \begin{bmatrix}
1 & 2 & 3\\
4 & 5 & 6
\end{bmatrix} \text{ and }
B_{1} = \begin{bmatrix}
1 & 2\\
3 & 4\\
5 & 6
\end{bmatrix}\\
A_{2} = \begin{bmatrix}
2 & 4 & 6\\
8 & 6 & 4
\end{bmatrix} \text{ and }
B_{2} = \begin{bmatrix}
3 & 6\\
9 & 6\\
3 & 0
\end{bmatrix}
\end{aligned} $
\end{answer}
\item Provide examples of matrices $X$ and $Y$ such that both $X$ and $Y$ have at least some non-zero entries, but $XY$ is the $2 \times 2$~zero~matrix.\\
\begin{answer}
Any matrix $A$ that has a zero column, where matrix $B$ has a zero row that are at different indexes.\\
Example: \quad $
\begin{aligned}[t]
A = \begin{bmatrix}
0 & 4\\
0 & 5
\end{bmatrix} \text{ and }
B = \begin{bmatrix}
6 & 8\\
0 & 0
\end{bmatrix}
\end{aligned}$
\end{answer}
\pagebreak
\item Prove that addition is a commutative operation on the set of $2 \times 2$~matrices, and that there is a $2 \times 2$~matrix that acts as an identity element in respect of addition.
\begin{answer}
\begin{proof}
Let $A$ and $B$ be two $2 \times 2$~matrices, where $A = \begin{bmatrix}a & b\\ c & d\end{bmatrix}$ and $B = \begin{bmatrix}e & f\\g & h\end{bmatrix}$.
\begin{subproof}[Commutativity]
Then: $ \begin{aligned}[t]
A + B &= \begin{bmatrix}a & b\\ c & d\end{bmatrix} + \begin{bmatrix}e & f\\g & h\end{bmatrix}\\
&= \begin{bmatrix}
a + e & b + f\\
c + g & d + h
\end{bmatrix}\\
B + A &= \begin{bmatrix}e & f\\g & h\end{bmatrix} + \begin{bmatrix}a & b\\ c & d\end{bmatrix}\\
&= \begin{bmatrix}
e + a & f + b\\
g + c & h + d
\end{bmatrix} = \begin{bmatrix}
a + e & b + f\\
c + g & d + h
\end{bmatrix}
\end{aligned}$\\
As $A + B = B + A$, matrix addition is commutative.
\end{subproof}
\begin{subproof}[Identity]
The identity element for matrix addition on $2 \times 2$~matrices is $\begin{bmatrix}0 & 0 \\ 0 & 0\end{bmatrix}$
\end{subproof}
So, matrix addition is commutative, and an identity element exists for matrix addition.
\end{proof}
\end{answer}
\item Prove that multiplication is \emph{not} a commutative operation on the set of $2 \times 2$ matrices, and that there is a $2 \times 2$~matrix that acts as an identity element in respect of multiplication.
\begin{answer}
\begin{proof}
$ $
\begin{subproof}[Commutativity Counterexample] Let
$A = \begin{bmatrix}1 & 2\\ 3 & 4
\end{bmatrix}$ and $B = \begin{bmatrix}4 & 3 \\ 2 & 1\end{bmatrix}$
\begin{align*}
AB &= \begin{bmatrix}
1 & 2 \\ 3 & 4
\end{bmatrix}\begin{bmatrix}
4 & 3 \\ 2 & 1
\end{bmatrix} = \begin{bmatrix}
(1 \cdot 4) + (2 \cdot 2) & (1 \cdot 3) + (2 \cdot 1)\\
(3 \cdot 4) + (4 \cdot 2) & (3 \cdot 3) + (4 \cdot 1)
\end{bmatrix} = \begin{bmatrix}
4 + 4 & 3 + 2\\
12 + 8 & 9 + 4
\end{bmatrix} = \begin{bmatrix}
8 & 5\\
20 & 13
\end{bmatrix}\\
BA &= \begin{bmatrix}
4 & 3 \\ 2 & 1
\end{bmatrix} \begin{bmatrix}
1 & 2 \\ 3 & 4
\end{bmatrix} = \begin{bmatrix}
(4 \cdot 1) + (3 \cdot 3) & (4 \cdot 2) + (3 \cdot 4)\\
(2 \cdot 1) + (1 \cdot 3) & (2 \cdot 2) + (1 \cdot 4)
\end{bmatrix} = \begin{bmatrix}
4 + 9 & 8 + 12\\
2 + 3 & 4 + 4
\end{bmatrix} = \begin{bmatrix}
13 & 20\\
5 & 8
\end{bmatrix}
\end{align*}
As $AB \neq BA$, matrix multiplication is not commutative.
\end{subproof}
\begin{subproof}[Identity]
The identity element for matrix multiplication is the identity matrix. For a $2 \times 2$ matrix, that is $\begin{bmatrix}1 & 0 \\ 0 & 1\end{bmatrix}$
\end{subproof}
So, matrix multiplication is not commutative, and an identity element exists for matrix multiplication.
\end{proof}
\end{answer}
\end{questions}
\end{exercise}
\rulechapterend
\end{document}