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