2023-11-15
This commit is contained in:
6
CS1029/notes-2023-11-01
Normal file
6
CS1029/notes-2023-11-01
Normal file
@@ -0,0 +1,6 @@
|
||||
Edge contractions: merge two vertices, removing an edge between them
|
||||
Representations: adjacency list
|
||||
adjacency matrix
|
||||
What does the determinant of an adjacency matrix mean?
|
||||
incidence matrix: vertices against edges, 1 where edge is connected to vertex
|
||||
|
||||
1
CS1029/notes-2023-11-07
Normal file
1
CS1029/notes-2023-11-07
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
CS1029/notes-2023-11-08
Normal file
1
CS1029/notes-2023-11-08
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
CS1029/notes-2023-11-14
Normal file
1
CS1029/notes-2023-11-14
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
58
CS1029/practical-2023-11-03/relations
Normal file
58
CS1029/practical-2023-11-03/relations
Normal file
@@ -0,0 +1,58 @@
|
||||
1. a) {(1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (2, 2), (2, 3), (2, 4), (2, 5), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5), (5, 5) }
|
||||
Reflexive: \forall x. (x, x) \in R
|
||||
Antisymmetric (& not symmetric): all pairs have x <= y. forall x, y. x <= y, !(y <= x) || y == x
|
||||
Transitive
|
||||
b) {(1, 2), (1, 4), (2, 1), (2, 3), (3, 2), (3, 4), (4, 1), (4, 3)}
|
||||
Not reflexive: there are no pairs of (x, x)
|
||||
Symmetric - all pairs have their reverse represented
|
||||
Not antisymmetric: symmetric and anti-symmetric are mutually exclusive
|
||||
Not transitive: (1, 2) and (2, 3) - 1 + 3 is not odd
|
||||
|
||||
2. {(item, quantity)}
|
||||
{(Name, {(key, value)})}
|
||||
{(Name, Address, {(Room type, price, {(key, value)})}, ...)}
|
||||
|
||||
3. 105 305 306 505 705 707 905 906 909
|
||||
|
||||
4. a) ab ac bc cb
|
||||
b) {(a, a), (a, b), (a, c), (b, b), (b, a), (b, c), (c, a), (c, b), (d, d)}
|
||||
|
||||
5.a) {(1, 1), (1, 2), (1, 4), (2, 1), (2, 3), (3, 2), (3, 3), (3, 4), (4, 1), (4, 3), (4, 4)}
|
||||
Not reflexive: (2, 2) is not present
|
||||
Symmetric, therefore not anti-symmetric
|
||||
Not transitive: (1, 2) and (2, 3), but not (1, 3)
|
||||
|
||||
b) 12 21 14 41 32 23 43 34
|
||||
Not reflexive
|
||||
Symmetric, therefore not antisymmetric
|
||||
Not transitive: 12 and 23 but not 13
|
||||
|
||||
6. 1 1 0 0
|
||||
1 1 0 0
|
||||
1 0 1 1
|
||||
0 0 0 1
|
||||
|
||||
Yes, it's reflexive
|
||||
|
||||
8. {(a, b) | a divides b OR b divides a}
|
||||
9. No, it's not transitive. (a, b) & (b, d), but not (a, d)
|
||||
10. a) Not equivalence relation: missing transitivity
|
||||
(1, 3) and (3, 2), but not (1, 2)
|
||||
b) {0}, {1, 2}, {3}
|
||||
11. \forall n \in N_0:
|
||||
0 + 3n
|
||||
1 + 3n
|
||||
2 + 3n
|
||||
|
||||
12. a) Y
|
||||
b) N: 0 is in both - not disjoint
|
||||
c) Y
|
||||
d) N: 0 is missing
|
||||
|
||||
13. a) 00 11 22 33 44 55 12 21 34 43 35 53 45 54
|
||||
b) 00 11 22 33 44 55 01 10 23 32 45 54
|
||||
c) 00 11 22 33 44 55 01 10 02 20 12 21 34 43 35 53 45 54
|
||||
|
||||
14. a) Y, trivially
|
||||
b) N: not antisymmetric ((2, 3) and (3, 2))
|
||||
c) N: not reflexive (no (3, 3))
|
||||
64
CS1029/practical-2023-11-10/graphs
Normal file
64
CS1029/practical-2023-11-10/graphs
Normal file
@@ -0,0 +1,64 @@
|
||||
1. Undirected, unlooped, multi-edged: multigraph
|
||||
b) directed, looped, multi-edged: directed pseudo-multigraph
|
||||
|
||||
2. ac bd
|
||||
b) cd cd dd ee ab bc
|
||||
|
||||
3. {{paper}}
|
||||
|
||||
4. vertices: 6
|
||||
edges: 6
|
||||
degree: a: 2 b: 4 c: 1 f: 3 e: 2 d: 0
|
||||
isolated: d
|
||||
pendant: c
|
||||
b) vertices: 5
|
||||
edges: 14
|
||||
degree: a: 6 b: 6 c: 6 d: 5 e: 3
|
||||
isolated: -
|
||||
pendant: -
|
||||
|
||||
5. vertices: 4
|
||||
in-a : 2
|
||||
out-a: 2
|
||||
in-b: 3
|
||||
out-b: 4
|
||||
in-c: 2
|
||||
out-c: 1
|
||||
in-d: 1
|
||||
out-d: 1
|
||||
|
||||
6. {ac} {bde}
|
||||
b) Not bipartite: 3-loop bcf would require 3 sets
|
||||
|
||||
7. {{ paper }}
|
||||
|
||||
8. a -> abcd
|
||||
b -> d
|
||||
c -> ab
|
||||
d -> bcd
|
||||
|
||||
9. | a b c d
|
||||
--+--------
|
||||
a | 1 1 1 1
|
||||
b | 0 0 0 1
|
||||
c | 1 1 0 0
|
||||
d | 0 1 1 1
|
||||
|
||||
10. {{ paper }}
|
||||
|
||||
11. v1 -> u1
|
||||
v2 -> u4
|
||||
v3 -> u2
|
||||
v4 -> u5
|
||||
v5 -> u3
|
||||
|
||||
12. v1 -> u4
|
||||
v2 -> u3
|
||||
v3 -> u1
|
||||
v4 -> u2
|
||||
|
||||
13. PSCL
|
||||
a) YNN4
|
||||
b) N---
|
||||
c) N---
|
||||
d) YYY5
|
||||
1
CS1032/notes-2023-11-02
Normal file
1
CS1032/notes-2023-11-02
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
1
CS1032/notes-2023-11-03
Normal file
1
CS1032/notes-2023-11-03
Normal file
@@ -0,0 +1 @@
|
||||
Pencil & eraser for final exam
|
||||
1
CS1032/notes-2023-11-09
Normal file
1
CS1032/notes-2023-11-09
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
21
CS1032/practical-2023-11-01/head.py
Normal file
21
CS1032/practical-2023-11-01/head.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import sys, itertools
|
||||
|
||||
def open_arg(_arg0, filename = "-"): # Default of - means stdin
|
||||
if filename == "-":
|
||||
return sys.stdin
|
||||
|
||||
return open(filename, 'r')
|
||||
|
||||
def head(file):
|
||||
for line in file.readlines()[:10]:
|
||||
print(line, end = "")
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
file = open_arg(*sys.argv)
|
||||
head(file)
|
||||
except FileNotFoundError:
|
||||
print("File not found!", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except:
|
||||
print("Some other error occured", file=sys.stderr)
|
||||
21
CS1032/practical-2023-11-01/tail.py
Normal file
21
CS1032/practical-2023-11-01/tail.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import sys, itertools
|
||||
|
||||
def open_arg(_arg0, filename = "-"): # Default of - means stdin
|
||||
if filename == "-":
|
||||
return sys.stdin
|
||||
|
||||
return open(filename, 'r')
|
||||
|
||||
def tail(file):
|
||||
for line in file.readlines()[-10:]:
|
||||
print(line, end = "")
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
file = open_arg(*sys.argv)
|
||||
tail(file)
|
||||
except FileNotFoundError:
|
||||
print("File not found!", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except:
|
||||
print("Some other error occured", file=sys.stderr)
|
||||
70
CS1032/practical-2023-11-08/calc.py
Normal file
70
CS1032/practical-2023-11-08/calc.py
Normal file
@@ -0,0 +1,70 @@
|
||||
# This function adds two numbers
|
||||
def add(x, y):
|
||||
return x + y
|
||||
|
||||
# This function subtracts two numbers
|
||||
def subtract(x, y):
|
||||
return x - y
|
||||
|
||||
# This function multiplies two numbers
|
||||
def multiply(x, y):
|
||||
return x * y
|
||||
|
||||
# This function divides two numbers
|
||||
def divide(x, y):
|
||||
return x / y
|
||||
|
||||
def avg(x, y):
|
||||
return (x + y) / 2
|
||||
|
||||
def sci(x, y):
|
||||
return x * 10 ** y
|
||||
|
||||
|
||||
print("Select operation.")
|
||||
print("1.Add")
|
||||
print("2.Subtract")
|
||||
print("3.Multiply")
|
||||
print("4.Divide")
|
||||
print("5.Average")
|
||||
print("6.Scientific Notation")
|
||||
|
||||
while True:
|
||||
# take input from the user
|
||||
choice = input("Enter choice(1/2/3/4/5/6): ")
|
||||
|
||||
# check if choice is one of the four options
|
||||
if choice in ('1', '2', '3', '4', '5', '6'):
|
||||
try:
|
||||
num1 = float(input("Enter first number: "))
|
||||
num2 = float(input("Enter second number: "))
|
||||
except ValueError:
|
||||
print("Invalid input. Please enter a number.")
|
||||
continue
|
||||
|
||||
if choice == '1':
|
||||
print(num1, "+", num2, "=", add(num1, num2))
|
||||
|
||||
elif choice == '2':
|
||||
print(num1, "-", num2, "=", subtract(num1, num2))
|
||||
|
||||
elif choice == '3':
|
||||
print(num1, "*", num2, "=", multiply(num1, num2))
|
||||
|
||||
elif choice == '4':
|
||||
print(num1, "/", num2, "=", divide(num1, num2))
|
||||
|
||||
elif choice == '5':
|
||||
print(f"avg({num1}, {num2})", "=", avg(num1, num2))
|
||||
|
||||
elif choice == '6':
|
||||
print(f"{num1}e{num2}", "=", sci(num1, num2))
|
||||
|
||||
# check if user wants another calculation
|
||||
# break the while loop if answer is no
|
||||
next_calculation = input("Let's do next calculation? (yes/no): ")
|
||||
if next_calculation.lower().startswith('n'):
|
||||
break
|
||||
else:
|
||||
print("Invalid Input")
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
\date{}
|
||||
\author{}
|
||||
|
||||
\renewcommand{\Re}[1]{\operatorname{\mathbb{R}e}(#1)}
|
||||
\renewcommand{\Im}[1]{\operatorname{\mathbb{{I}}m}(#1)}
|
||||
\newcommand{\paren}[1]{\left(#1\right)}
|
||||
\renewcommand{\Re}[1]{\operatorname{\mathbb{R}e}\paren{#1}}
|
||||
\renewcommand{\Im}[1]{\operatorname{\mathbb{{I}}m}\paren{#1}}
|
||||
\newcommand{\C}{\mathbb{C}}
|
||||
\newcommand{\N}{\mathbb{N}}
|
||||
\newcommand{\Z}{\mathbb{Z}}
|
||||
@@ -18,8 +19,8 @@
|
||||
\newcommand{\conj}[1]{\overline{#1}}
|
||||
\renewcommand{\mod}[1]{\left|#1\right|}
|
||||
\newcommand{\abs}[1]{\left|#1\right|}
|
||||
\newcommand{\paren}[1]{\left(#1\right)}
|
||||
\newcommand{\polar}[2]{#1\paren{\cos{\paren{#2}} + i\sin{\paren{#2}}}}
|
||||
\newcommand{\adj}[1]{\operatorname{adj}#1}
|
||||
|
||||
\makeatletter
|
||||
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
|
||||
|
||||
@@ -5,181 +5,181 @@
|
||||
\section*{Allowable Operations on a Linear System}
|
||||
Solutions invariant.
|
||||
\begin{itemize}
|
||||
\item Multiply an equation by a non-zero scalar
|
||||
\item Swap two equations
|
||||
\item Add a multiple of one equation to another
|
||||
\item Multiply an equation by a non-zero scalar
|
||||
\item Swap two equations
|
||||
\item Add a multiple of one equation to another
|
||||
\end{itemize}
|
||||
\subsection*{Example}
|
||||
\begin{align*}
|
||||
&\systeme{
|
||||
& \systeme{
|
||||
x - 2y + 2z = 6,
|
||||
-x + 3y + 4z = 2,
|
||||
2x + y - 2z = -2
|
||||
}\\\\
|
||||
} \\\\
|
||||
E_2 & \implies E_2 + E_1 \\
|
||||
E_3 & \implies E_3 + E_1 \\
|
||||
&\systeme{
|
||||
& \systeme{
|
||||
x - 2y + 2z = 6,
|
||||
y + 6z = 8,
|
||||
5y - 6z = -14
|
||||
}\\\\
|
||||
} \\\\
|
||||
E_3 & \implies E_3 - 5E_2 \\
|
||||
&\systeme{
|
||||
& \systeme{
|
||||
x - 2y + 2z = 6,
|
||||
y + 6z = 8,
|
||||
z = \frac{3}{2}
|
||||
}\\\\
|
||||
} \\\\
|
||||
E_1 & \implies E_1 - 2E_3 \\
|
||||
E_2 & \implies E_2 - 6E_3 \\
|
||||
&\systeme{
|
||||
& \systeme{
|
||||
x - 2y = 3,
|
||||
y = -1,
|
||||
z = \frac{3}{2}
|
||||
}\\\\
|
||||
} \\\\
|
||||
E_1 & \implies E_1 + 2E_2 \\
|
||||
&\systeme{
|
||||
& \systeme{
|
||||
x = 1,
|
||||
y = -1,
|
||||
z = \frac{3}{2}
|
||||
}\\\\
|
||||
} \\\\
|
||||
\end{align*}
|
||||
\section*{As Matrices}
|
||||
\begin{align*}
|
||||
\systeme{
|
||||
\systeme{
|
||||
x + 2y = 1,
|
||||
2x - y = 3
|
||||
}
|
||||
\quad=\quad
|
||||
\begin{pmatrix}[cc|c]
|
||||
1 & 2 & 1 \\
|
||||
2 & -1 & 3
|
||||
\end{pmatrix}
|
||||
& \systeme{
|
||||
}
|
||||
\quad=\quad
|
||||
\begin{pmatrix}[cc|c]
|
||||
1 & 2 & 1 \\
|
||||
2 & -1 & 3
|
||||
\end{pmatrix}
|
||||
& \systeme{
|
||||
x - y + z = -2,
|
||||
2x + 3y + z = 7,
|
||||
x - 2y - z = -2
|
||||
} \quad=\quad \begin{pmatrix}[ccc|c]
|
||||
} \quad=\quad \begin{pmatrix}[ccc|c]
|
||||
1 & -1 & 1 & -2 \\
|
||||
2 & 3 & 1 & 7 \\
|
||||
1 & -2 & -1 & -2
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_3 - R_1]{R_2 - 2R_1} & \begin{pmatrix}[ccc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_3 - R_1]{R_2 - 2R_1} & \begin{pmatrix}[ccc|c]
|
||||
1 & -1 & 1 & -2 \\
|
||||
0 & 5 & -1 & 11 \\
|
||||
0 & -1 & -2 & 0
|
||||
\end{pmatrix} \\
|
||||
\grstep{5R_3 + R_2} & \begin{pmatrix}[ccc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep{5R_3 + R_2} & \begin{pmatrix}[ccc|c]
|
||||
1 & -1 & 1 & -2 \\
|
||||
0 & 5 & -1 & 11 \\
|
||||
0 & 0 & -11 & 11 \\
|
||||
\end{pmatrix} \\
|
||||
\grstep{-11^{-1}R_3} & \begin{pmatrix}[ccc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep{-11^{-1}R_3} & \begin{pmatrix}[ccc|c]
|
||||
1 & -1 & 1 & -2 \\
|
||||
0 & 5 & -1 & 11 \\
|
||||
0 & 0 & 1 & -1
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_1 - R_3]{R_2 + R_3} & \begin{pmatrix}[ccc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_1 - R_3]{R_2 + R_3} & \begin{pmatrix}[ccc|c]
|
||||
1 & -1 & 0 & -1 \\
|
||||
0 & 5 & 0 & 10 \\
|
||||
0 & 0 & 1 & -1
|
||||
\end{pmatrix} \\&
|
||||
\grstep{5^{-1}R_2} & \begin{pmatrix}[ccc|c]
|
||||
\end{pmatrix} \\&
|
||||
\grstep{5^{-1}R_2} & \begin{pmatrix}[ccc|c]
|
||||
1 & -1 & 0 & -1 \\
|
||||
0 & 1 & 0 & 2 \\
|
||||
0 & 0 & 1 & -1 \\
|
||||
\end{pmatrix} \\
|
||||
\grstep{R_1 + R_2} & \begin{pmatrix}[ccc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep{R_1 + R_2} & \begin{pmatrix}[ccc|c]
|
||||
1 & 0 & 0 & 1 \\
|
||||
0 & 1 & 0 & 2 \\
|
||||
0 & 0 & 1 & -1
|
||||
\end{pmatrix} \\
|
||||
= & \quad
|
||||
\left\{
|
||||
\subalign{
|
||||
\end{pmatrix} \\
|
||||
= & \quad
|
||||
\left\{
|
||||
\subalign{
|
||||
x & ~= ~1 \\
|
||||
y & ~= ~2 \\
|
||||
z & ~= ~-1
|
||||
}
|
||||
\right.
|
||||
}
|
||||
\right.
|
||||
\end{align*}
|
||||
\section*{Row-Echelon Form}
|
||||
\begin{description}
|
||||
\item[Row-Echelon Form] The leading entry in each row is 1 and is further to the right than the previous row's leading entry,
|
||||
all 0 rows are at the end
|
||||
\item[Reduced Row-Echelon Form] every other entry in a column containing a leading 1 is 0
|
||||
\item[Theorem:] A matrix can be transformed to reduced row-echelon form using a finite number of allowable row operations
|
||||
\item[Row-Echelon Form] The leading entry in each row is 1 and is further to the right than the previous row's leading entry,
|
||||
all 0 rows are at the end
|
||||
\item[Reduced Row-Echelon Form] every other entry in a column containing a leading 1 is 0
|
||||
\item[Theorem:] A matrix can be transformed to reduced row-echelon form using a finite number of allowable row operations
|
||||
\end{description}
|
||||
\subsection*{Example}
|
||||
\begin{align*}
|
||||
& \systeme{3x_1 + 2x_2 = 1,
|
||||
& \systeme{3x_1 + 2x_2 = 1,
|
||||
x_1 - x_2 = 4,
|
||||
2x_1 + x_2 = 5} = \begin{pmatrix}[cc|c]
|
||||
3 & 2 & 1 \\
|
||||
1 & -1 & 4 \\
|
||||
2 & 1 & 5
|
||||
\end{pmatrix} \\
|
||||
\grstep{R_1\swap R_2} & \begin{pmatrix}[cc|c]
|
||||
\grstep{R_1\swap R_2} & \begin{pmatrix}[cc|c]
|
||||
1 & -1 & 4 \\
|
||||
3 & 2 & 1 \\
|
||||
2 & 1 & 5
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_2 - 3R_1]{R_3 - 2R_1} & \begin{pmatrix}[cc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_2 - 3R_1]{R_3 - 2R_1} & \begin{pmatrix}[cc|c]
|
||||
1 & -1 & 4 \\
|
||||
0 & 5 & -11 \\
|
||||
0 & 3 & -3
|
||||
\end{pmatrix} \\
|
||||
\grstep{5^{-1}R_2} & \begin{pmatrix}[cc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep{5^{-1}R_2} & \begin{pmatrix}[cc|c]
|
||||
1 & -1 & 4 \\
|
||||
0 & 1 & \frac{-11}{5} \\
|
||||
0 & 3 & -3
|
||||
\end{pmatrix} \\
|
||||
\grstep{R_3 - 2R_2} & \begin{pmatrix}[cc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep{R_3 - 2R_2} & \begin{pmatrix}[cc|c]
|
||||
1 & -1 & 4 \\
|
||||
0 & 1 & \frac{-11}{5} \\
|
||||
0 & 0 & \frac{18}{5}
|
||||
\end{pmatrix} \\
|
||||
= & \systeme{
|
||||
\end{pmatrix} \\
|
||||
= & \systeme{
|
||||
x_1 - x_2 = 4,
|
||||
x_2 = \frac{-11}{5},
|
||||
0x_1 + 0x_2 = \frac{18}{5}
|
||||
}
|
||||
}
|
||||
\end{align*}
|
||||
\begin{align*}
|
||||
& \begin{pmatrix}[cccc|c]
|
||||
1 & -1 & 1 & 1 & 6 \\
|
||||
-1 & 1 & -2 & 1 & 3 \\
|
||||
2 & 0 & 1 & 4 & 1 \\
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_2 + R_1]{R_3 - 2R_1} & \begin{pmatrix}[cccc|c]
|
||||
& \begin{pmatrix}[cccc|c]
|
||||
1 & -1 & 1 & 1 & 6 \\
|
||||
-1 & 1 & -2 & 1 & 3 \\
|
||||
2 & 0 & 1 & 4 & 1 \\
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_2 + R_1]{R_3 - 2R_1} & \begin{pmatrix}[cccc|c]
|
||||
1 & -1 & 1 & 1 & 6 \\
|
||||
0 & 0 & -1 & 2 & 9 \\
|
||||
0 & 2 & -1 & 2 & -11
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_2\swap R_3]{2^{-1}R_3} & \begin{pmatrix}[cccc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_2\swap R_3]{2^{-1}R_3} & \begin{pmatrix}[cccc|c]
|
||||
1 & -1 & 1 & 1 & 6 \\
|
||||
0 & 1 & \frac{1}{2} & 1 & \frac{-11}{2} \\
|
||||
0 & 0 & -1 & 2 & 9 \\
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_1 + R_3]{R_2 - 2^{-1}R_3} & \begin{pmatrix}[cccc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep[R_1 + R_3]{R_2 - 2^{-1}R_3} & \begin{pmatrix}[cccc|c]
|
||||
1 & -1 & 0 & 3 & 15 \\
|
||||
0 & 1 & 0 & 0 & -10 \\
|
||||
0 & 0 & -1 & 2 & 9 \\
|
||||
\end{pmatrix} \\
|
||||
\grstep[-R_3]{R_1 + R_2} & \begin{pmatrix}[cccc|c]
|
||||
\end{pmatrix} \\
|
||||
\grstep[-R_3]{R_1 + R_2} & \begin{pmatrix}[cccc|c]
|
||||
1 & 0 & 0 & 3 & 15 \\
|
||||
0 & 1 & 0 & 0 & -10 \\
|
||||
0 & 0 & 1 & -2 & -9 \\
|
||||
\end{pmatrix} \\
|
||||
= & \systeme{
|
||||
\end{pmatrix} \\
|
||||
= & \systeme{
|
||||
x_1 + 3x_4 = 5,
|
||||
x_2 = -10,
|
||||
x_3 - 2x_4 = -9
|
||||
} \\
|
||||
= & \left\{\substack{
|
||||
} \\
|
||||
= & \left\{\substack{
|
||||
x_1 = 5 - 3t \\
|
||||
x_2 = -10 \\
|
||||
x_3 = -9 + 2t
|
||||
}\right.
|
||||
}\right.
|
||||
\end{align*}
|
||||
\section*{Determinants}
|
||||
The determinant of a matrix is defined only for square matrices.
|
||||
@@ -189,37 +189,37 @@ Let
|
||||
a_{11} & a_{12} & a_{1n} \\
|
||||
a_{21} & \ddots & \vdots \\
|
||||
a_{31} & \ldots & a_{3n} \\
|
||||
\end{pmatrix}
|
||||
\end{pmatrix}
|
||||
\]
|
||||
\begin{description}
|
||||
\item[$i, j$ minor of $A$] an $n$x$n$ matrix constructed by removing the $i^\text{th}$ row and $j^\text{th}$ column of $A$ \\
|
||||
Denoted by $A_{ij}$
|
||||
\item[$i, j$ minor of $A$] an $n$x$n$ matrix constructed by removing the $i^\text{th}$ row and $j^\text{th}$ column of $A$ \\
|
||||
Denoted by $A_{ij}$
|
||||
\end{description}
|
||||
\begin{align*}
|
||||
& \det{A} \text{ where } n = 1. = a_{11} \\
|
||||
& \det{A} = a_{11}\det{A_{11}} - a_{12}\det{A_{12}} + ... + (-1)^{n+1}a_{1n} \tag{Laplace expansion of the first row} \\
|
||||
& \qquad \text{or laplace expansion along other row or column}
|
||||
\text{For } n = 2:& \\
|
||||
& \det{A} = a_{11}\cdot a_{22} - a_{12}\cdot a_{21}
|
||||
& \det{A} \text{ where } n = 1. = a_{11} \\
|
||||
& \det{A} = a_{11}\det{A_{11}} - a_{12}\det{A_{12}} + ... + (-1)^{n+1}a_{1n} \tag{Laplace expansion of the first row} \\
|
||||
& \qquad \text{or laplace expansion along other row or column}
|
||||
\text{For } n = 2: & \\
|
||||
& \det{A} = a_{11}\cdot a_{22} - a_{12}\cdot a_{21}
|
||||
\end{align*}
|
||||
\begin{description}
|
||||
\item[Upper Triangular] lower left triangle is 0 - $d_{ij} = 0 \quad \forall{i > j}$
|
||||
\item[Lower Triangular] upper right triangle is 0 - $d_{ij} = 0 \quad \forall{i < j}$
|
||||
\item[Diagonal] only values on the diagonal - $d_{ij} = 0 \quad \forall{i \neq j}$ \\
|
||||
$\det{A} = \prod^{N}_{i=0}~a_{ij} \forall~\text{ row-echelon }A$
|
||||
\item[Upper Triangular] lower left triangle is 0 - $d_{ij} = 0 \quad \forall{i > j}$
|
||||
\item[Lower Triangular] upper right triangle is 0 - $d_{ij} = 0 \quad \forall{i < j}$
|
||||
\item[Diagonal] only values on the diagonal - $d_{ij} = 0 \quad \forall{i \neq j}$ \\
|
||||
$\det{A} = \prod^{N}_{i=0}~a_{ij} \forall~\text{ row-echelon }A$
|
||||
\end{description}
|
||||
\begin{itemize}
|
||||
\item Multiplying a row of a square matrix $A$ by $r$ multiplies $\det{A}$ by $r$
|
||||
\item Swapping two rows of a square matrix $A$ multiplies $\det{A}$ by $-1$
|
||||
\item Adding a multiple of a row does not effect the determinant
|
||||
\item Multiplying a row of a square matrix $A$ by $r$ multiplies $\det{A}$ by $r$
|
||||
\item Swapping two rows of a square matrix $A$ multiplies $\det{A}$ by $-1$
|
||||
\item Adding a multiple of a row does not effect the determinant
|
||||
\end{itemize}
|
||||
\section*{Transposition}
|
||||
\begin{description}
|
||||
\item[$A^T$] $a^T_{ij} = a_{ji}~ \forall~i,j$
|
||||
\item[$A^T$] $a^T_{ij} = a_{ji}~ \forall~i,j$
|
||||
\end{description}
|
||||
Note: $\det{A} = \det{A^T}~\forall~A$
|
||||
\section*{Matrix Multiplication}
|
||||
LHS has columns $=$ rows of RHS
|
||||
LHS has columns $=$ rows of RHS \\
|
||||
It's the cartesian product
|
||||
\[A\times B = (a_{i1}b_{j1} + a_{i2}b_{2j} + \ldots + a_{im}b_{mj})_{ij}\]
|
||||
\begin{align*}
|
||||
@@ -234,10 +234,125 @@ It's the cartesian product
|
||||
\end{pmatrix}
|
||||
\end{align*}
|
||||
\begin{align*}
|
||||
\begin{pmatrix}1 \\ 2 \\ 3 \end{pmatrix}\begin{pmatrix}1 & 2 & 3 & 4\end{pmatrix} + \begin{pmatrix}
|
||||
\begin{pmatrix}1 \\ 2 \\ 3 \end{pmatrix}\begin{pmatrix}1 & 2 & 3 & 4\end{pmatrix} + \begin{pmatrix}
|
||||
1 & 2 & 3 & 4 \\
|
||||
5 & 6 & 7 & 8 \\
|
||||
9 & 10 & 11 & 12 \\
|
||||
\end{pmatrix}
|
||||
\end{pmatrix}
|
||||
\end{align*}
|
||||
|
||||
\[A\vec{x} = \vec{b}\]
|
||||
where $A$ is the coefficient matrix, $\vec{x}$ is the variables, and $\vec{b}$ is the values of the equations of a linear equation system.
|
||||
\subsection*{Inverse Matrices}
|
||||
The identity matrix exists as $I_n$ for size $n$.
|
||||
\[AA^{-1} = I_n = A^{-1}A \quad \forall~\text{matrices }A \text{ of size } n\]
|
||||
Assume that $A$ has two distinct inverses, $B$ and $C$.
|
||||
\begin{align*}
|
||||
& \text{matrix multiplication is associative} \\
|
||||
\therefore~ & C(AB) = (CA)B \\
|
||||
\therefore~ & C I_n = I_n B \\
|
||||
\therefore~ & C = B \\
|
||||
& \text{
|
||||
As $B = C$, while $B$ and $C$ are assumed to be distinct, matrices have no more than one unique inverse by contradiction
|
||||
}
|
||||
\end{align*}
|
||||
Matrices are invertible $\iff \det{A} \neq 0$
|
||||
\[\det{AB} = \det{A}\det{B}\]
|
||||
\[\therefore~ \det{A}\det{A^{-1}} = \det{I_n} = 1\]
|
||||
\[\therefore~ \det{A} \neq 0 \]
|
||||
\begin{align*}
|
||||
\begin{pmatrix} a & b \\ c & d \end{pmatrix}^{-1} = \frac{1}{ad - bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}
|
||||
\end{align*}
|
||||
\subsubsection*{Computation thereof}
|
||||
\[\det{A} = \sum_{k = 1}^{n}~a_{ik}(-1)^{i+j}\det{A_{ij}} \quad \text{ for any $i$}\]
|
||||
\begin{description}
|
||||
\item[Matrix of Cofactors: $C$] determinants of minors \& signs of laplace expansion \\
|
||||
ie. $\sum A \odot C = \det{A}$
|
||||
\item[$\adj{A}$ Adjucate of $A$ =] $C^T$
|
||||
\end{description}
|
||||
\begin{align*}
|
||||
A & = \begin{pmatrix}
|
||||
1 & 0 & 1 \\
|
||||
-1 & 1 & 2 \\
|
||||
2 & 0 & 1
|
||||
\end{pmatrix} \\
|
||||
C(A) & = \begin{pmatrix}
|
||||
1 & 5 & -2 \\
|
||||
0 & -1 & 0 \\
|
||||
-1 & -3 & 1 \\
|
||||
\end{pmatrix}
|
||||
\end{align*}
|
||||
$$ A^{-1} = \frac{\adj{A}}{\det{A}} $$
|
||||
Gaussian elimination can also be used: augmented matrix with $I_n$ on the right,
|
||||
reduce to reduced row-echelon. If the left is of the form $I_n$, the right is
|
||||
the inverse. If there is a zero row, $\det{A} = 0$, and the $A$ has no inverse.
|
||||
\section*{Linear Transformations}
|
||||
\begin{align*}
|
||||
f: & ~ \R^n \to \R^m \\
|
||||
f & (x_1, \cdots, x_n) = (f_1(x_1, \cdots, x_n), f_2(x_1, \cdots, x_n), \cdots, f_m(x_1, \cdots, x_n))
|
||||
\end{align*}
|
||||
$f$ is a linear transformation if \(\forall i.~f_i(x_1, \cdots, x_n)\) is a
|
||||
linear polynomial in $x_1, \cdots, x_n$ with a zero constant term
|
||||
\begin{align*}
|
||||
f(x_1,~ x_2) & = (x_1 + x_2,~ 3x_1 - x_2,~ 10x_2) \tag{is a linear transformation} \\
|
||||
g(x_1,~ x_2,~ x_3) & = (x_1 x_2,~ x_3^2) \tag{not a linear transformation} \\
|
||||
h(x_1,~ x_2) & = (3x_1 + 4,~ 2x_2 - 4) \tag{not a linear transformation} \\
|
||||
\end{align*}
|
||||
\[f: \R^n \to \R^m = \vec{x} \to A\vec{x} \]
|
||||
\[\exists \text{ a matrix $A$ of dimension $n$x$m$ } \forall\text{ linear transforms } f \]
|
||||
\[\forall \text{ matrices $A$ of dimension $n$x$m$ } \exists \text{ a linear transform $f$ of dimension $n$x$m$ such that } f(\vec{x}) = A\vec{x} \]
|
||||
Function composition of linear translations is is just matrix multiplication:
|
||||
\begin{align*}
|
||||
f(\vec{x}) & = A\vec{x} \\
|
||||
g(\vec{y}) & = B\vec{y} \\
|
||||
(f\cdot g)(\vec{x}) & = g(f(\vec{x})) = BA\vec{x}
|
||||
\end{align*}
|
||||
A function \(f: \R^n \to \R^m\) is a linear transformation iff:
|
||||
\begin{enumerate}
|
||||
\item $f(\vec{x} + \vec{y}) = f(\vec{x}) + f(\vec{y}) \quad \forall~\vec{x},~\vec{y} \in \R^n $
|
||||
\item $f(r\vec{x}) = r\cdot f(\vec{x}) \quad \forall~\vec{x} \in \R^n, r \in \R $
|
||||
\end{enumerate}
|
||||
\subsection*{Building the matrix of a linear transform}
|
||||
\[ f(\vec{x}) = f(x_1\vec{e}_1 + x_2\vec{e}_2) = f(x_1\vec{e}_1) + f(x_2\vec{e}_2) = x_1f(\vec{e}_1) + x_2f(\vec{e}_2) \]
|
||||
\[ A = \begin{pmatrix} f(\vec{e}_1) & f(\vec{e}_2) \end{pmatrix} \]
|
||||
\begin{align*}
|
||||
& \vec{e}_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}
|
||||
\\ & \vec{e}_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix}
|
||||
\\ & \vdots
|
||||
\\ & \forall \vec{x}.~ \vec{x} = \sum_{i}^{n}~\vec{e}_i x_i
|
||||
\end{align*}
|
||||
\subsection*{Composition}
|
||||
\[ \paren{f \cdot g}\paren{\vec{x}} = f(g(\vec{x})) = AB\vec{x} \]
|
||||
where: $f(\vec{x}) = A\vec{x}$, $g(\vec{x}) = B\vec{x}$
|
||||
\subsection*{Geometry}
|
||||
\begin{description}
|
||||
\item[rotation of $x$ by $\theta$ anticlockwise] \( = R_\theta = \begin{pmatrix} \cos{\theta} & -\sin{\theta} \\ \sin{\theta} & \cos{\theta} \end{pmatrix} \)
|
||||
\item[reflection about a line at angle $\alpha$ from the $x$-axis] \( = T_\alpha = R_{\alpha}T_0R_{-\alpha}\) where \( T_0 = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} \)
|
||||
\item[scaling by $\lambda \in \R$] \( = S_\lambda = \lambda I_n\)
|
||||
\item[Skew by $\alpha$ in $x$ and $\gamma$ in $y$] \( \begin{pmatrix} \alpha & 0 \\ 0 & \gamma \end{pmatrix}\)
|
||||
\end{description}
|
||||
The image of the unit square under the linear transform $A$ is a parallelogram of $(0, 0)$, $(a_{11}, a_{21})$, $(a_{12}, a_{22})$, $(a_{11} + a_{12}, a_{21} + a_{22})$, with area $ \abs{\det{A}} $
|
||||
\subsection*{Inversion}
|
||||
Inversion of a linear transformation is equivalent to inversion of its representative matrix
|
||||
\subsection*{Eigen\{values, vectors\}}
|
||||
\[ \begin{pmatrix} a & 0 \\ 0 & b \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} a \\ 0 \end{pmatrix} = a\vec{e}_1\]
|
||||
\[ \begin{pmatrix} a & 0 \\ 0 & b \end{pmatrix}\begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 0 \\ b \end{pmatrix} = b\vec{e}_2\]
|
||||
\[ T_\alpha \vec{x} = \vec{x} \text{ for $\vec{x}$ along the line of transformation }\]
|
||||
\begin{description}
|
||||
\item[Eigenvector (of some transformation $f$)] A non-zero vector $\vec{x}$ such that $f(\vec{x}) = \lambda\vec{x}$ for some value $\lambda$
|
||||
\item[Eigenvalue] $\lambda$ as above
|
||||
\end{description}
|
||||
\[ \forall \text{ eigenvectors of $A$ } \vec{x}, c \in R, \neq 0 .~ c\vec{x} \text{ is an eigenvector with eigenvalue } \lambda\]
|
||||
|
||||
\[ \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$ }
|
||||
\end{align*}
|
||||
\[ P_{R\theta}(\lambda) = \frac{2\cos{\theta} \pm \sqrt{-4\lambda^2\sin^2{\theta}}}{2}\]
|
||||
\[ R_\theta \text{ has eigenvalues }\iff \sin{\theta} = 0 \]
|
||||
\end{document}
|
||||
Reference in New Issue
Block a user