From 910c52d418da0b513642dc882cf52ee096a3d8ea Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 24 Mar 2021 11:48:48 +0100 Subject: [PATCH] Init commit --- .gitignore | 11 ++ README.md | 0 exercise1/main.tex | 279 ++++++++++++++++++++++++++++++++ exercise2/main.tex | 119 ++++++++++++++ exercise3/main.tex | 282 ++++++++++++++++++++++++++++++++ exercise3/main2.tex | 185 +++++++++++++++++++++ exercise4/main.tex | 199 +++++++++++++++++++++++ exercise5/main.tex | 240 +++++++++++++++++++++++++++ exercise5/scripts/ex7.hs | 30 ++++ exercise5/scripts/ex8.hs | 27 ++++ exercise6/main.tex | 231 ++++++++++++++++++++++++++ exercise7/main.tex | 342 +++++++++++++++++++++++++++++++++++++++ 12 files changed, 1945 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 exercise1/main.tex create mode 100644 exercise2/main.tex create mode 100644 exercise3/main.tex create mode 100644 exercise3/main2.tex create mode 100644 exercise4/main.tex create mode 100644 exercise5/main.tex create mode 100644 exercise5/scripts/ex7.hs create mode 100644 exercise5/scripts/ex8.hs create mode 100644 exercise6/main.tex create mode 100644 exercise7/main.tex diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3204bb --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*.prv +auto +_region_.tex +*.pdf +*.aux +*.fdb_latexmk +*.fls +*.log +*.out +*.synctex.gz +.projectile \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/exercise1/main.tex b/exercise1/main.tex new file mode 100644 index 0000000..bc6fee5 --- /dev/null +++ b/exercise1/main.tex @@ -0,0 +1,279 @@ +\documentclass[12pt]{article} +\usepackage{ntnu} +\usepackage{ntnu-math} + +\author{Øystein Tveit} +\title{MA0301 Exercise 1} + +\begin{document} + \ntnuTitle{} + \break{} + + \begin{excs} + \exc{} + + \begin{truthtable} + {c|c|c} + {$p$ & $q$ & $p \Rightarrow q$} + \T & \T & \T \\ + \erow{} + \T & \F & \F \\ + \F & \T & \T \\ + \F & \F & \T \\ + \end{truthtable} + + Looking at the truthtable, we can see that $p \Rightarrow q$ only is false when $p$ is true and $q$ is false. + + \begin{subexcs} + \subexc{} + \begin{align*} + p \wedge q &\equiv T \wedge F \\ + &\equiv F + \end{align*} + + \subexc{} + \begin{align*} + \neg p \vee q &\equiv \neg T \vee F \\ + &\equiv F \vee F \\ + &\equiv F + \end{align*} + + \subexc{} + \begin{align*} + q \Rightarrow p &\equiv F \Rightarrow T \\ + &\equiv \neg F \vee T \\ + &\equiv T \vee T \\ + &\equiv T + \end{align*} + + \subexc{} + \begin{align*} + \neg q \Rightarrow \neg p &\equiv \neg F \Rightarrow \neg T \\ + &\equiv T \Rightarrow F \\ + &\equiv \neg T \vee F \\ + &\equiv F \vee F \\ + &\equiv F + \end{align*} + + \end{subexcs} + + \exc{} + \begin{subexcs} + \subexc{} + If triangle ABC is equilateral then triangle ABC is isosceles. + + \subexc{} + If triangle ABC is not isosceles then triangle ABC is not equilateral. + + \subexc{} + Triangle ABC is equilateral if and only if triangle ABC is equiangular. + + \subexc{} + Triangle ABC is isosceles and triangle ABC is not equilateral. + + \subexc{} + If triangle ABC is equiangular then triangle ABC is isosceles. + \end{subexcs} + + \exc{} + \begin{subexcs} + + \subexc{} + + \begin{truthtable} + {c|c|c|c|c|c|c} + {$p$ & $q$ & $\neg p$ & $\neg q$ & $p \wedge \neg q$ & $\neg (p \wedge \neg q)$ & $\neg (p \wedge \neg q) \Rightarrow p$} + \T & \T & \F & \F & \F & \T & \F \\ + \T & \F & \F & \T & \T & \F & \T \\ + \F & \T & \T & \F & \F & \T & \T \\ + \F & \F & \T & \T & \F & \T & \T + \end{truthtable} + + \subexc{} + + \begin{truthtable} + {c|c|c|c|c} + {$p$ & $q$ & $r$ & $q \Rightarrow r$ & $p \Rightarrow (q \Rightarrow r)$} + \T & \T & \T & \T & \T \\ + \T & \T & \F & \F & \F \\ + \T & \F & \T & \T & \T \\ + \T & \F & \F & \T & \T \\ + \F & \T & \T & \T & \T \\ + \F & \T & \F & \F & \T \\ + \F & \F & \T & \T & \T \\ + \F & \F & \F & \T & \T + \end{truthtable} + \end{subexcs} + + \exc{} + \begin{subexcs} + \subexc{} + \begin{truthtable} + {c|c|c|c|c|e} + {$p$ & $q$ & $\neg p$ & $\neg q$ & $\neg p \vee \neg q$ & $q \Leftrightarrow (\neg p \vee \neg q)$} + \T & \T & \F & \F & \F & \F \\ + \T & \F & \F & \T & \T & \F \\ + \F & \T & \T & \F & \T & \T \\ + \F & \F & \T & \T & \T & \F \\ + \end{truthtable} + + $q \Leftrightarrow (\neg p \vee \neg q)$ is not a tautology. + + \subexc{} + \begin{truthtable} + {c|c|c|c|c|c|c|e} + {$p$ & $q$ & $r$ & $p \Rightarrow q$ & $q \Rightarrow r$ & $p \Rightarrow r$ & $(p \Rightarrow q) \wedge (q \Rightarrow r)$ & $\left[ (p \Rightarrow q) \wedge (q \Rightarrow r) \right] \Rightarrow (p \Rightarrow r)$} + \T & \T & \T & \T & \T & \T & \T & \T \\ + \T & \T & \F & \T & \F & \F & \F & \T \\ + \T & \F & \T & \F & \T & \T & \F & \T \\ + \T & \F & \F & \F & \T & \F & \F & \T \\ + \F & \T & \T & \T & \T & \T & \T & \T \\ + \F & \T & \F & \T & \F & \T & \F & \T \\ + \F & \F & \T & \T & \T & \T & \T & \T \\ + \F & \F & \F & \T & \T & \T & \T & \T + \end{truthtable} + + $\left[ (p \Rightarrow q) \wedge (q \Rightarrow r) \right] \Rightarrow (p \Rightarrow r)$ is a tautology. + \end{subexcs} + + \exc{} + + I start by simplifying the expression, inserting $q$ as $T$ + \begin{align*} + \left(q \Rightarrow \left[ (\neg p \vee r) \wedge \neg s \right]\right) \wedge \left[\neg s \Rightarrow (\neg r \wedge q)\right] &\equiv + \left(T \Rightarrow \left[ (\neg p \vee r) \wedge \neg s \right]\right) \wedge \left[\neg s \Rightarrow (\neg r \wedge T)\right] \\ + &\equiv \left(\neg T \vee \left[ (\neg p \vee r) \wedge \neg s \right]\right) \wedge \left[\neg s \Rightarrow \neg r \right] \\ + &\equiv \left(F \vee \left[ (\neg p \vee r) \wedge \neg s \right]\right) \wedge \left[\neg s \Rightarrow \neg r \right] \\ + &\equiv \left[ (\neg p \vee r) \wedge \neg s \right] \wedge \left[\neg s \Rightarrow \neg r \right] \\ + \end{align*} + + \begin{truthtable} + {c|c|c|c|c|c|c|c|c|c} + {$p$ & $r$ & $s$ & $\neg p$ & $\neg r$ & $\neg s$ & $\neg p \vee r$ & $(\neg p \vee r) \wedge \neg s$ & $\neg s \Rightarrow \neg r$ & $\left[ (\neg p \vee r) \wedge \neg s \right] \wedge \left[\neg s \Rightarrow \neg r \right]$} + \T & \T & \T & \F & \F & \F & \T & \F & \T & \F \\ + \T & \T & \F & \F & \F & \T & \T & \T & \F & \F \\ + \T & \F & \T & \F & \T & \F & \F & \F & \T & \F \\ + \T & \F & \F & \F & \T & \T & \F & \F & \T & \F \\ + \F & \T & \T & \T & \F & \F & \T & \F & \T & \F \\ + \F & \T & \F & \T & \F & \T & \T & \T & \F & \F \\ + \F & \F & \T & \T & \T & \F & \T & \F & \T & \F \\ + \erow{} + \F & \F & \F & \T & \T & \T & \T & \T & \T & \T + \end{truthtable} + + The statement is only true when $p$, $r$ and $s$ are false. + + \exc{} + \begin{subexcs} + \subexc{} + \begin{truthtable} + {c|c|c|c|e|c|c|e} + {$p$ & $q$ & $r$ & $q \wedge r$ & $p \Rightarrow (q \wedge r)$ & $p \Rightarrow q$ & $p \Rightarrow r$ & $(p \Rightarrow q) \wedge (p \Rightarrow r)$} + \T & \T & \T & \T & \T & \T & \T & \T \\ + \T & \T & \F & \F & \F & \T & \F & \F \\ + \T & \F & \T & \F & \F & \F & \T & \F \\ + \T & \F & \F & \F & \F & \F & \F & \F \\ + \F & \T & \T & \F & \T & \T & \T & \T \\ + \F & \T & \F & \F & \T & \T & \T & \T \\ + \F & \F & \T & \F & \T & \T & \T & \T \\ + \F & \F & \F & \F & \T & \T & \T & \T + \end{truthtable} + + \subexc{} + \begin{truthtable} + {c|c|c|c|e|c|c|e} + {$p$ & $q$ & $r$ & $q \vee r$ & $p \Rightarrow (q \vee r)$ & $\neg r$ & $p \Rightarrow q$ & $\neg r \Rightarrow (p \Rightarrow q)$} + \T & \T & \T & \T & \T & \F & \T & \T \\ + \T & \T & \F & \T & \T & \T & \T & \T \\ + \T & \F & \T & \T & \T & \F & \F & \T \\ + \T & \F & \F & \F & \F & \T & \F & \F \\ + \F & \T & \T & \T & \T & \F & \T & \T \\ + \F & \T & \F & \T & \T & \T & \T & \T \\ + \F & \F & \T & \T & \T & \F & \T & \T \\ + \F & \F & \F & \F & \T & \T & \T & \T + \end{truthtable} + \end{subexcs} + + + + \exc{} + \begin{subexcs} + \subexc{} + \begin{align*} + \neg((p \wedge q) \Rightarrow r) &\equiv \neg(\neg(p \wedge q) \vee r) \\ + &\equiv \neg\neg(p \wedge q) \wedge \neg r \\ + &\equiv (p \wedge q) \wedge \neg r \\ + &\equiv p \wedge q \wedge \neg r \\ + \end{align*} + + \subexc{} + \begin{align*} + \neg(p \Rightarrow (\neg q \wedge r)) &\equiv \neg(\neg p \vee (\neg q \wedge r)) \\ + &\equiv \neg\neg p \wedge \neg(\neg q \wedge r) \\ + &\equiv p \wedge (\neg\neg q \vee \neg r) \\ + &\equiv p \wedge (q \vee \neg r) + \end{align*} + \end{subexcs} + + \exc{} + \begin{truthtable} + {c|c|c|c|c|e|e} + {$\alpha$ & $\beta$ & $\gamma$ & $\alpha \vee \beta$ & $\beta \vee \gamma$ & $(\alpha \vee \beta) \vee \gamma$ & $\alpha \vee (\beta \vee \gamma)$} + \T & \T & \T & \T & \T & \T & \T \\ + \T & \T & \F & \T & \T & \T & \T \\ + \T & \F & \T & \T & \T & \T & \T \\ + \T & \F & \F & \T & \F & \T & \T \\ + \F & \T & \T & \T & \T & \T & \T \\ + \F & \T & \F & \T & \T & \T & \T \\ + \F & \F & \T & \F & \T & \T & \T \\ + \F & \F & \F & \F & \F & \F & \F + \end{truthtable} + + \exc{} + \begin{subexcs} + \subexc{} + \begin{truthtable} + {c|c|c|e} + {$p$ & $q$ & $p \vee q$ & $p \Rightarrow (p \vee q)$} + \T & \T & \T & \T \\ + \T & \F & \T & \T \\ + \F & \T & \T & \T \\ + \F & \F & \F & \T \\ + \end{truthtable} + $p \Rightarrow (p \vee q)$ is a tautology + + \subexc{} Because $\neg(p \Rightarrow (p \vee q))$ is the negation of $p \Rightarrow (p \vee q)$, which we have already evaluated to be a tautology, this has to be a contradiction and thus unsatisfiable. + + \subexc{} + \begin{truthtable} + {c|c|c|e} + {$p$ & $q$ & $p \Rightarrow q$ & $p \Rightarrow (p \Rightarrow q)$} + \T & \T & \T & \T \\ + \T & \F & \F & \F \\ + \F & \T & \T & \T \\ + \F & \F & \T & \T \\ + \end{truthtable} + $p \Rightarrow (p \Rightarrow q)$ is satisfiable. + \end{subexcs} + + \exc{} + \begin{subexcs} + \subexc{} + $\neg p \Rightarrow (q \Leftrightarrow r)$ + + \subexc{} + $r \Rightarrow \neg p$ + + \subexc{} + $\neg r \wedge (p \wedge q)$ + + \subexc{} + $p \Rightarrow (r \wedge q)$ + + \subexc{} + $\neg q \wedge r$ + \end{subexcs} + \end{excs} + + +\end{document} \ No newline at end of file diff --git a/exercise2/main.tex b/exercise2/main.tex new file mode 100644 index 0000000..42259c5 --- /dev/null +++ b/exercise2/main.tex @@ -0,0 +1,119 @@ +\documentclass[12pt]{article} +\usepackage{ntnu} +\usepackage{ntnu-math} + +\author{Øystein Tveit} +\title{MA0301 Exercise 2} + +\begin{document} + \ntnuTitle{} + \break{} + + \begin{excs} + \exc{} + + \begin{truthtable} + {e|c|c|e} + {$p$ & $q$ & $p \wedge q$ & $p \vee (p \wedge q)$} + \T & \T & \T & \T \\ + \T & \F & \F & \T \\ + \F & \T & \F & \F \\ + \F & \F & \F & \F \\ + \end{truthtable} + + + \exc{} + (DL1) + \begin{truthtable} + {c|c|c|c|e|c|c|e} + {$\alpha$ & $\beta$ & $\gamma$ & $(\beta \wedge \gamma)$ & $\alpha \vee (\beta \wedge \gamma)$ & $\alpha \vee \beta$ & $\alpha \vee \gamma$ & $(\alpha \vee \gamma) \wedge (\alpha \vee \gamma)$} + \T & \T & \T & \T & \T & \T & \T & \T \\ + \T & \T & \F & \F & \T & \T & \T & \T \\ + \T & \F & \T & \F & \T & \T & \T & \T \\ + \T & \F & \F & \F & \T & \T & \T & \T \\ + \F & \T & \T & \T & \T & \T & \T & \T \\ + \F & \T & \F & \F & \F & \T & \F & \F \\ + \F & \F & \T & \F & \F & \F & \T & \F \\ + \F & \F & \F & \F & \F & \F & \F & \F \\ + \end{truthtable} + + (DL2) + \begin{truthtable} + {c|c|c|c|e|c|c|e} + {$\alpha$ & $\beta$ & $\gamma$ & $(\beta \vee \gamma)$ & $\alpha \wedge (\beta \vee \gamma)$ & $\alpha \wedge \beta$ & $\alpha \wedge \gamma$ & $(\alpha \wedge \gamma) \vee (\alpha \wedge \gamma)$} + \T & \T & \T & \T & \T & \T & \T & \T \\ + \T & \T & \F & \T & \T & \T & \F & \T \\ + \T & \F & \T & \T & \T & \F & \T & \T \\ + \T & \F & \F & \F & \F & \F & \F & \F \\ + \F & \T & \T & \T & \F & \F & \F & \F \\ + \F & \T & \F & \T & \F & \F & \F & \F \\ + \F & \F & \T & \T & \F & \F & \F & \F \\ + \F & \F & \F & \F & \F & \F & \F & \F \\ + \end{truthtable} + + \exc{} + \begin{align*} + p \Rightarrow (q \vee r) &\equiv (p \wedge \neg q) \Rightarrow r \\ + &\equiv \neg (p \wedge \neg q) \vee r \\ + &\equiv (\neg p \vee \neg\neg q) \vee r \\ + &\equiv (\neg p \vee q) \vee r \\ + &\equiv \neg p \vee (q \vee r) \\ + &\equiv p \Rightarrow (q \vee r) + \end{align*} + + \exc{} + \begin{align*} + [(q \wedge p) \vee q] \wedge \neg(\neg q \vee p) &\equiv q \wedge \neg p \\ + q \wedge \neg p &\equiv [(q \wedge p) \vee q] \wedge \neg(\neg q \vee p) \\ + &\equiv [q] \wedge (\neg\neg q \wedge \neg p) \\ + &\equiv q \wedge (q \wedge \neg p) \\ + &\equiv (q \wedge q) \wedge \neg p \\ + &\equiv q \wedge \neg p + \end{align*} + + \exc{} + \begin{subexcs} + \subexc{} + $\forall S(x)[H(x)]$ + \subexc{} + $\exists S(x)[\neg H(x)]$ + \subexc{} + $\forall S(x)[\neg H(x)]$ + \subexc{} + $\forall \neg H(x) \exists S(x)$ + + \end{subexcs} + + + \exc{} + \begin{subexcs} + \subexc{} + The formula is true because of the case where $x < z < y$ which would mean that $x < y \wedge z < y \wedge x < z \wedge \neg (z < x)$ + \subexc{} + The formula is false because $p(z, y)$ and $\neg p(z, x)$ cannot be fulfilled at the same time. $z \geq 0 \wedge \neg (z \geq 0) \equiv F$ + + \setsubexc{4} + \subexc{} + \fbox{see comment in ovsys} + + \end{subexcs} + + + \exc{} + \begin{align*} + \neg (\forall x [p(x) \wedge q(x)]) &\equiv \exists x [\neg(p(x) \wedge q(x))] \\ + &\equiv \exists x [\neg p(x) \vee \neg q(x)] + \end{align*} + + \exc{} + \begin{align*} + \neg (\exists x \forall y [p(y) \vee \neg q(x,y)]) &\equiv \forall x \neg(\forall y [p(y) \vee \neg q(x,y)]) \\ + &\equiv \forall x \exists y \neg[p(y) \vee \neg q(x,y)] \\ + &\equiv \forall x \exists y [\neg p(y) \wedge \neg\neg q(x,y)] \\ + &\equiv \forall x \exists y [\neg p(y) \wedge q(x,y)] + \end{align*} + + \end{excs} + + +\end{document} diff --git a/exercise3/main.tex b/exercise3/main.tex new file mode 100644 index 0000000..56cead7 --- /dev/null +++ b/exercise3/main.tex @@ -0,0 +1,282 @@ +\documentclass[12pt]{article} +\usepackage{ntnu} +\usepackage{ntnu-math} + +\author{Øystein Tveit} +\title{MA0301 Exercise 3} + +\begin{document} + \ntnuTitle{} + \break{} + + \begin{excs} + \exc{} + \begin{align*} + \neg ((\neg p \wedge q) \vee (\neg p \wedge \neg q)) &\vee (p \wedge q) && \\ + \neg (\neg p \wedge (q \vee \neg q)) &\vee (p \wedge q) && \text{Distributive law} \\ + \neg (\neg p \wedge T) &\vee (p \wedge q) && \text{Complement law} \\ + \neg (\neg p) &\vee (p \wedge q) && \text{Identity law} \\ + p &\vee (p \wedge q) && \text{Double negation law} \\ + p & && \text{Absortion law} \\ + \end{align*} + + \exc{} + \begin{align*} + ((p \wedge q) \vee (p \wedge \neg r) \vee \neg(\neg p \vee q)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \\ + ((p \wedge q) \vee (p \wedge \neg r) \vee (\neg\neg p \wedge \neg q)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{De Morgans's law} \\ + ((p \wedge q) \vee (p \wedge \neg r) \vee ( p \wedge \neg q)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Double negation law} \\ + ((p \wedge (q \vee \neg q)) \vee (p \wedge \neg r)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Distributive law} \\ + ((p \wedge T) \vee (p \wedge \neg r)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Complement law} \\ + ((p) \vee (p \wedge \neg r)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Identity law} \\ + p &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Absortion law} \\ + p &\vee ((\neg q \wedge r) \vee (\neg q \wedge s) \vee (\neg q \wedge \neg r)) && \text{Distributive law} \\ + p &\vee (\neg q \wedge r) \vee (\neg q \wedge s) \vee (\neg q \wedge \neg r) && \text{Associative law} + \end{align*} + + \exc{} + + \renewcommand{\theenumii}{\roman{enumii})} + \renewcommand{\theenumiii}{\alph{enumiii})} + + \begin{subexcs} + \subexc{} + + \begin{ssubexcs} + + \ssubexc{} + \begin{gather*} + \{\{2,3,5\} \cup \{6,4\}\} \cap \{4,6,8\} \\ + \{\{2,4,6\}\} \cap \{4,6,8\} \\ + \emptyset + \end{gather*} + + \ssubexc{} + \begin{align*} + P(\{7,8,9\}) &- P(\{7,9\}) \\ + \{\{7,8,9\}, \{7,8\}, \{8,9\}, \{7,9\}, \{7\}, \{8\}, \{9\}, \emptyset\} &- \{\{7,9\}, \{7\}, \{9\}, \emptyset\} \\ + \{\{7,8,9\}, \{7,8\}, \{8,9\}, \{8\}\} & \\ + \end{align*} + + \ssubexc{} + \begin{gather*} + P(\emptyset) \\ + \{\emptyset\} + \end{gather*} + + \ssubexc{} + \begin{gather*} + \{1, 3, 5\} \times \{0\} \\ + \{ \langle 1,0 \rangle, \langle 3,0 \rangle, \langle 5, 0 \rangle \} + \end{gather*} + + \ssubexc{} + \begin{gather*} + \{2,4,6\} \times \emptyset \\ + \emptyset + \end{gather*} + + \ssubexc{} + \begin{gather*} + P(\{0\}) \times P(\{1\}) \\ + \{\emptyset, \{0\}\} \times \{\emptyset, \{1\}\} \\ + \{\langle\emptyset,\emptyset\rangle, \langle\emptyset,\{1\}\rangle, \langle\{0\},\emptyset\rangle, \langle\{0\},\{1\}\rangle\} + \end{gather*} + + \ssubexc{} + \begin{gather*} + P(P(\{2\})) \\ + P(\{\emptyset,\{2\}\}) \\ + \{ \{\{\emptyset\}, \{2\}\}, \{\{\emptyset\}\}, \{\{2\}\}, \emptyset \} + \end{gather*} + + \end{ssubexcs} + + \subexc{} + Because the elements in a power set can be represented as a binary tree where every leaf node is a set that has the cardinality of $1$, and that $\{\{x\} : x \in A\}$ would make up all the leaf nodes, we can reason that + \[ |P(A) - \{\{x\} : x \in A\}| = \frac{n}{2} \] + + \end{subexcs} + + \renewcommand{\theenumii}{\alph{enumii})} + \renewcommand{\theenumiii}{\roman{enumiii})} + + \exc{} + \begin{subexcs} + \subexc{} + $\emptyset = \{\emptyset\}$ is {\color{red}False} because $|\emptyset| \neq |\{\emptyset\}|$ + + \subexc{} + $\emptyset = \{0\}$ is {\color{red}False} because $|\emptyset| \neq |\{0\}|$ + + \subexc{} + $|\emptyset| = 0$ is {\color{ForestGreen}True} because $\emptyset$ has $0$ elements + + \subexc{} + $P(\emptyset)$ is {\color{red}False} because $P(\emptyset) = \{\{\emptyset\}\}$ has $1$ element + + \subexc{} + $\emptyset = \{\}$ is {\color{ForestGreen}True} because the empty set is a subset of every possible set + + \subexc{} + $\emptyset = \{x \in \mathbb{N} : x \leq 0 and x > 0\}$ is {\color{red}False} because $x \leq 0 \wedge x > 0 \equiv \F$, which means there are no such elements, and thus the set is empty + \end{subexcs} + + \exc{} + \begin{subexcs} + \subexc{} + \begin{align*} + &A \cap (A \cup B) \\ + &\{x : x \in A \wedge x \in (A \cup B)\} \\ + &\{x : x \in A \wedge (x \in A \vee x \in B)\} \\ + &\{x : x \in A\} \\ + &A + \end{align*} + + \subexc{} + \begin{align*} + &A-(B \cap C) \\ + &\{x : x \in A \wedge x \notin (B \cap C)\} \\ + &\{x : x \in A \wedge (x \notin B \wedge x \notin C)\} \\ + &\{x : (x \in A \wedge x \notin B) \vee (x \in A \wedge x \notin C)\} \\ + &\{x : x \in (A - B) \vee x \in (A - C)\} \\ + &\{x : x \in (A - B) \cup (A - C)\} \\ + &(A-B) \cup (A-C) + \end{align*} + + \end{subexcs} + + \exc{} + + \renewcommand{\theenumii}{\roman{enumii})} + + \begin{subexcs} + \subexc{} + + \begin{align*} + &(A \cup B) \setminus (A \cap B) \\ + &\{x: x \in (A \cup B) \setminus (A \cap B)\} \\ + &\{x: x \in (A \cup B) \wedge x \notin (A \cap B)\} \\ + &\{x: (x \in A \vee x \in B) \wedge (x \notin A \vee x \notin B)\} \\ + &\{x: x \in A \wedge (x \notin A \vee x \notin B) \vee x \in B \wedge (x \notin A \vee x \notin B) \} \\ + &\{x: ((x \in A \wedge x \notin A) \vee (x \in A \wedge x \notin B)) \vee ((x \in B \wedge x \notin A) \vee (x \in B \wedge x \notin B)) \} \\ + &\{x: (F \vee (x \in A \wedge x \notin B)) \vee ((x \in B \wedge x \notin A) \vee F) \} \\ + &\{x: (x \in A \wedge x \notin B) \vee (x \in B \wedge x \notin A) \} \\ + &\{x: x \in (A - B) \vee x \in (B - A) \} \\ + &\{x: x \in (A - B) \cup (B - A) \} \\ + &(A - B) \cup (B - A) \\ + \end{align*} + + \subexc{} + For this exercise, I counted the elements which was in either set but not both + \[ A \Delta B = \{2, 4, 6, 7, 8\} \] + + \end{subexcs} + + \renewcommand{\theenumii}{\alph{enumii})} + + \exc{} + \begin{align*} + X &= \{\{1,2,3\}, \{2,3\}, \{ef\}\} \cup \{\{e\}\} \\ + &= \{\{1,2,3\}, \{2,3\}, \{ef\}, \{e\}\} \\ + \end{align*} + + \begin{align*} + P(x) = \{ \\ + &\{\{1,2,3\}, \{2,3\}, \{ef\}, \{e\}\}, \\ + &\{\{1,2,3\}, \{2,3\}, \{ef\}\}, \\ + &\{\{1,2,3\}, \{2,3\}, \{e\}\}, \\ + &\{\{1,2,3\}, \{ef\}, \{e\}\}, \\ + &\{\{2,3\}, \{ef\}, \{e\}\}, \\ + &\{\{1,2,3\}, \{2,3\}\}, \\ + &\{\{1,2,3\}, \{e\}\}, \\ + &\{\{1,2,3\}, \{ef\}\}, \\ + &\{\{2,3\}, \{ef\}\}, \\ + &\{\{2,3\}, \{e\}\}, \\ + &\{\{ef\}, \{e\}\}, \\ + &\{\{e\}\}, \\ + &\{\{ef\}\}, \\ + &\{\{2,3\}\}, \\ + &\{\{1,2,3\}\} \\ + \} \\ + \end{align*} + + \begin{align*} + P(X \cap Y) &= P(\{\{1,2,3\}, \{2,3\}, \{ef\}, \{e\}\} \cap \{\{1,2,3,e,f\}\}) \\ + &= P(\emptyset) \\ + &= \{\emptyset\} + \end{align*} + + \exc{} + \begin{subexcs} + \subexc{} + Here, the exercise says ``[\ldots] four sets $A_1$, $A_2$, $A_3$''. I'm not sure if I'm supposed to do three or four, but I'll assume three sets $A_1$, $A_2$, $A_3$ was the intention. + + \begin{align*} + A_1 \cap A_2 \cap A_3 \\ + A_1 \cap A_2 \cap \overline{A_3} \\ + A_1 \cap \overline{A_2} \cap A_3 \\ + A_1 \cap \overline{A_2} \cap \overline{A_3} \\ + \overline{A_1} \cap A_2 \cap A_3 \\ + \overline{A_1} \cap A_2 \cap \overline{A_3} \\ + \overline{A_1} \cap \overline{A_2} \cap A_3 \\ + \overline{A_1} \cap \overline{A_2} \cap \overline{A_3} \\ + \end{align*} + + \subexc{} + For each set, the amount of fundamental products is multiplied by $2$. Therefore, the amount of fundamental sets of $n$ sets is $2^n$ + + \end{subexcs} + + \exc{} + \begin{gather*} + A \overline{( B \overline{C} )} \overline{( (A \overline{B}) \overline{C})} \\ + A ( \overline{B} + \overline{\overline{C}} ) \overline{(A \overline{B}\ \overline{C})} \\ + A ( \overline{B} + C ) \overline{(A \overline{B}\ \overline{C})} \\ + A ( \overline{B} + C ) \overline{(A \overline{B}\ \overline{C})} \\ + A ( \overline{B} + C ) (\overline{A} + \overline{\overline{B}} + \overline{\overline{C}}) \\ + A ( \overline{B} + C ) (\overline{A} + B + C) \\ + ( A\overline{B} + AC ) (\overline{A} + B + C) \\ + A\overline{B}(\overline{A} + B + C) + AC(\overline{A} + B + C)\\ + (A\overline{B}\ \overline{A} + A\overline{B}B + A\overline{B}C) + (AC\overline{A} + ACB + ACC)\\ + (0 + 0 + A\overline{B}C) + (0 + ACB + AC)\\ + A\overline{B}C + ACB + AC\\ + ACB + AC\\ + AC + \end{gather*} + + \exc{} + LHS + \begin{gather*} + ((A+B)+(A+C)) \overline{((A+B)(A+C))} \overline{A} \\ + (A+B+A+C) \overline{(A+B)(A+C)} \overline{A} \\ + (A+B+C) (\overline{(A+B)} + \overline{(A+C)}) \overline{A} \\ + (A+B+C) (\overline{A}\ \overline{B} + \overline{A}\ \overline{C}) \overline{A} \\ + (\overline{A}A + \overline{A}B + \overline{A}C) (\overline{A}\ \overline{B} + \overline{A}\ \overline{C}) \\ + (0 + \overline{A}B + \overline{A}C) (\overline{A}\ \overline{B} + \overline{A}\ \overline{C}) \\ + (\overline{A}B + \overline{A}C) (\overline{A}\ \overline{B} + \overline{A}\ \overline{C}) \\ + \overline{A}B \overline{A}\ \overline{B} + + \overline{A}B \overline{A}\ \overline{C} + + \overline{A}C \overline{A}\ \overline{B} + + \overline{A}C \overline{A}\ \overline{C} \\ + 0 + + \overline{A}B \overline{A}\ \overline{C} + + \overline{A}C \overline{A}\ \overline{B} + + 0 \\ + \overline{A}B \overline{C} + \overline{A}C \overline{B} \\ + \end{gather*} + + RHS + \begin{gather*} + (B+C) \overline{(BC)} \overline{A} \\ + (B+C) (\overline{B} + \overline{C}) \overline{A} \\ + (\overline{A}B + \overline{A}C) (\overline{B} + \overline{C}) \\ + \overline{A}B\overline{B} + \overline{A}B\overline{C} + \overline{A}C\overline{B} + \overline{A}C\overline{C} \\ + 0 + \overline{A}B\overline{C} + \overline{A}C\overline{B} + 0 \\ + \overline{A}B\overline{C} + \overline{A}C\overline{B} \\ + \end{gather*} + + $LHS = RHS$ + + \end{excs} + +\end{document} diff --git a/exercise3/main2.tex b/exercise3/main2.tex new file mode 100644 index 0000000..b63e930 --- /dev/null +++ b/exercise3/main2.tex @@ -0,0 +1,185 @@ +\documentclass[12pt]{article} +\usepackage{ntnu} +\usepackage{ntnu-math} + +\author{Øystein Tveit} +\title{MA0301 Exercise 2} + +\begin{document} + \ntnuTitle{} + \break{} + + \begin{excs} + \exc{} + + \exc{} + + \exc{} + \begin{subexcs} + \subexc{} + + \begin{ssubexcs} + \ssubexc{} + \begin{align*} + {{2,3,5} \cup {6,4}} &\cap {4,6,8} \\ + {{2,4,6}} &\cap {4,6,8} \\ + \emptyset + \end{align*} + + \ssubexc{} + \begin{align*} + P({7,8,9}) &- P({7,9}) \\ + {{7,8,9}, {7,8}, {8,9}, {7,9}, {7}, {8}, {9}, \emptyset} &- {{7,9}, {7}, {9}, \emptyset} \\ + {{7,8,9}, {7,8}, {8,9}, {8}} + \end{align*} + + \ssubexc{} + \begin{align*} + P(\emptyset) \\ + {\emptyset} + \end{align*} + + \ssubexc{} + \begin{align*} + {1, 3, 5} \times {0} \\ + { \langle 1,0 \rangle, \langle 3,0 \rangle, \langle 5, 0 \rangle } + \end{align*} + + \ssubexc{} + \begin{align*} + {2,4,6} \times \emptyset \\ + \emptyset + \end{align*} + + \ssubexc{} + \begin{align*} + P({0}) &\times P({1}) \\ + {\emptyset, {0}} &\times {\emptyset, {1}} \\ + {\langle\emptyset,\emptyset\rangle, \langle\emptyset,{1}\rangle, \langle{0},\emptyset\rangle, \langle{0},{1}\rangle} + \end{align*} + + \ssubexc{} + \begin{align*} + P(P({2})) \\ + P({\emptyset,{2}}) \\ + { {{\emptyset}, {2}}, {{\emptyset}}, {{2}}, \emptyset } + \end{align*} + + \end{ssubexcs} + + \subexc{} + Because the elements in a power set can be represented as a binary tree where every leaf node is a set that has the cardinality of $1$, and that ${{x} : x \in A}$ would make up all the leaf nodes, we can reason that + \[ |P(A) - {{x} : x \in A}| = \frac{n}{2} \] + + \end{subexcs} + + \exc{} + \begin{subexcs} + \subexc{} + $\emptyset = {\emptyset}$ is {\color{red}False} because $|\emptyset| \neq |{\emptyset}|$ + + \subexc{} + $\emptyset = {0}$ is {\color{red}False} because $|\emptyset| \neq |{0}|$ + + \subexc{} + $|\emptyset| = 0$ is {\color{ForestGreen}True} because $\emptyset$ has $0$ elements + + \subexc{} + $P(\emptyset)$ is {\color{red}False} because $P(\emptyset) = {{\emptyset}}$ has $1$ element + + \subexc{} + $\emptyset = {}$ is {\color{ForestGreen}True} because the empty set is a subset of every possible set + + \subexc{} + $\emptyset = {x \in \mathbb{N} : x \leq 0 and x > 0}$ is {\color{red}False} because $x \leq 0 \wedge x > 0 \equiv \F$, which means there are no such elements, and thus the set is empty + \end{subexcs} + + \exc{} + \begin{subexcs} + \subexc{} + \begin{align*} + A \cap (\A \cup B) \\ + {x : x \in A \wedge x \in (A \cup B)} \\ + {x : x \in A \wedge (x \in A \or x \in B)} \\ + {x : x \in A} \\ + A + \end{align*} + + \subexc{} + \begin{align*} + A-(B \cap C) \\ + {x : x \in A \wedge x \notin (B \cap C)} \\ + {x : x \in A \wedge (x \notin B \wedge x \notin C)} \\ + {x : (x \in A \wedge x \notin B) \vee (x \in A \wedge x \notin C)} \\ + {x : x \in (A - B) \vee x \in (A - C)} \\ + {x : x \in (A - B) \cup (A - C)} \\ + (A-B) \cup (A-C) + \end{align*} + + \end{subexcs} + + \exc{} + \begin{subexcs} + \subexc{} + + \end{subexcs} + + \exc{} + \begin{align*} + X &= {{1,2,3}, {2,3}, {ef}} \cup {{e}} \\ + &= {{1,2,3}, {2,3}, {ef}, {e}} \\ + \\ + P(x) &= { + {{1,2,3}, {2,3}, {ef}, {e}}, + {{1,2,3}, {2,3}, {ef}}, + {{1,2,3}, {2,3}, {e}}, + {{1,2,3}, {ef}, {e}}, + {{2,3}, {ef}, {e}}, + {{1,2,3}, {2,3}} + {{1,2,3}, {e}} + {{1,2,3}, {ef}} + {{2,3}, {ef}} + {{2,3}, {e}} + {{ef}, {e}} + {{e}} + {{ef}}, + {{2,3}}, + {{1,2,3}} + } \\ + \\ + P(X \cap Y) &= P({{1,2,3}, {2,3}, {ef}, {e}} \cap {{1,2,3,e,f}}) \\ + &= P(\emptyset) \\ + &= {\emptyset} + \end{align*} + + \exc{} + \begin{subexcs} + \subexc{} + Here, the exercise says ``[\ldots] four sets $A_1$, $A_2$, $A_3$''. I'm not sure if I'm supposed to do three or four, but I'll assume three. + + \begin{align*} + A_1 \cap A_2 \cap A_3 \\ + A_1 \cap A_2 \cap \overline{A_3} \\ + A_1 \cap \overline{A_2} \cap A_3 \\ + A_1 \cap \overline{A_2} \cap \overline{A_3} \\ + \overline{A_1} \cap A_2 \cap A_3 \\ + \overline{A_1} \cap A_2 \cap \overline{A_3} \\ + \overline{A_1} \cap \overline{A_2} \cap A_3 \\ + \overline{A_1} \cap \overline{A_2} \cap \overline{A_3} \\ + \end{align*} + + \subexc{} + For each set, the amount of fundamental products is multiplied by $2$. Therefore, the amount of fundamental sets of $n$ sets is $2^n$ + + \end{subexcs} + + \exc{} + \begin{align*} + A\overline{(B\overline{C})}\overline{((A\overline{B})\overline{C})} \\ + A\overline{(B\overline{C})}\overline{((A\overline{B})\overline{C})} \\ + \end{align*} + + \end{excs} + + +\end{document} diff --git a/exercise4/main.tex b/exercise4/main.tex new file mode 100644 index 0000000..74f775c --- /dev/null +++ b/exercise4/main.tex @@ -0,0 +1,199 @@ +\documentclass[12pt]{article} +\usepackage{ntnu} +\usepackage{ntnu-math} + +\author{Øystein Tveit} +\title{MA0301 Exercise 4} + +\usepackage{amsthm} + +\begin{document} + \ntnuTitle{} + \break{} + + \begin{excs} + \exc{} + \begin{subexcs} + \subexc{} + \begin{gather*} + \overline{xy} + \overline{x}\ \overline{y} \\ + \overline{1 \cdot 0} + (\overline{1}\cdot \overline{0}) \\ + \overline{0} + (0 \cdot 1) \\ + 1 + 0 \\ + 1 + \end{gather*} + + \subexc{} + \begin{gather*} + w + \overline{x}y \\ + 1 + (\overline{1} \cdot 0) \\ + 1 + 0 \\ + 1 + \end{gather*} + + \subexc{} + \begin{gather*} + wx + \overline{y} + yz \\ + (1 \cdot 1) + \overline{0} + (0 \cdot 0) \\ + 1 + 1 + 0 \\ + 1 + \end{gather*} + + \subexc{} + \begin{gather*} + (wx + y\overline{z}) + w\overline{y} + \overline{(w + y)(\overline{x} + y)} \\ + ((1 \cdot 1) + (0 \cdot \overline{0})) + (1 \cdot \overline{0}) + \overline{(1 + 0)(\overline{1} + 0)} \\ + (1 + 0) + (1 \cdot 1) + \overline{(1)(0 + 0)} \\ + 1 + 1 + \overline{(1)(0)} \\ + 1 + 1 + \overline{0} \\ + 1 + 1 + 1 \\ + 1 + \end{gather*} + \end{subexcs} + + \exc{} + \begin{subexcs} + \subexc{} + \begin{gather*} + xy + (x + y)\overline{z} + y \\ + (xy + y) + \overline{z}x + \overline{z}y \\ + y + \overline{z}x + \overline{z}y \\ + \overline{z}x + (y + \overline{z}y) \\ + \overline{z}x + y + \end{gather*} + + \subexc{} + \begin{gather*} + x + y + \overline{(\overline{x} + y + z)} \\ + x + y + \overline{\overline{x}}\ \overline{y}\ \overline{z} \\ + x + y + x\overline{y}\ \overline{z} \\ + (x + x\overline{y}\ \overline{z}) + y \\ + x + y + \end{gather*} + + \subexc{} + \begin{gather*} + yz + wx + z +[wz(xy + wz)] \\ + (yz + z) + wx + (xywz + wz) \\ + (z + xywz + wz) + wx \\ + z + wx + \end{gather*} + + \end{subexcs} + + + \exc{}{} + + Base case + \begin{align*} + \sum^{1}_{i=0}i^2 &= \frac{1 \cdot (1 + 1)(2 \cdot 1 + 1)}{6} \\[2ex] + 1^2 &=\frac{2 \cdot 3}{6} \\[2ex] + 1 &=\frac{6}{6} \\[2ex] + 1 &= 1 + \end{align*} + + Assume: + \[ \sum^{k}_{i=0}i^2 = \frac{k (k + 1)(2k + 1)}{6} \] + + \begin{align*} + \sum^{k+1}_{i=0}i^2 &= 0^2 + 1^2 + 2^2 + \ldots + k^2 + (k + 1)^2 \\[2ex] + &= \frac{k (k + 1)(2k + 1)}{6} + (k + 1)^2 \\[2ex] + &= \frac{k (k + 1)(2k + 1) + 6(k + 1)^2}{6} \\[2ex] + &= \frac{ (k + 1)(k (2k + 1) + 6(k + 1))}{6} \\[2ex] + &= \frac{ (k + 1)(2k^2 + k + 6k + 6)}{6} \\[2ex] + &= \frac{ (k + 1)(2k^2 + 7k + 6)}{6} \\[2ex] + &= \frac{ (k + 1)(k + 2)(2k + 3)}{6} \\[2ex] + &= \frac{(k + 1) ((k + 1) + 1)(2(k + 1) + 1)}{6} + \end{align*} + + \qed + + \exc{} + \begin{subexcs} + \subexc{} + \begin{align*} + S(0) &= 2^{-0} = 1 \\ + S(1) &= 2^{-0} + 2^{-1} = 1.5 \\ + S(2) &= 2^{-0} + 2^{-1} + 2^{-2} = 1.75 \\ + S(3) &= 2^{-0} + 2^{-1} + 2^{-2} + 2^{-3} = 1.875 + \end{align*} + + \subexc{} + Based on the results from a, I conjecture that + + \[ S(n) = 2 - 2^{-n} \] + + \subexc{} + + Base case + \begin{align*} + \sum^{0}_{i=0}2^{-i} &= 2-2^{-0} \\ + 2^{-0} &= 2-1 \\ + 1 &= 1 + \end{align*} + + Assume: + \[ \sum^{n}_{i=0}2^{-i} = 2-2^{-n} \] + + \begin{align*} + \sum^{n+1}_{i=0}2^{-i} &= 2^{-0} + 2^{-1} + 2^{-2} + \ldots + 2^{-n} + 2^{-(n+1)} \\ + &= 2-2^{-n} + 2^{-(n+1)} \\ + &= 2-2^{-n} + 2^{-n-1} \\ + &= 2-2^{-n} + 2^{-n}2^{-1} \\ + &= 2-2^{-n}(1-2^{-1}) \\ + &= 2-2^{-n}(\frac{2}{2}-\frac{1}{2}) \\ + &= 2-2^{-n}(\frac{1}{2}) \\ + &= 2-2^{-n}(2^{-1}) \\ + &= 2-2^{-n-1} \\ + &= 2-2^{-(n+1)} + \end{align*} + + \qed + + \subexc{} + + \begin{align*} + S(n) &> \epsilon \\ + 2-2^{-n} &> \epsilon \\ + 2^{-n} &> \epsilon - 2 \\ + -n &> \log_2(\epsilon - 2) \\ + n &< -\log_2(\epsilon - 2) \\ + \end{align*} + + Assuming $S(n)$ never can reach n, + for $S(n)$ to be within $\epsilon$ of $2$, n has to be less than $-\log_2(\epsilon - 2)$ + + \end{subexcs} + + + \exc{} + + Base case + \begin{align*} + \sum^{1}_{i=1}2^{i-1} \cdot i &= 2^n \cdot (n-1) + 1 \\ + 2^{1-1} \cdot 1 &= 2^1 \cdot (1-1) + 1 \\ + 2^0 \cdot 1 &= 2 \cdot 0 + 1 \\ + 1 \cdot 1 &= 1 \\ + 1 &= 1 + \end{align*} + + Assume: + \[ \sum^{n}_{i=1}2^{i-1} \cdot i = 2^n \cdot (n-1) + 1 \] + + \begin{align*} + \sum^{n+1}_{i=1}2^{i-1} \cdot i &= (2^{1-1} \cdot 1) + (2^{2-1} \cdot 2) + \ldots + + (2^{n-1} \cdot n) + (2^{(n+1)-1} \cdot (n+1)) \\ + &= 2^n \cdot (n-1) + 1 + (2^{(n+1)-1} \cdot (n+1)) \\ + &= 2^n \cdot (n-1) + 1 + 2^{n} \cdot (n+1) \\ + &= (2^n \cdot n - 2^n) + 1 + (2^{n} \cdot n + 2^{n}) \\ + &= 2^n \cdot n - 2^n + 1 + 2^{n} \cdot n + 2^{n} \\ + &= 2(2^n \cdot n) - 2^n + 2^{n}+ 1 \\ + &= (4^n \cdot n) + 1 \\ + &= (2^{n+1} \cdot ((n+1)-1)) + 1 + \end{align*} + + \qed + + \end{excs} + +\end{document} diff --git a/exercise5/main.tex b/exercise5/main.tex new file mode 100644 index 0000000..214b70b --- /dev/null +++ b/exercise5/main.tex @@ -0,0 +1,240 @@ +\documentclass[12pt]{article} +\usepackage{ntnu} +\usepackage{ntnu-math} +\usepackage{ntnu-code} + +\author{Øystein Tveit} +\title{MA0301 Exercise 5} + +\usepackage{amsthm} +\usepackage{mathabx} + +\begin{document} + \ntnuTitle{} + \break{} + + \begin{excs} + \exc{} + + Base case: + \begin{align*} + \sum^{m}_{j=1} \frac{1}{j(j+2)} &= \frac{m(3m+5)}{4(m+1)(m+2)} \\[2ex] + \frac{1}{1(1+2)} &= \frac{1(3\cdot1 + 5)}{4(1+1)(1+2)} \\[2ex] + \frac{1}{3} &= \frac{8}{4(2)(3)} \\[2ex] + \frac{1}{3} &= \frac{8}{8(3)} \\[2ex] + \frac{1}{3} &= \frac{1}{3} + \end{align*} + + Assume: + \[ \sum^{m}_{j=1} \frac{1}{j(j+2)} = \frac{m(3m+5)}{4(m+1)(m+2)} \] + + \begin{align*} + \sum^{m+1}_{j=1} \frac{1}{j(j+2)} + &= \frac{1}{1(1+2)} + \frac{1}{2(2+2)} + \ldots + \frac{1}{m(m+2)} + \frac{1}{(m+1)((m+1)+2)} \\[2ex] + &= \frac{m(3m+5)}{4(m+1)(m+2)} + \frac{1}{(m+1)((m+1)+2)} \\[2ex] + &= \frac{3m^2+5m}{4m^2+12m+8} + \frac{1}{m^2+4m+3} \\[2ex] + &= \frac{(m^2+4m+3)(3m^2+5m) + 4m^2+12m+8}{(m^2+4m+3)(4m^2+12m+8)} \\[2ex] + &= \frac{3m^4+17m^3+29m^2+15m + 4m^2+12m+8}{(m^2+4m+3)(4m^2+12m+8)} \\[2ex] + &= \frac{3m^4+17m^3+33m^2+27m+8}{(m^2+4m+3)(4m^2+12m+8)} \\[4ex] + &\text{(Here, I used a calculator to factorize the expression)} \\[4ex] + &= \frac{3m^2+11m+8}{4m^2+20m+24} \\[2ex] + &= \frac{(m+1)(3m+8)}{4(m^2+5m+6)} \\[2ex] + &= \frac{(m+1)(3(m+1)+5)}{4(m+2)(m+3)} \\[2ex] + &= \frac{(m+1)(3(m+1)+5)}{4((m+1)+1)((m+1)+2)} \\[2ex] + \end{align*} + \qed + + \exc{} + + \begin{align*} + a_{m+1} &= 2^{2(m + 1) + 1} + 1 \\ + &= 2^{2m+3} + 1 \\ + &= 2^{2m+1}2^2 + 1 \\ + &= (2^{2m+1} + 1)2^2 - (1)2^2 + 1 \\ + &= 4a_{m} - 4 + 1 \\ + &= 4a_{m} - 3 \\ + \end{align*} + + $(a_m \bmod 3 = 0) \wedge (-3 \bmod 3 = 0) \Rightarrow ((4a_m - 3) \bmod 3 = 0)$ + + \exc{} + + Base case: + \begin{align*} + \sum^m_{i=1} iL_i &= mL_{m+2} - L_{m+3} + 4 \\ + 1 \cdot L_1 &= 1 \cdot L_{1+2} - L_{1+3} + 4 \\ + 1 &= 4 - 7 + 4 \\ + 1 &= 1 \\ + \end{align*} + + Assume: + \[ \sum^m_{i=1} i L_i = mL_{m+2} - L_{m+3} + 4 \] + + \begin{align*} + \sum^{m+1}_{i=1} iL_i &= 1L_1 + 2L_2 + \ldots + mL_m + (m+1)L_{m+1} \\ + &= mL_{m+2} - L_{m+3} + 4 + (m+1)L_{m+1} \\ + &= mL_{m+2} - L_{m+3} + 4 + mL_{m+1} + L_{m+1} \\ + &= m(L_{m+2} + L_{m+1}) - L_{m+3} + L_{m+1} + 4 \\ + &= mL_{m+3} - L_{m+3} + L_{m+1} + 4 \\ + &= (m+1)L_{m+3} - L_{m+3} - L_{m+3} + L_{m+1} + 4 \\ + &= (m+1)L_{m+3} - L_{m+3} - L_{m+2} - L{m+1} + L_{m+1} + 4 \\ + &= (m+1)L_{m+3} - L_{m+3} - L_{m+2} + 4 \\ + &= (m+1)L_{m+3} - L_{m+4} + 4 \\ + &= (m+1)L_{(m+1)+2} - L_{(m+1)+3} + 4 \\ + \end{align*} + \qed + + \exc{} + + Base case: + \begin{align*} + \sum^1_{i=1}(-1)^{i+1}i^2 &= (-1)^{1+1}\sum^{1}_{i=1}i \\ + (-1)^{1+1} \cdot 1^2 &= (-1)^{1+1} \cdot 1 \\ + (-1)^{2} &= (-1)^{2} \\ + 1 &= 1 \\ + \end{align*} + + Assume: + + \[ \sum^m_{i=1}(-1)^{i+1}i^2 = (-1)^{m+1}\sum^{m}_{i=1}i = (-1)^{m+1}\left(\frac{m(m+1)}{2}\right)\] + + \begin{align*} + \sum^{m+1}_{i=1} &= (-1)^{1+1} \cdot 1^2 + (-1)^{2+1} \cdot 2^2 + \ldots + (-1)^{m+1} m^2 + (-1)^{(m+1)+1} (m+1)^2 \\ + &= (-1)^{m+1}\frac{m(m+1)}{2} + (-1)^{(m+1)+1} (m+1)^2 \\ + &= (-1)^{m+1} \left(\frac{m(m+1)}{2} + (-1) (m+1)^2 \right) \\ + &= (-1)^{m+1} (m+1) \left( \frac{m}{2} - (m+1) \right) \\ + &= (-1)^{m+1} (-1) (m+1) \left( -\frac{m}{2} + (m+1) \right) \\ + &= (-1)^{m+2} (m+1) \left( -\frac{m}{2} + (m+1) \right) \\ + &= (-1)^{m+2} (m+1) \left( \frac{-m + 2(m+1)}{2} \right) \\ + &= (-1)^{m+2} (m+1) \left( \frac{-m + 2m + 2}{2} \right) \\ + &= (-1)^{m+2} (m+1) \left( \frac{m + 2}{2} \right) \\ + &= (-1)^{m+2} \left( \frac{(m+1)(m + 2)}{2} \right) \\ + &= (-1)^{(m+1)+1} \left( \frac{(m+1)((m+1) + 1)}{2} \right) \\ + \end{align*} + \qed + + \exc{} + + \begin{subexcs} + \subexc{} + + $R$ is reflexive because $x \bmod x = 0$ + + $R$ is not symmetric because $ 2 \bmod 1 = 0$ but $1 \bmod 2 = 1$ + + $R$ is transitive because + \begin{align*} + xRy &\Leftrightarrow (y = nx), &&n \in \mathbb{Z} \\ + yRz &\Leftrightarrow (z = my = m(nx)), &&m \in \mathbb{Z} \\ + z=nmx &\Leftrightarrow (z \bmod x = 0) + \end{align*} + + \subexc{} + + $R$ is reflexive because \[ A \cap C = A \cap C \] + + $R$ is symmetric because \[ A \cap C = B \cap C \Leftrightarrow B \cap C = A \cap C \] + + $R$ is transitive because \[ (A \cap C = B \cap C) \wedge (B \cap C = D \cap C) \Rightarrow A \cap C = D \cap C \] + + \subexc{} + + $R$ is not reflexive because \[ l_1 \not\perp l_1 \] + + $R$ is symmetric because \[ l_1 \perp l_2 \Leftrightarrow l_2 \perp l_1 \] + + $R$ is not transitive because \[ l_1 \perp l_2 \wedge l_2 \perp l_3 \Rightarrow l_1 \not\perp l_3 \] + + \subexc{} + + $R$ is not reflexive because \[ (2n + 1) + (2n + 1) = 2(2n + 1) = 2k \] + + $R$ is symmetric because \[ x+y = y+x = 2n+1 \] + + $R$ is not transitive because an odd number can only be the sum of two integers if one is odd and the other is even + + Case 1: $x$ is even and $y$ is odd: + \begin{align*} + x + y &= 2n+1 \\ + y + z &= 2n+1 \Rightarrow z = 2k \\ + x+z &= 2k_1 + 2k_2 = 2(k_1 + k_2) = 2k + \end{align*} + + Case 2: $x$ is odd and $y$ is even: + \begin{align*} + x + y &= 2n+1 \\ + y + z &= 2n+1 \Rightarrow z = 2k + 1 \\ + x+z &= (2k_1+1) + (2k_2+1) = 2(k_1 + k_2) + 2 = 2(k_1 + k_2 + 1) = 2k + \end{align*} + + \end{subexcs} + + \exc{} + + In order to show that this is an equivalence relation, the relation has to be reflexive, symmetric and transitive + + Reflexive: + \[ ab = ba \] + + Symmetric: + \[ (ad = bc) \Leftrightarrow (bc = ad) \] + + Transitive: + \[ (ad = bc) \wedge (cf = de) \Leftrightarrow \left(\frac{a}{b} = \frac{c}{d}\right) \wedge \left(\frac{c}{d} = \frac{e}{f}\right) \Rightarrow \left(\frac{a}{b} = \frac{e}{f}\right) \Leftrightarrow (af = be) \] + + \exc{} + + In order to show that this is an equivalence relation, the relation has to be reflexive, symmetric and transitive + + Reflexive: + \[ x+y = x+y \] + + Symmetric: + \[ (x+y = u+v) \Leftrightarrow (u+v = x+y) \] + + Transitive: + \[ (x+y = u+v) \wedge (u+v = m+n) \Rightarrow (x+y = m+n) \] + + In this case, you could either use the fact that there are only specific integers that will sum to another integer, or check every relation between every tuple in order to calculate the equivalence classes. I decided to solve it by automating the process. + + \codeFile{scripts/ex7.hs}{haskell} + + Output: + \begin{verbatim} + [(1,3),(2,2),(3,1)] + [(1,5),(2,4),(3,3),(4,2),(5,1)] + [(1,1)] + \end{verbatim} + + therefore + + \begin{align*} + [(1,3)] &= \{(1,3), (2,2), (3,1)\} \\ + [(2,4)] &= \{(1,5), (2,4), (3,5), (4,2), (5,1)\} \\ + [(1,1)] &= \{(1,1)\} + \end{align*} + + \exc{} + In order to show that this is an equivalence relation, the relation has to be reflexive, symmetric and transitive + + Reflexive: + \[ x - x \bmod 3 = 0 \bmod 3 = 0 \] + + Symmetric: + \[ (x - y \bmod 3 = 0) \Leftrightarrow (x,y= 3k_1 + r, 3k_2 + r) \Leftrightarrow (y - x \bmod 3 = 3(k_2 - k_1) + r - r = 0) \] + + Transitive: + \[ (ad = bc) \wedge (cf = de) \Leftrightarrow \left(\frac{a}{b} = \frac{c}{d}\right) \wedge \left(\frac{c}{d} = \frac{e}{f}\right) \Rightarrow \left(\frac{a}{b} = \frac{e}{f}\right) \Leftrightarrow (af = be) \] + + The equivalence classes will contain the numbers that has the same remainder after dividing by $3$, since subtracting them from each other will remove the remainder and make the number divisible by $3$. + + therefore the partition of $A$ induced by $R$ will be + + \[ \{\{1,4,7\}, \{2,5\}, \{3,6\}\} \] + + + \end{excs} + + + +\end{document} diff --git a/exercise5/scripts/ex7.hs b/exercise5/scripts/ex7.hs new file mode 100644 index 0000000..1ac0939 --- /dev/null +++ b/exercise5/scripts/ex7.hs @@ -0,0 +1,30 @@ +import Control.Monad (mapM_) +import Data.List (nub) + +type Pair = (Integer, Integer) +type Relation = (Pair, Pair) + +cartesianProduct :: [Integer] -> [Pair] +cartesianProduct domain = [ (x,y) | x <- domain, + y <- domain ] + +calculateRelations :: [Pair] -> (Pair -> Pair -> Bool) -> [Relation] +calculateRelations set relation + = nub [ (p1, p2) | p1 <- set, + p2 <- set, + relation p1 p2 ] + +getRelatedPairsOf :: Pair -> [Relation] -> [Pair] +getRelatedPairsOf s r = [ p2 | (p1, p2) <- r, + p1 == s ] + +main :: IO () +main = do + let + -- set a be the cartesian product of two lists of integers from 1 to and including 5 + setA = cartesianProduct [1..5] + -- set r be the relation on a that satisfy the following condition + r = calculateRelations setA (\(x,y) (u,v) -> x+y == u+v) + + -- filter out the equivalence classes of the following pairs + mapM_ (print . flip getRelatedPairsOf r) [(1,3), (2,4), (1,1)] \ No newline at end of file diff --git a/exercise5/scripts/ex8.hs b/exercise5/scripts/ex8.hs new file mode 100644 index 0000000..94d5b90 --- /dev/null +++ b/exercise5/scripts/ex8.hs @@ -0,0 +1,27 @@ +import Control.Monad (mapM_) +import Data.List (partition) + +-- | Split off any nums that satisfy the relation and return the split and the rest in a tuple +splitOffRelatedNums :: (Integer -> Integer -> Bool) -> [Integer] -> ([Integer],[Integer]) +splitOffRelatedNums relation nums = partition (relation x) nums + where + x = head nums + +-- | Split off equivalence groups until there are no more that satisfy the condition +getEquivalenceClasses :: (Integer -> Integer -> Bool) -> [Integer] -> [[Integer]] +getEquivalenceClasses relation nums + = case nums of + [] -> [] + nums -> x : getEquivalenceClasses relation xs + where + (x,xs) = splitOffRelatedNums relation nums + +main :: IO () +main = do + let + setA = [1..7] + + relation :: Integer -> Integer -> Bool + relation x y = (x - y) `mod` 3 == 0 + + mapM_ print $ getEquivalenceClasses relation setA \ No newline at end of file diff --git a/exercise6/main.tex b/exercise6/main.tex new file mode 100644 index 0000000..fe69bdf --- /dev/null +++ b/exercise6/main.tex @@ -0,0 +1,231 @@ +\documentclass[12pt]{article} +\usepackage{ntnu} +\usepackage{ntnu-math} +\usepackage{ntnu-code} + +\author{Øystein Tveit} +\title{MA0301 Exercise 6} + +\usepackage{amsthm} +\usepackage{mathabx} + +\begin{document} + \ntnuTitle{} + \break{} + + \begin{excs} + \exc{} + + \begin{subexcs} + + \subexc{} + + In order to show that this is a partial order, the relation has to be reflexive, antisymmetric and transitive + + However, it is not antisymmetric because + + \[ 4-2 \bmod 2 = 0 \wedge 2 - 4 \bmod 2 = 0 \] + + \subexc{} + + In order to show that this is a partial order, the relation has to be reflexive, antisymmetric and transitive + + However, it is not antisymmetric because + + \[ (1,2)R(1,3) \wedge (1,3)R(1,2) \wedge (1,2) \neq (1,3) \] + + \end{subexcs} + + \exc{} + + \begin{figure}[H] + \begin{mgraphbox}[width=5cm] + \center + \begin{tikzpicture}[scale=1] + \tikzset{every node/.style={shape=circle,draw,inner sep=2pt}} + + \node (a) at (0,0) {$1$}; + \node (b) at (1,1) {$2$}; + \node (c) at (-1,1) {$3$}; + \node (d) at (0,2) {$6$}; + \node (e) at (-2,2) {$9$}; + \node (f) at (-1,3) {$18$}; + + \draw (a) -- (b) -- (d) -- (f) -- (e) -- (c) -- (a); + \draw (c) -- (d); + \end{tikzpicture} + \end{mgraphbox} + \caption{Hasse diagram of $R$} + \end{figure} + + \exc{} + + \begin{subexcs} + + \subexc{} + + In order to show that this is a partial order, the relation has to be reflexive, antisymmetric and transitive + + Reflexive: + + \begin{gather*} + (a < a) \vee ((a = a) \wedge b \leq b) \\ + F \vee (T \wedge T) \\ + F \vee T \\ + T \\ + \end{gather*} + + Antisymmetric: + + Case $i$) + \begin{align*} + a < c \Rightarrow a \neq c \wedge \neg (a < a) + \end{align*} + + Case $ii$) + \begin{gather*} + (a,b) \neq (c,d) \wedge (a=c) \wedge (b \leq d) \Rightarrow b \neq d \Rightarrow b < d \\ + \therefore (a = c) \wedge (b \leq d) \Rightarrow \neg (a < c) \wedge \neg (d \leq b) \\ + \end{gather*} + + Transitive: + + \[ (a,b)R(c,d) \wedge (c,d)R(e,f) \Rightarrow (a,b)R(e,f) \] + + This will be a proof by cases. In each case, I'm going to assume only one of the expressions in $R$ turned out true, and show that it means that at least one of the expressions will be true as a result. + + Case $i$ and $i$) + \[ (a < c) \wedge (c < e) \Rightarrow a < e \] + + Case $i$ and $ii$) + \[ (a < c) \wedge (c=e \wedge d \leq f) \Rightarrow a < e \] + + Case $ii$ and $i$) + \[ (a = c \wedge b \leq d) \wedge (c < e) \Rightarrow a < e \] + + Case $ii$ and $ii$) + \[ (a = c \wedge b \leq d) \wedge (c=e \wedge d \leq f) \Rightarrow (a=f \wedge b \leq f) \] + + \subexc{} + + \begin{figure}[H] + \begin{mgraphbox}[width=5cm] + \center + \begin{tikzpicture}[scale=1] + \tikzset{every node/.style={shape=circle,draw,inner sep=2pt}} + + \node (a) at (0,0) {$0,0$}; + \node (b) at (0,1) {$0,1$}; + \node (c) at (0,2) {$1,0$}; + \node (d) at (0,3) {$1,1$}; + + \draw (a) -- (b) -- (c) -- (d); + \end{tikzpicture} + \end{mgraphbox} + \caption{Hasse diagram of $R$} + \end{figure} + + $(0,0)$ is the only minimal element and $(1,1)$ is the only maximal element in $R$. + + \subexc{} + + Since $R$ only has one minimal and one maximal element, it is a total order. + + \end{subexcs} + + \exc{} + + \begin{subexcs} + + \subexc{} + This is a function because x can be expressed in terms of y + + Range of $f(\Z)$: $\{ x \mid \pm \sqrt{x-7} \in \Z \}$ + + \subexc{} + This is not a function because + + \[ x = (\pm y)^2 \] + + \subexc{} + This is a function because x can be expressed in terms of y + + Range of $f(\R)$: $\R$ + + \subexc{} + This is not a function because + + \[ x = \pm \sqrt{-y^2+1} \] + + \end{subexcs} + + \exc{} + + \begin{subexcs} + \subexc{} + \[ f(x) = 2x - 3 \] + + One to one: \vcheck + + Onto: \xcheck + + Range of $f(\Z)$: $\{ x \mid x \bmod 2 = 1 \}$ + + + \subexc{} + \[ f(x) = x^2 \] + + One to one: \xcheck + + Onto: \xcheck + + Range of $f(\Z)$: $\{ x \mid \sqrt{x} \in \Z \}$ + + \subexc{} + \[ f(x) = x^3+x \] + + One to one: \vcheck + + Onto: \xcheck + + Range of $f(\Z)$: $\{ x \in f(\Z) \}$ \hspace*{2cm} \fbox{See message at ovsys} + \end{subexcs} + + \exc{} + + \begin{subexcs} + \subexc{} + \[ f(x) = 2x - 3 \] + + One to one: \vcheck + + Onto: \vcheck + + Range of $f(\R)$: $\R$ + + + \subexc{} + \[ f(x) = x^2 \] + + One to one: \xcheck + + Onto: \xcheck + + Range of $f(\R)$: $\{ x \mid x \geq 0 \}$ + + \subexc{} + \[ f(x) = x^3+x \] + + One to one: \vcheck + + Onto: \vcheck + + Range of $f(\R)$: $\R$ + \end{subexcs} + + + \end{excs} + + + +\end{document} diff --git a/exercise7/main.tex b/exercise7/main.tex new file mode 100644 index 0000000..7a5e26d --- /dev/null +++ b/exercise7/main.tex @@ -0,0 +1,342 @@ +\documentclass[12pt]{article} +\usepackage{ntnu} +\usepackage{ntnu-math} + +\author{Øystein Tveit} +\title{MA0301 Exercise 7} + +\usepackage{amsthm} +\usepackage{mathabx} + +\begin{document} + \ntnuTitle{} + \break{} + + \begin{excs} + + \exc{} + \begin{subexcs} + \subexc{} + + By the definitions given in the exercise, we can define the PoS (partition of S) as + + \[ \forall y \in T \{ x \in S \mid f(x) = y\} \] + + In order for PoS to be a partition of a set, the following conditions have to hold: \\ + + The PoS can not contain the empty set + + This holds because $f$ is a surjective function which by its definition $\forall y \in T \exists x \in S [f(x)=y]$ needs every $y$ in $T$ to have an $x$ in $S$. There are no $y$s without and $x$ and therefore no empty sets. \\ + + The union of all the subsets in $S$ has to be equal to $S$ + + This holds because $f$ is a function. Every $x$ of the domain needs to have a $y$ in the range, and because the union of the blocks of the PoS contains every $x$ for which there exists a $y$, that would mean it covers the whole domain. \\ + + No pair of sets in the PoS contains any common elements + + This holds because $f$ is a function. No $f(x)$ can have multiple values, and therefore there will not be any $x$s in several blocks of the partition. + + \subexc{} + + If $f$ were to only be a function, the PoS would not fulfill the first condition in part a, and therefore it would not be a proper partition of a set. + + \subexc{} + + If $f$ was bijective, every block in the PoS would have a cardinality of $1$, meaning that every block would only contain one element of $S$ + + + \setsubexc{4} + \subexc{} + + A block of $f^{-1}[\N]$ representing a natural number $n$ would be $\{x \mid n \leq x < n + 1\}$ + + + \end{subexcs} + + \exc{} + + \begin{figure}[H] + \begin{mgraphbox}[width=5cm] + \center + \begin{tikzpicture}[scale=1] + \tikzset{every node/.style={shape=circle,draw,inner sep=2pt}} + + \node (2) at (0,0) {$2$}; + \node (3) at (1,0) {$3$}; + \node (4) at (-1,1) {$4$}; + \node (16) at (0,2) {$16$}; + + \draw (2) -- (4) -- (16); + \end{tikzpicture} + \end{mgraphbox} + \caption{Hasse diagram of $R$ on $X$} + \end{figure} + + \begin{center} + Minimal elements $= \{3, 3\}$ \\ + Maximal elements $= \{3, 16\}$ + \end{center} + + \exc{} + + Reflexive: + \[ (a,a), (b,b), (c,c), (d,d) \] + + Antisymmetric: + There are no cases where $(x,y) \wedge (y,x)$ + + Transitive: + Because $(c,a) \wedge (a,d)$, $(c,d)$ is also included. + + \begin{figure}[H] + \begin{mgraphbox}[width=5cm] + \center + \begin{tikzpicture}[scale=1] + \tikzset{every node/.style={shape=circle,draw,inner sep=2pt}} + + \node (c) at (0,0) {$c$}; + \node (a) at (-1,1) {$a$}; + \node (b) at (1,1) {$b$}; + \node (d) at (0,2) {$d$}; + + \draw (c) -- (a) -- (d); + \draw (c) -- (b); + \end{tikzpicture} + \end{mgraphbox} + \caption{Hasse diagram of $P$} + \end{figure} + + \exc{} + The function is injective, because it is a linear polynomial. However, it is not bijective, because all integers of the form $3x$ or $3x-1$ as the input of $f^{-1}$ does not result in an integer + + \exc{} + + In order for $f$ to be an injective function, it has to hold that $f(x) = f(y) => x = y$. + + Suppose $f(x) = f(y)$ for $x,y \in \Z$ + + Case i) both are even + + \[ -2x=-2y => x = y \] + + Case ii) both are odd + + \[ 2x-1=2y-1 => x = y \] + + Therefore $f$ is injective\\ + + In order for $f$ to be surjective, it has to hold that $\forall n \in \N \exists x \in \Z [f(x)=n]$ + + Case i) $n$ is even + + The $x$ in this case has to be in the form of + + \[n = -2x \Leftrightarrow x = -\frac{n}{2}\] + + which would be an integer, because $n$ is even and therefore divisible by $2$ + + Since $x \leq 0$ + + \[ f(x) = f\left(\frac-{n}{2}\right) = -2\left(-\frac{n}{2}\right) = n\] + + Case ii) $n$ is odd + + The $x$ in this case has to be in the form of + + \[n = 2x-1 \Leftrightarrow x = -\frac{n+1}{2}\] + + which would be an integer, because $n$ is odd and therefore $n+1$ is divisible by $2$ + + Since $x > 0$ + + \[ f(x) = f\left(\frac{n+1}{2}\right) = 2\left(\frac{n+1}{2}\right) - 1 = n\] + + Therefore $f$ is surjective + + From here, I will create the inverse function piece by piece + + Piece 1) $x \leq 0$ + + \begin{align*} + y &= -2x \\ + -y &= 2x \\ + \frac{-y}{2} &= x \\ + x &= \frac{-y}{2} \\ + \end{align*} + + Piece 2) $x > 0$ + + \begin{align*} + y &= 2x - 1 \\ + y + 1 &= 2x \\ + \frac{y + 1}{2} &= x \\ + x &= \frac{y + 1}{2} \\ + \end{align*} + + hence + + \[ f^{-1} = + \begin{cases} + \frac{-y}{2} & \text{for } n \leq 0 \\ + \frac{y + 1}{2} & \text{for } n > 0 \\ + \end{cases} \] + + + + \exc{} + \begin{subexcs} + + \subexc{} + + Because $(f \circ g)$ is surjective, we know that + + \[\forall c \in C \exists a \in A [(f \circ g)(a) = c]\] + + therefore + + \[\forall f(a) = b \in B [g(b) = c]\] + + therefore $g$ is surjective + + \subexc{} + + Because an injective function is one to one, we know that if their output is equal, their inputs must also be equal. Therefore + + \begin{align*} + (f \circ g)(x) &= (f \circ g)(y) \\ + f(g(x)) &= f(g(y)) \\ + g(x) &= g(y) \\ + x &= y \\ + \end{align*} + + \[ ((f \circ g)(x) = (f \circ g)(y) \Leftrightarrow x = y) \Rightarrow (f\text{ is injective} \wedge g\text{ is injective} \Leftrightarrow f \circ g\text{ is injective}) \] + + \end{subexcs} + + \exc{} + + \begin{figure}[H] + \begin{mgraphbox}[width=15.8cm] + \center + \begin{tikzpicture}[scale=2] + + % Domains + \filldraw[fill=blue!20, draw=blue!60] (0,0) circle (1cm); + \filldraw[fill=blue!20, draw=blue!60] (2.5,0) circle (1cm); + \filldraw[fill=blue!20, draw=blue!60] (5,0) circle (1cm); + + % Ranges + \filldraw[fill=red!20, draw=red!60] (0,0) circle (0.5cm); + \filldraw[fill=red!20, draw=red!60] (2.5,0) circle (1cm); + \filldraw[fill=red!20, draw=red!60] (5,0) circle (0.5cm); + + % Labels + \node at (0, 1.2) {$A$}; + \node at (2.5, 1.2) {$B$}; + \node at (5, 1.2) {$C$}; + + \node at (1.25, 0.8) {\tiny$f(a)$}; + \node at (3.75, 0.8) {\tiny$g(b)$ or $h(b)$}; + + \node at (0, 0.7) {\tiny Preimage}; + \node at (0, 0) {\tiny Domain}; + \node at (2.5, 0) {\tiny Range of $f$}; + + % Nodes for arrows + \node (a1) at (0, 0.3) {}; + \node (b1) at (2.5, 0.3) {}; + \node (c1) at (5, 0.3) {}; + + % Arrows + \draw[->] (a1) to [out=30,in=150] (b1); + \draw[->] (b1) to [out=30,in=150] (c1); + + \end{tikzpicture} + \end{mgraphbox} + \caption{Diagram of $g \circ f: A \to C$ in the case where $f$ is surjective} + \end{figure} + + Because the range of $f$ covers the whole preimage of $g$ or $h$ when it is surjective, it means that if $g \circ f = h \circ f$ then $g = h$ + + \begin{figure}[H] + \begin{mgraphbox}[width=15.8cm] + \center + \begin{tikzpicture}[scale=2] + + % Domains + \filldraw[fill=blue!20, draw=blue!60] (0,0) circle (1cm); + \filldraw[fill=blue!20, draw=blue!60] (2.5,0) circle (1cm); + \filldraw[fill=blue!20, draw=blue!60] (5,0) circle (1cm); + + % Ranges + \filldraw[fill=red!20, draw=red!60] (0,0) circle (0.5cm); + \filldraw[fill=red!20, draw=red!60] (2.5,0) circle (0.8cm); + \filldraw[fill=red!20, draw=red!60] (5,0) circle (0.5cm); + + % Labels + \node at (0, 1.2) {$A$}; + \node at (2.5, 1.2) {$B$}; + \node at (5, 1.2) {$C$}; + + \node at (1.25, 0.8) {\tiny$f(a)$}; + \node at (3.75, 0.8) {\tiny$g(b)$ or $h(b)$}; + + \node at (0, 0.7) {\tiny Preimage}; + \node at (0, 0) {\tiny Domain}; + \node at (2.5, 0) {\tiny Range of $f$}; + + \node at (3.7, -1) {\tiny$g(b_1)$}; + \node at (3.7, -1.35) {\tiny$h(b_1)$}; + + % Nodes for arrows + \node (a1) at (0, 0.3) {}; + + \node (b1) at (2.5, 0.3) {}; + \node (b2) at (2.5, -0.85) {}; + + \node (c1) at (5, 0.3) {}; + \node (c2) at (5.7, -0.5) {}; + \node (c3) at (4.5, -0.6) {}; + + % Arrows + \draw[->] (a1) to [out=30,in=150] (b1); + \draw[->] (b1) to [out=30,in=150] (c1); + + \draw[->] (b2) to [out=-30,in=-140] (c2); + \draw[->] (b2) to [out=-30,in=-130] (c3); + + \end{tikzpicture} + \end{mgraphbox} + \caption{Diagram of $g \circ f: A \to C$ in the case where $f$ is not surjective} + \end{figure} + + Because the range of $f(a)$ restricts the domain of $g(b)$ or $h(b)$, as long as they map to the same elements within their restricted domain, $g \circ f = h \circ f$. \\ + + However, since $f(a)$ is not surjective, it doesn't imply that $g$ and $h$ can not differ outside of their domain. In order for $g \circ f = h \circ f$ to imply that $g = h$, $f$ has to be surjective. \\ + + Therefore \[ f(a)\text{ is surjective} \Leftrightarrow (g \circ f = h \circ f \Rightarrow g = h) \] + + \exc{} + \begin{align*} + f^{-1}(B_1 \cap B_2) &= \{a \mid a \in f^{-1}(B_1 \cap B_2)\} \\ + &= \{a \mid f(a) \in B_1 \cap B_2\} \\ + &= \{a \mid f(a) \in B_1 \wedge f(a) \in B_2\} \\ + &= \{a \mid a \in f^{-1}(B_1) \wedge a \in f^{-1}(B_2)\} \\ + &= \{a \mid a \in f^{-1}(B_1) \cap f^{-1}(B_2)\} \\ + &= f^{-1}(B_1) \cap f^{-1}(B_2) + \end{align*} + + \begin{align*} + f^{-1}(\overline{B_1}) &= \{a \mid a \in f^{-1}(\overline{B_1})\} \\ + &= \{a \mid f(a) \in \overline{B_1}\} \\ + &= \{a \mid f(a) \notin B_1\} \\ + &= \{a \mid a \notin f^{-1}(B_1)\} \\ + &= \{a \mid a \in \overline{f^{-1}(B_1)}\} \\ + &= \overline{f^{-1}(B_1)} \\ + \end{align*} + + \end{excs} + + + +\end{document}