\documentclass[12pt,letterpaper]{article}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[margin=3cm]{geometry}
\usepackage{fancyhdr}
\usepackage{mathtools}
\begin{document}

\pagestyle{fancy}
\lhead{Tyler Ayrton Stank}
\chead{CS435: Assignment 2}
\rhead{\today}

\begin{enumerate}

    %1
    \item The minimum block length is 2.

    %2
    \item To decrypt this text we need the inverse of the encryption matrix, 
        $$\begin{bmatrix*}[c]
            9  & 2 \\
            13 & 3
        \end{bmatrix*}^{-1}
          \equiv
          \begin{bmatrix*}
             3 & 24 \\
            13 &  9
          \end{bmatrix*}
          \pmod {26}
        $$
        Now we can left multiply our ciphertext (converted into column vectors) by the decryption matrix, to obtain plaintext vectors.
        $$\begin{bmatrix*}
            Y\\I
          \end{bmatrix*}
          \equiv
          \begin{bmatrix*}
            24\\8
          \end{bmatrix*}
          ;
          \begin{bmatrix*}
            F\\Z
          \end{bmatrix*}
          \equiv
          \begin{bmatrix*}
            5\\25
          \end{bmatrix*}
          ;
          \begin{bmatrix*}
            M\\A
          \end{bmatrix*}
          \equiv
          \begin{bmatrix*}
            12\\0
          \end{bmatrix*}
        $$
        $$
          \begin{bmatrix*}
             3 & 24 \\
            13 &  9
          \end{bmatrix*}
          \times
          \begin{bmatrix*}
            24\\8
          \end{bmatrix*}
          \equiv
          \begin{bmatrix*}
            4\\20
          \end{bmatrix*}\pmod {26}
        $$
        $$
          \begin{bmatrix*}
             3 & 24 \\
            13 &  9
          \end{bmatrix*}
          \times
          \begin{bmatrix*}
            5\\25
          \end{bmatrix*}
          \equiv
          \begin{bmatrix*}
           17\\4
          \end{bmatrix*}\pmod {26}
        $$
        $$
          \begin{bmatrix*}
             3 & 24 \\
            13 &  9
          \end{bmatrix*}
          \times
          \begin{bmatrix*}
            12\\0
          \end{bmatrix*}
          \equiv
          \begin{bmatrix*}
           10\\0
          \end{bmatrix*}\pmod {26}
        $$

        So our plaintext message is encoded as \{4, 20, 17, 4, 10, 0\} which corresponds to EUREKA.

    %3
    \item
    \begin{enumerate}
    \item
        To easily do the frequency count we can sort the letters alphabetically - \\
        {\tt MCIFGSQFSHWGGOTSKWHVASPSQOIGSHVSFSWGOQVOBQSWKOGBCHZWGHSBWBU}\\
        {\tt ABBBBCCFFFGGGGGGGHHHHHIIKKMOOOOOPQQQQSSSSSSSSSSTUVVVWWWWWWZ}\\
        From here we can see the frequency count is as follows:\\
        \begin{tabular}{cr}
            A &  1 \\
            B &  4 \\
            C &  2 \\
            F &  3 \\
            G &  7 \\
            H &  5 \\
            I &  2 \\
            K &  2 \\
            M &  1 \\
            O &  5 \\
            P &  1 \\
            Q &  4 \\
            S & 10 \\
            T &  1 \\
            U &  1 \\
            V &  3 \\
            W &  6 \\
            Z &  1 \\
        \end{tabular}\\
        Assuming that S, the most common letter in ciphertext, maps to E, the most common letter in English plaintext, we can unshift the cipher 12 spaces to obtain the plaintext:\\
        {\tt YOURSECRETISSAFEWITHMEBECAUSETHEREISACHANCEIWASNOTLISTENING}\\
        or ``Your secret is safe with me because there is a chance I was not listening."
    \end{enumerate}



\end{enumerate}

\end{document}
