\documentclass[12pt]{article}
\usepackage{ntnu}
\usepackage{ntnu-math}
\usepackage{ntnu-code}

\author{Øystein Tveit}
\title{MA0301 Exercise 11}

\begin{document}
  \ntnuTitle{}
  \break{}

  \begin{excs}

  \exc{}

  \[n^{n-2} = 4^{4-2} = 4^{2} = 16\]

  \exc{}

  To solve this exercise, I chose to implement the algorithm in python

  In order to keep track of the nodes, I have given them the following labels

  \includeDiagram[width=13cm, scale=1.6]{diagrams/ex2_1.tex}

  \break

  \codeFile{scripts/Kruskal.py}{python}

  Output:
  \begin{verbatim}
[('a', 'b'), ('e', 'f'), ('c', 'd'), ('h', 'e'), ('b', 'c'), ('f', 'g'),
  ('c', 'e')]
  \end{verbatim}

  When we connect the nodes, we get the minimal spanning tree:

  \includeDiagram[width=13cm, scale=1.6]{diagrams/ex2_2.tex}

  \exc{}
  \begin{subexcs}
    \subexc{}
    By counting the vertices, edges and regions, we can see that

    \begin{align*}
      |V| &= 17 \\
      |E| &= 34 \\
      |R| &= 19
    \end{align*}

    By applying Eulers theorem, we can confirm that this is a possible graph

    \begin{align*}
      V + R - E &= 2 \\
      17 + 19 - 34 &= 2 \\
      36 - 34 &= 2 \\
      2 &= 2
    \end{align*}

    \subexc{}
    By counting the vertices, edges and regions, we can see that

    \begin{align*}
      |V| &= 10 \\
      |E| &= 24 \\
      |R| &= 16
    \end{align*}

    By applying Eulers theorem, we can confirm that this is a possible graph

    \begin{align*}
      V + R - E &= 2 \\
      10 + 16 - 24 &= 2 \\
      26 - 24 &= 2 \\
      2 &= 2
    \end{align*}

  \end{subexcs}

  \exc{}

  Every edge touches 2 regions. And every is connected to at least 5 edges. Therefore the amount of edges will be

  \[ E \geq \frac{53 \cdot 5}{2} = 132.5 \]

  Since the amount of edges has to be an integer, we can round it up to $E \geq 133$

  Now we can use Eulers theorem for planar graphs to determine the amount of vertices

  \begin{align*}
    V + R - E &= 2 \\
    V &= 2 - R + E \\
    V &\geq 2 - 53 + 133 \\
    V &\geq 82
  \end{align*}

  Therefore $|V| \geq 82$

  \exc{}
  \begin{subexcs}
    \subexc{}

      By flipping the matrix once vertically and once horizontally, the matrix will equal the other matrix.

      Because flipping a matrix is a bijective function, composing two of them will also make a bijective function.

      After checking that the last matrix is a valid undirected graph, it is safe to conclude that the graphs are isomorphic

      \[
      \begin{bmatrix}
      0 & 0 & 1 \\
      0 & 0 & 1 \\
      1 & 1 & 0
      \end{bmatrix}
      \cong
      \begin{bmatrix}
      1 & 0 & 0 \\
      1 & 0 & 0 \\
      0 & 1 & 1
      \end{bmatrix}
      \cong
      \begin{bmatrix}
      0 & 1 & 1 \\
      1 & 0 & 0 \\
      1 & 0 & 0
      \end{bmatrix}
      \]
    
    \subexc{}
      By the same reasoning as \textbf{a)}, we have the following

      \[
      \begin{bmatrix}
      0 & 1 & 0 & 1 \\
      1 & 0 & 1 & 1 \\
      0 & 1 & 0 & 1 \\
      1 & 1 & 1 & 0
      \end{bmatrix}
      \cong
      \begin{bmatrix}
      1 & 0 & 1 & 0 \\
      1 & 1 & 0 & 1 \\
      1 & 0 & 1 & 0 \\
      0 & 1 & 1 & 1
      \end{bmatrix}
      \cong
      \begin{bmatrix}
      0 & 1 & 1 & 1 \\
      1 & 0 & 1 & 0 \\
      1 & 1 & 0 & 1 \\
      1 & 0 & 1 & 0
      \end{bmatrix}
      \]
    \end{subexcs}

  \exc{}
  \begin{subexcs}
    \subexc{}
      \[ uv = ababbab \]
      \[ |uv| = 7 \]

    \subexc{}
      \[ vu = bababab \]
      \[ |vu| = 7 \]

    \subexc{}
      \[ v^2 = babbab \]
      \[ |v^2| = 6 \]
  \end{subexcs}

  \exc{}
  \begin{subexcs}
    \subexc{}
      \[ KL = \{ ab^2, abb^2, a^2b^2, aaba, ababa, a^2aba \} \]

    \subexc{}

      \[ LL = \{ b^2b^2, b^2aba, abab^2, abaaba \} \]

  \end{subexcs}

  \exc{}
  \begin{subexcs}
    \subexc{}
      \[ L^* = \{b^2\}^* \]

    \subexc{}
      \[ L^* = \{a,b\}^* \]
    
    \subexc{}
      \[ L^* = \{a,b,c^3\}^* \]

  \end{subexcs}

  \exc{}
  \begin{subexcs}
    \subexc{}
    $w$ does not belong to $r$ because $w$ is does neither fit $a^*$ nor $(b \vee c)^*$

    \subexc{}
    $w$ does belong to $r$ because $w$ is exactly $(a \cdot 1) (b \vee c \cdot 2)$
    
  \end{subexcs}





  \end{excs}
\end{document}