From dc42625cf10e0e8e2718e7ef7016eee89363ab63 Mon Sep 17 00:00:00 2001 From: bluepython508 Date: Mon, 22 Jan 2024 10:56:12 +0000 Subject: [PATCH] . --- CS1029/notes-2023-11-15 | 1 + CS1029/notes-2023-11-21 | 0 CS1029/notes-2023-11-28 | 1 + CS1029/practical-2023-11-17/combinatorics | 37 ++++++ CS1029/practical-2023-11-24/probability | 24 ++++ .../__pycache__/crypt.cpython-310.pyc | Bin 0 -> 997 bytes .../__pycache__/nqueens.cpython-310.pyc | Bin 0 -> 1541 bytes .../__pycache__/pat.cpython-310.pyc | Bin 0 -> 495 bytes CS1032/lecture-2023-11-23/crypt.py | 17 +++ CS1032/lecture-2023-11-23/nqueens.pl | 19 +++ CS1032/lecture-2023-11-23/nqueens.py | 18 +++ CS1032/lecture-2023-11-23/pat.py | 7 ++ CS1032/notes-2023-11-16 | 1 + CS1032/notes-2023-11-17 | 0 CS1032/practical-2023-11-15/decomment.py | 4 + CS1032/practical-2023-11-15/pass.py | 11 ++ CS1032/practical-2023-11-15/redact.py | 6 + CS1032/practical-2023-11-15/sum.py | 9 ++ CS1032/practical-2023-11-22/search.py | 33 +++++ MA1006/linear.tex | 115 ++++++++++++++++-- 20 files changed, 293 insertions(+), 10 deletions(-) create mode 100644 CS1029/notes-2023-11-15 create mode 100644 CS1029/notes-2023-11-21 create mode 100644 CS1029/notes-2023-11-28 create mode 100644 CS1029/practical-2023-11-17/combinatorics create mode 100644 CS1029/practical-2023-11-24/probability create mode 100644 CS1032/lecture-2023-11-23/__pycache__/crypt.cpython-310.pyc create mode 100644 CS1032/lecture-2023-11-23/__pycache__/nqueens.cpython-310.pyc create mode 100644 CS1032/lecture-2023-11-23/__pycache__/pat.cpython-310.pyc create mode 100644 CS1032/lecture-2023-11-23/crypt.py create mode 100644 CS1032/lecture-2023-11-23/nqueens.pl create mode 100644 CS1032/lecture-2023-11-23/nqueens.py create mode 100644 CS1032/lecture-2023-11-23/pat.py create mode 100644 CS1032/notes-2023-11-16 create mode 100644 CS1032/notes-2023-11-17 create mode 100644 CS1032/practical-2023-11-15/decomment.py create mode 100644 CS1032/practical-2023-11-15/pass.py create mode 100644 CS1032/practical-2023-11-15/redact.py create mode 100644 CS1032/practical-2023-11-15/sum.py create mode 100644 CS1032/practical-2023-11-22/search.py diff --git a/CS1029/notes-2023-11-15 b/CS1029/notes-2023-11-15 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/CS1029/notes-2023-11-15 @@ -0,0 +1 @@ + diff --git a/CS1029/notes-2023-11-21 b/CS1029/notes-2023-11-21 new file mode 100644 index 0000000..e69de29 diff --git a/CS1029/notes-2023-11-28 b/CS1029/notes-2023-11-28 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/CS1029/notes-2023-11-28 @@ -0,0 +1 @@ + diff --git a/CS1029/practical-2023-11-17/combinatorics b/CS1029/practical-2023-11-17/combinatorics new file mode 100644 index 0000000..3ff8a97 --- /dev/null +++ b/CS1029/practical-2023-11-17/combinatorics @@ -0,0 +1,37 @@ +1. a) 5 8 7 * * = 280 + b) 6 1 + 6 * 1 + 6 * = 258 + c) 26 2 ^ 36 4 ^ * = 1 135 420 416 + d) 17 3 P = 4080 + e) 26 2 P 34 4 P * = 723 465 600 + f) 8 5 C 11 7 C * = 18 480 + +2. a) 8 2 C 5 2 C 3 2 C * * = 840 + b) 8 2 C 14 4 C * = 28 028 + +3. a) (sides + 1), or 7 for the likely indented d6 + b) (sides_1 + sides_2), or 1 for the likely intended d6 + c) 5 + +4. (Assuming the unaccented latin alphabet only) + 26 3 ^ = 17 576 + +5. 26 2 ^ 10 4 ^ 10 2 ^ + 26 4 ^ * * = 3 120 049 337 600 + +6. 99 50 * 1 + = 4 951 + +7. a) 10 4 C = 210 + b) 10 4 C 10 3 C 10 2 C 10 1 C + + + = 385 + c) 10 4 C 10 5 C 10 6 C 10 7 C 10 8 C 10 9 C 1 + + + + + + = 848 + +8. a) 100 4 P = 94 109 400 + b) 99 3 P = 941 094 + c) 99 4 P = 90 345 024 + d) 97 4 ! * = 2 328 + +9. a) 25 4 C = 12 650 + b) 25 4 P = 303 600 + +10. 3 5 ^ = 243 + +11. 5 3 ^ 3 ! / = 20 + diff --git a/CS1029/practical-2023-11-24/probability b/CS1029/practical-2023-11-24/probability new file mode 100644 index 0000000..06f7837 --- /dev/null +++ b/CS1029/practical-2023-11-24/probability @@ -0,0 +1,24 @@ +01. 4 52 / = 1/13 +02. 50 100 / = 1/2 +03. 1 1 52 5 C / - = 2598959/2598960 +04. 4 1 C 52 5 C / 4 2 C 52 5 C / 4 3 C 52 5 C / 1 52 5 C / sum = 1/173264 +05. + a) 1 50 5 C / = 1/2118760 + b) 1 52 5 C / = 1/2598960 + c) 1 56 5 C / = 1/3819816 + d) 1 60 5 C / = 1/5461512 +06. + a) 1 200 3 P / = 1/7880400 + b) 1 200 / 3 ^ = 1/8000000 +07. + a) 1 26 ! / = 1/403291461126605635584000000 + b) 1 26 / = 1/26 +08. 4 3 C 1 2 / 4 ^ * = 1/4 +09. 6 1 C 1 2 / 6 ^ * = 3/32 +10. 2 5 / 1 2 / * 1 3 / / = 3/5 +11. P(U|P) = P(P|U)P(U) / P(P|U)P(U) + P(P|U')P(U') + ) 96 % 8 % * 96 % 8 % * 1 8 % - 9 % * + / = 64/133 +12. + a) 8 % 98 % * 8 % 98 % * 1 8 % - 3 % * + / = 196/265 + b) 1 196 265 / - = 69/265 + c) 2 % 8 % * 2 % 8 % * 92 % 97 % * + / = 4/2235 diff --git a/CS1032/lecture-2023-11-23/__pycache__/crypt.cpython-310.pyc b/CS1032/lecture-2023-11-23/__pycache__/crypt.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7389c19964bc96c9576551fd80f9044a3cb74259 GIT binary patch literal 997 zcmd1j<>g{vU|Oqw^)-alXFu2ZZYQ;r{7}EPOZGfR+L&& zT9lW}1X2sd%nS?+AO|~x9BjqFz)-@_%uvfz!?b|0hH(K?3gbe?g^Y|0HB1Yb7c$f` zmawESr7*WJl(5z?l(5w>HZwLexiB;{HZuk@XtMa-Vks?2vq)xy8V;gB7JzUu$O0J# z28Kq48irWT7^YgrTBaJt8YV}EFa}13LZ%dkUz*Q}arS^-J?I^__za4UCQSb5fH_N{do;jSP&8bqx)5 zjg0k^iz*9B^a?6(aoVJ(=A~8?6xo5|u9$^^fq|((ilIsZqQWL8KRGd{*iH|wOq0C` z6im0+N()jFOHyyKrRF8)r=&))rDUe37MI*&O{y$OExyHEm03^(@}4Gh5y;RYRt5%! zDAw%M%J>Yhvmpcz0|Ub?Rg{vU|=|0my-IGiGkrUh=Yuo85kHG7#J9eZ5S9BQW#PgTNt7kQkYVhTNt7k zQ}|L?Q`lMk+FVW zVQFe=Ua?+5)t#I#gKkfT99;9%rn)L<-PWnf@H@g2ygAVFo2LQwEEGL$gXFg7!~ zFvLo9GL|s5Gqf|NF{Lo3Ftu=$Fm*71WSSY98H;4o89EpiF?KLcWDH^mV_;+`WKCfR zX3%8zO9t5r3qgtvzdx`YQO;s3X2lP8c=jFxiG|X)iRYZ z)qumwl_7<}0~F+fAT^NiVlDzX0Bqka?&AEMQm}91i!_aw% zT9Xm1Z6zbvO0W=w0D1TpC){ZwAUi?HgNw093|G1Y*;On7%F&Dq7}^=q7{NK3qlUqS zp_y?ZV=#jzi{C9qE)+L{%mk%raFR2CB{|_*#uSDcMiGV-MsbD|h7N`rMhS)#CJ6=+ z262WIW^r(k7c!-=1T$!|{$f=4#i;xe`ToX)=RD{uXONQD$BV*aA%^h;wA&-h=z`7C$`h;=vlEK#l{YZ5~EGMlME{e?C^owhL?tSREu$fK3MzU~hBSg{vU|`VAj!&J+z`*br#6iZ)3=9ko3=9m#5)2FsDeNhXDNHSlQ4A>@DJ&_h zEsRl&DQv+Enw&2=85kIn8Ig1{F)%Q&GB7YWgEXr#Fff!bq%hVnG&8v{#B$d%mN2F; z)i9MD9X$$ zS;=&ZG4B>*#Y%=E9tH-6UzYlz#i>Qb`bnvI`Y!p&rManjCB^!sd71jo!G;FLM*2Ca z$t9&lsk%l6M#j2^hPp<^`UQz4dIgoY7;`{&6|*rgFz_*oFtYqF;$vW7cnNYhZqI0e zJyXMw!kEI?% bytes: + key_h = sha256() + key_h.update(key.encode('utf8')) + key = key_h.digest() + + return bytes(p ^ k for (p, k) in zip(msg, cycle(key))) + +def encrypt(msg: str, key: str) -> str: + return base64.b64encode(crypt(bytes(msg, 'utf8'), key)).decode('utf8') + +def decrypt(msg: str, key: str) -> str: + return crypt(base64.b64decode(msg), key).decode('utf8') + diff --git a/CS1032/lecture-2023-11-23/nqueens.pl b/CS1032/lecture-2023-11-23/nqueens.pl new file mode 100644 index 0000000..a598ca7 --- /dev/null +++ b/CS1032/lecture-2023-11-23/nqueens.pl @@ -0,0 +1,19 @@ +safe(Q1X-Q1Y, Q2X-Q2Y) :- + between(0, 7, Q1Y), + between(0, 7, Q2Y), + Q1X =\= Q2X, + Q1Y =\= Q2Y, + abs(Q1X - Q2X) =\= abs(Q1Y - Q2Y). +safe(_, []). +safe(QN, [Q | QS]) :- safe(QN, [Q | QS], 1). +safe(_, [], _). +safe(QN, [Q | QS], QX) :- safe(0-QN, QX-Q), safe(QN, QS, QX + 1). + +add(Qs, QsN) :- + QsN = [Q | Qs], + safe(Q, Qs). + +add(1, Qs, QsN) :- add(Qs, QsN). +add(N, Qs, QsN) :- add(Qs, QA), add(M, QA, QsN), succ(M, N). + +solution(Qs) :- add(8, [], Qs). diff --git a/CS1032/lecture-2023-11-23/nqueens.py b/CS1032/lecture-2023-11-23/nqueens.py new file mode 100644 index 0000000..8b8adaf --- /dev/null +++ b/CS1032/lecture-2023-11-23/nqueens.py @@ -0,0 +1,18 @@ +def safe(q1, q2): + (q1x, q1y) = q1 + (q2x, q2y) = q2 + return q1x != q2x and q1y != q2y and abs(q1x - q2x) != abs(q1y - q2y) + +def possible_positions(current, n): + return ((*current, y) for y in range(n) if all(safe((len(current), y), q) for q in enumerate(current))) + +def solutions_r(current, n = 8): + if len(current) == n: + yield current + return + + for pos in possible_positions(current, n): + yield from solutions_r(pos, n) + +def solutions(n = 8): + return solutions_r((), n) diff --git a/CS1032/lecture-2023-11-23/pat.py b/CS1032/lecture-2023-11-23/pat.py new file mode 100644 index 0000000..43d3bb9 --- /dev/null +++ b/CS1032/lecture-2023-11-23/pat.py @@ -0,0 +1,7 @@ +def l(n=9): + for x in range(1, n): + print(" " * (x % 2), "*") + +def r(n=5): + for x in range(n, -1, -1): + print("*" * (x * 2 + 1)) diff --git a/CS1032/notes-2023-11-16 b/CS1032/notes-2023-11-16 new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/CS1032/notes-2023-11-16 @@ -0,0 +1 @@ + diff --git a/CS1032/notes-2023-11-17 b/CS1032/notes-2023-11-17 new file mode 100644 index 0000000..e69de29 diff --git a/CS1032/practical-2023-11-15/decomment.py b/CS1032/practical-2023-11-15/decomment.py new file mode 100644 index 0000000..884a8ad --- /dev/null +++ b/CS1032/practical-2023-11-15/decomment.py @@ -0,0 +1,4 @@ +import sys + +for line in sys.stdin: + print(line.split('#')[0].rstrip()) diff --git a/CS1032/practical-2023-11-15/pass.py b/CS1032/practical-2023-11-15/pass.py new file mode 100644 index 0000000..1f8f26f --- /dev/null +++ b/CS1032/practical-2023-11-15/pass.py @@ -0,0 +1,11 @@ +#! /usr/bin/env python3 +import sys, random + +with open(sys.argv[1]) as words_f: + words = [word for line in words_f if 3 <= len(word := line.strip()) < 10 and word.lower() == word] + +pair = [] +while not 8 <= sum(map(len, pair)) <= 10: + pair = random.choices(words, k=2) + +print(''.join(w.title() for w in pair)) \ No newline at end of file diff --git a/CS1032/practical-2023-11-15/redact.py b/CS1032/practical-2023-11-15/redact.py new file mode 100644 index 0000000..0d9940d --- /dev/null +++ b/CS1032/practical-2023-11-15/redact.py @@ -0,0 +1,6 @@ +#! /usr/bin/env python3 +import sys, re +redacted = re.compile(f"({'|'.join([s.strip() for s in open(sys.argv[1])])})") + +for line in sys.stdin: + print(redacted.sub(lambda m: '*' * len(m.group(0)), line), end='') diff --git a/CS1032/practical-2023-11-15/sum.py b/CS1032/practical-2023-11-15/sum.py new file mode 100644 index 0000000..2c13190 --- /dev/null +++ b/CS1032/practical-2023-11-15/sum.py @@ -0,0 +1,9 @@ +#! /usr/bin/env python3 + +sum = 0 +while True: + i = input(f"[{sum:g}]: ") + if not i: break + try: + sum += float(i) + except ValueError: print(f"\t'{i}' is not a number") diff --git a/CS1032/practical-2023-11-22/search.py b/CS1032/practical-2023-11-22/search.py new file mode 100644 index 0000000..c96d93d --- /dev/null +++ b/CS1032/practical-2023-11-22/search.py @@ -0,0 +1,33 @@ +#! /usr/bin/env python3 + +def sort(list): + if len(list) <= 1: return list + pivot = list.pop() + return sort([v for v in list if v < pivot]) + [v for v in list if v == pivot] + [pivot] + sort([v for v in list if v > pivot]) + +def search(list, elem, start=0): + if list == [elem]: + return start + elif len(list) <= 1: + return None + i = len(list) // 2 + pivot = list[i] + if elem > pivot: + return search(list[i:], elem, start = i + start) + elif elem < pivot: + return search(list[:i], elem, start=start) + elif elem == pivot: + return i + start + + raise ValueError("Got NaN!") + +if __name__ == '__main__': + l = [] + while line := input('> '): + l.append(line) + + i = search(sort(l), input('Goal: ')) + if i: + print(f"Found at {i}") + else: + print("Not present") diff --git a/MA1006/linear.tex b/MA1006/linear.tex index 7b860ff..d7fb2d4 100644 --- a/MA1006/linear.tex +++ b/MA1006/linear.tex @@ -45,7 +45,7 @@ Solutions invariant. \end{align*} \section*{As Matrices} \begin{align*} - \systeme{ + & \systeme{ x + 2y = 1, 2x - y = 3 } @@ -53,8 +53,8 @@ Solutions invariant. \begin{pmatrix}[cc|c] 1 & 2 & 1 \\ 2 & -1 & 3 - \end{pmatrix} - & \systeme{ + \end{pmatrix} \\ + & \systeme{ x - y + z = -2, 2x + 3y + z = 7, x - 2y - z = -2 @@ -347,12 +347,107 @@ Inversion of a linear transformation is equivalent to inversion of its represent \[ \forall A: \text{$n$x$n$ matrix}.\quad P_A\paren{\lambda} = \det{\paren{A - \lambda I_n}} \tag{characteristic polynomial in $\lambda$}\] Eigenvalues of $A$ are the solutions of $P_A\paren{\lambda} = 0$ \begin{align*} - & A\vec{x} = \lambda\vec{x} & x \neq 0\\ - \iff & A\vec{x} - \lambda\vec{x} = 0 \\ - \iff & (A - \lambda I_n)\vec{x} = 0 \\ - \iff & \det{\paren{A - \lambda I_n}} = 0 \\ - & \quad \text{ or $\paren{A - \lambda I_n}$ is invertible and $x = 0$ } + & A\vec{x} = \lambda\vec{x} & x \neq 0 \\ + \iff & A\vec{x} - \lambda\vec{x} = 0 \\ + \iff & (A - \lambda I_n)\vec{x} = 0 \\ + \iff & \det{\paren{A - \lambda I_n}} = 0 \\ + & \quad \text{ or $\paren{A - \lambda I_n}$ is invertible and $x = 0$ } \end{align*} -\[ P_{R\theta}(\lambda) = \frac{2\cos{\theta} \pm \sqrt{-4\lambda^2\sin^2{\theta}}}{2}\] +\[ P_{R\theta}(\lambda) \text{ has roots } \frac{2\cos{\theta} \pm \sqrt{-4\lambda^2\sin^2{\theta}}}{2}\] \[ R_\theta \text{ has eigenvalues }\iff \sin{\theta} = 0 \] -\end{document} \ No newline at end of file +\subsubsection*{Example} +\begin{align*} + A & = \begin{pmatrix} 4 & 0 & 1 \\ -2 & 1 & 0 \\ -2 & 0 & 1 \end{pmatrix} \\ + P_A(\lambda) & = \det{A - \lambda I_3} = \det{\begin{pmatrix} 4 - \lambda & 0 & 1 \\ -2 & 1 - \lambda & 0 \\ -2 & 0 & 1 - \lambda \end{pmatrix}} = (1 - \lambda)\det{\begin{pmatrix}4 - \lambda & 1 \\ -2 & 1 - \lambda \end{pmatrix}} \\ + & = (1 - \lambda)\paren{(4 - \lambda)(1 - \lambda) + 2} = (1 - \lambda)(\lambda^2 - 5\lambda + 6) \\ + & = (1 - \lambda)(2 - \lambda)(3 - \lambda) \\ + \lambda & = 1, 2, 3 \\ + A\vec{x} & = \lambda\vec{x}~\forall. \text{ eigenvectors } \vec{x} \\ + (A - \lambda I_n)\vec{x} & = 0 \\ + & \begin{pmatrix} 3 & 0 & 1 \\ -2 & 0 & 0 \\ -2 & 0 & 0 \end{pmatrix}\vec{x} = \begin{pmatrix} 0 \\ 0 \\ 0 \end{pmatrix} \\ + & \text{ eigenvectors with eigenvalue 1 are } s\vec{e}_2~~\forall~s \in \R, \neq 0 \\ + (A - 2I_n)\vec{x} & = 0 \\ + & \begin{pmatrix} 2 & 0 & 1 \\ -2 & -1 & 0 \\ -2 & 0 & -1 \end{pmatrix}\vec{x} = \begin{pmatrix} 0 \\ 0 \\ 0\end{pmatrix} \\ + & \systeme{ + 2x_1 + x_3 = 0, + -2x_1 - x_2 = 0, + -2x_1 -x_3 = 0 + }: s\begin{pmatrix} 1 \\ -2 \\ -2 \end{pmatrix} \\ \\ + B & = \begin{pmatrix} 5 & 3 & 3 \\ -3 & -1 & -3 \\ -1 & -3 & -1 \end{pmatrix} +\end{align*} +Repeated roots of the characteristic polynomial lead to multiple variables. +\[ \forall \text{ matrices } A.~A \text{ is invertible } \iff 0 \text{ is not an eigenvalue }\] +\begin{align*} + \text{If $0$ is an eigenvalue, } P_A(0) = 0 \therefore \det{\paren{A - 0I_n}} = 0 +\end{align*} +\[ P_A(\lambda) = \det{\paren{(-I_n)(\lambda I_n - A)}} = \det{-I_n}\det{\lambda I_n - A}\] +\[ = (-1)^n \lambda^n + c_{n-1}\lambda^{n-1} ... \] +\begin{description} + \item[Trace] The sum of the diagonal of a matrix + \[ c_{n - 1} = (-1)^{n+1}\operatorname{tr}A \] + \item[Cayley-Hamilton Theorem:] \( P_A(A) = 0_n \) +\end{description} +\subsubsection*{Example} +\begin{align*} + A & = \begin{pmatrix} 1 & 4 \\ 3 & 2 \end{pmatrix} \\ + P_A(\lambda) & = (1 - \lambda)(2 - \lambda) - 12 \\ + & = 2 - 3\lambda + \lambda^2 - 12 \\ + & = \lambda^2 - 3\lambda - 10 \\ + P_A & (5 \text{ or } -2) = 0 \\ + P_A(A) & = 0 \\ + A^2 & = 3A - 10I_2 \\ + A^3 & = (3A - 10I_2)A \\ + A^{n + 2} & = 3A^{n+1} + 10A^n +\end{align*} +\subsection*{Diagonalization} +\begin{description} + \item[Similarity of matrices] $A$ and $B$ are \emph{similar} iff there exists an invertible matrix $P$ such that $B = P^{-1}AP$ + \[ T_\alpha \text{ is similar to } T_0 (P = R_{-\alpha}) \] +\end{description} + +For similar $A$, $B$: +\begin{itemize} + \item $\det{A}$ = $\det{B}$ + \item $P_A(\lambda) = P_B(\lambda)$ + \[\det{\paren{A - \lambda I_n}} = \det{\paren{PBP^{-1} - \lambda PP^{-1}}} = \det{\paren{P(B - \lambda I_n)P^{-1}}}\] + \[ (A - \lambda I_n) \text{ and } (B - \lambda I_n) \text{ are similar }\] + \item eigenvalues are the same + \item trace is the same +\end{itemize} + +\begin{description} + \item[Diagonalizable Matrix] a square matrix that is similar to a diagonal matrix + \[ P^{-1}AP = D \] + $P$ diagonalizes $A$ \quad + (P is not necessarily unique) +\end{description} +An $n$x$n$ matrix $A$ is dagonalizable iff there exists a matrix $P = (\vec{x}_1, \vec{x}_2, ...)$, where $\vec{x}_i$ is an eigenvector of $A$ +\[ P^{-1}AP = \begin{pmatrix} \lambda_1 & 0 & \cdots & \cdots \\ 0 & \lambda_2 & 0 & \cdots \\ \vdots & \vdots & \ddots & \cdots \end{pmatrix} \] +i.e. it's diagonal, with the $ii^\text{th}$ element equal to the eigenvalue corresponding to $\vec{x}_i$ +\subsubsection*{Example} +\begin{align*} + A & = \begin{pmatrix} 4 & 0 & 1 \\ -2 & 1 & 0 \\ -2 & 0 & 1 \end{pmatrix} \\ + \lambda_1 & = \begin{pmatrix} 0 \\ s \\ 0 \end{pmatrix} \\ \lambda_2 & = \begin{pmatrix} t \\ -2t \\ -2t \end{pmatrix} \\ \lambda_3 & = \begin{pmatrix} u \\ -u \\ -u \end{pmatrix} \\ + P & = \begin{pmatrix} + 0 & 1 & 1 \\ + 1 & -2 & -1 \\ + 0 & -2 & -1 + \end{pmatrix} \\ + P^{-1} & = \begin{pmatrix} + 0 & 1 & -1 \\ -1 & 0 & -1 \\ 2 & 0 & 1 + \end{pmatrix} \\ + P^{-1}AP & = \begin{pmatrix} + 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 + \end{pmatrix} +\end{align*} +\subsection*{Linear Independence} +For any set of vectors $V = { v_i }~\forall_{i