Init commit

This commit is contained in:
Oystein Kristoffer Tveit 2021-03-24 11:48:48 +01:00
commit 910c52d418
12 changed files with 1945 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
*.prv
auto
_region_.tex
*.pdf
*.aux
*.fdb_latexmk
*.fls
*.log
*.out
*.synctex.gz
.projectile

0
README.md Normal file
View File

279
exercise1/main.tex Normal file
View File

@ -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}

119
exercise2/main.tex Normal file
View File

@ -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}

282
exercise3/main.tex Normal file
View File

@ -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}

185
exercise3/main2.tex Normal file
View File

@ -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}

199
exercise4/main.tex Normal file
View File

@ -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}

240
exercise5/main.tex Normal file
View File

@ -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}

30
exercise5/scripts/ex7.hs Normal file
View File

@ -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)]

27
exercise5/scripts/ex8.hs Normal file
View File

@ -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

231
exercise6/main.tex Normal file
View File

@ -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: