\documentclass[11pt]{article}
\input{headers02}

\usepackage{fancyhdr}   
\pagestyle{fancy}      
\lhead{CS 355, FALL 2022}               
\rhead{Name: Hemanta K. Maji} %%% <-- REPLACE Hemanta K. Maji WITH YOUR NAME HERE

\usepackage[strict]{changepage}  
\newcommand{\nextoddpage}{\checkoddpage\ifoddpage{\ \newpage\ \newpage}\else{\ \newpage}\fi}  


\begin{document}

\title{Homework 2}

\date{}

\maketitle 

\thispagestyle{fancy}  
\pagestyle{fancy}      




\begin{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item {\bfseries Some properties of $(\bbZ_p^*,\times)$ (25 points).} 
  Recall that $\bbZ_p^*$ is the set $\{1,\dotsc,p-1\}$ and $\times$ is integer multiplication $\mod p$, where $p$ is a prime. 
  For example, if $p=5$, then $2\times 3$ is $1$. 
  In this problem we shall prove that $(\bbZ_p^*,\times)$ is a group, when $p$ is any prime. 
  The only part missing in the lecture was the proof that every $x\in\bbZ_p^*$ has an inverse. 
  We will find the inverse of any element $x\in\bbZ_p^*$. 
  \begin{enumerate}
  \item(10 points) Recall $\binom pk \defeq \frac{p!}{k!(p-k)!}$. 
    For a prime $p$, prove that $p$ divides $\binom pk$, if $k\in\{1,2,\dotsc,p-1\}$. \newline
  {\bfseries Solution.}  \newline
   % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
   
   \newpage
  \item(10 points) Recall that $(1+x)^p = \sum_{k=0}^p \binom pk x^k$. 
    Prove by induction on $x$ that, for any $x\in\bbZ_p^*$, we have  
      $$\overbrace{x\times x \times \dotsi \times x}^{p\text{-times}}=x$$\newline
  {\bfseries Solution.}  \newline
  % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
  
   \newpage
   \item(5 points) For $x\in\bbZ_p^*$, prove that the inverse of $x\in\bbZ_p^*$ is given by 
     $$\overbrace{x\times x \times \dotsi \times x}^{(p-2)\text{-times}}$$ 
  That is, prove that $x^{p-1}=1\mod p$, for any prime $p$ and $x\in\bbZ_p^*$.      
     \newline
  {\bfseries Solution.}  \newline
  % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
  
  \newpage
  \end{enumerate} 
  

  


  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 
 \item    {\bfseries Understanding Groups: Part one (30 points).} 
    Recall that when we defined a group $(G,\circ)$, we stated that there exists an element $e$ such that for all $x\in G$ we have $x\circ e=x$. 
  Note that $e$ is ``applied on $x$ from the right.'' 
  
  Similarly, for every $x\in G$, we are guaranteed that there exists $\inv(x)\in G$ such that $x\circ\inv(x)=e$. 
  Note that $\inv(x)$ is again ``applied to $x$ from the right.'' 
  
  In this problem, however, we shall explore the following questions: (a) Is there an ``identity from the left?,'' and (b) Is there an ``inverse from the left?'' 
  
  We shall formalize and prove these results in this question. 
  \begin{enumerate}
   \item (5 points) Prove that it is impossible that there exists $a,b,c\in G$ such that $a\neq b$ but $a\circ c = b\circ c$. \newline
    {\bfseries Solution.}  \newline
    % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
    \newpage
  \item (6 points) Prove that $e\circ x = x$, for all $x\in G$.  \newline
    {\bfseries Solution.}  \newline
    % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
     \newpage
  \item (6 points) Prove that if there exists an element $\alpha \in G$ such that for \textbf{some} $x\in G$, we have $\alpha \circ x=x$, then $\alpha=e$.  \newline
  (Remark: Note that these two steps prove that the ``left identity'' is identical to the right identity $e$.) 
  \newline 
  {\bfseries Solution.}  \newline
  % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
     \newpage
  
  
  
  \item (8 points) Prove that $\inv(x)\circ x = e$.  \newline
    {\bfseries Solution.}  \newline
    % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
     \newpage
  \item (5 points) Prove that if there exists an element $\alpha\in G$ and $x\in G$ such that $\alpha\circ x=e$, then $\alpha=\inv(x)$.  \newline
  (Remark: Note that these two steps prove that the ``left inverse of $x$'' is identical to the right inverse $\inv(x)$. ) \newline
  {\bfseries Solution.}  \newline
  % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
 
     \newpage
 
 \end{enumerate}
 
    
  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 
 \item {\bfseries Understanding Groups: Part Two (15 points).}
  In this part, we will prove a crucial property of inverses in groups -- they are unique. And finally, using this property, we will prove a result that is crucial to the proof of security of one-time pad over the group $(G,\circ)$. 
 
 \begin{enumerate} 
   \item(9 points) Suppose $a,b\in G$. 
     Let $\inv(a)$ and $\inv(b)$ be the inverses of $a$ and $b$, respectively (\ie, $a\circ\inv(a)=e$ and $b\circ\inv(b)=e$). 
     Prove that $\inv(a)=\inv(b)$ if and only if $a=b$.  \newline
    {\bfseries Solution.}  \newline
    % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
     \newpage
  
  \item (6 points) Suppose $m\in G $ is a message and $c\in G$ is a cipher text. 
    Prove that there exists a unique $\sk\in G$ such that $m\circ \sk = c$.  \newline
    {\bfseries Solution.}  \newline
    % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
     \newpage
   \newpage
  \end{enumerate}
  
 \newpage 


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\item {\bfseries Calculating Large Powers mod $p$ (15 points).} 
  Recall that we learned the repeated squaring algorithm in class. 
\newline 
  Calculate the following using this concept \newline
  $$ 13^{2020^{2020}+2022} \pmod{101} $$
  (Hint: Note that $101$ is a prime number and before applying repeated squaring algorithm try to simplify the problem using what you learned in part C of question 1). \newline 
  {\bfseries Solution.}  \newline
   % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
   
     \newpage
  
  
 
   
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\item {\bfseries Practice with Fields (20 points).} 
  We shall work over the field $(\bbZ_5,+,\times)$. 
  
  \begin{enumerate}
  \item (5 points) Addition Table. 
    The $(i,j)$-th entry in the table is $i+j$. 
    Complete this table. 
    You do not need to fill the black cells because the addition is commutative. 
  
    \begin{table}[H]
    \begin{center}
    \begin{tabular}{|c|c|c|c|c|c|}\hline
     & 0 & 1 & 2 & 3 & 4 \\\hline 
    0 &  &  &  &  &  \\\hline
    1 & \cellcolor{black} &  &  &  &  \\\hline
    2 & \cellcolor{black} & \cellcolor{black} &  &  &  \\\hline
    3 & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} &  &  \\\hline
    4 & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} &  \\\hline
    \end{tabular}
    \end{center}
    \caption{Addition Table.}
    \end{table}
  
  \item (5 points) Multiplication Table. 
    The $(i,j)$-th entry in the table is $i\times j$. 
    Complete this table. 
  
    \begin{table}[H]
    \begin{center}
    \begin{tabular}{|c|c|c|c|c|c|}\hline
     & 0 & 1 & 2 & 3 & 4 \\\hline 
    0 &  &  &  &  &  \\\hline
    1 & \cellcolor{black} &  &  &  &  \\\hline
    2 & \cellcolor{black} & \cellcolor{black} &  &  &  \\\hline
    3 & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} &  &  \\\hline
    4 & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} & \cellcolor{black} &  \\\hline
    \end{tabular}
    \end{center}
    \caption{Multiplication Table.}
    \end{table}
    
  \item (5 points) Additive and Multiplicative Inverses. 
    Write the additive and multiplicative inverses in the table below. 
  
   \begin{table}[H]
    \begin{center}
    \begin{tabular}{|l|c|c|c|c|c|}\hline
    & 0 & 1 & 2 & 3 & 4 \\\hline 
    Additive Inverse &  &  &  &  &  \\\hline
    Multiplicative Inverse & \cellcolor{black} &  &  &  &  \\\hline 
    \end{tabular}
    \end{center}
    \caption{Additive and Multiplicative Inverses Table.}
    \end{table}
  
  \item (5 points) Division Table. 
    The $(i,j)$-th entry in the table is $i/ j$. 
    Complete this table. 
  
    \begin{table}[H]
    \begin{center}
    \begin{tabular}{|c|c|c|c|c|}\hline
      & 1 & 2 & 3 & 4 \\\hline 
    0 &  &  &  &  \\\hline
    1 &  &  &  &  \\\hline
    2 &  &  &  &  \\\hline
    3 &  &  &  &  \\\hline
    4 &  &  &  &  \\\hline
    \end{tabular}
    \end{center}
    \caption{Division Table.}
    \end{table}
  
  \end{enumerate} 




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newpage
\item {\bfseries Order of an Element in $(\bbZ_p^*,\times)$. (20 points)} The \textit{order} of an element $x$ in the multiplicative group $(\bbZ_p^*,\times)$ is the smallest positive integer $h$ such that $x^h = 1 \mod p $. For example, the order of 2 in $(\bbZ_5^*,\times)$ is 4, and the order of $4$ in $(\bbZ_5^*,\times)$ is 2. 
\begin{enumerate}
    \item (5 points) What is the order of 5 in $(\bbZ_{13}^*,\times)$? \newline
    {\bfseries Solution.} \newline
    % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
    \newpage
    \item (10 points) Let $x$ be an element in $(\bbZ_p^*,\times)$ such that $x^n=1 \mod{p}$ for some positive integer $n$ and let $h$ be the order of $x$ in $(\bbZ_p^*,\times)$. Prove that $h$ divides $n$.\newline
    {\bfseries Solution.} \newline
    % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
    \newpage
    \item (5 points) Let $h$ be the order of $x$ in $(\bbZ_p^*,\times)$. Prove that $h$ divides $(p-1)$.\newline
    {\bfseries Solution.} \newline
    % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
\end{enumerate}
\newpage

%\iffalse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%Problem 7%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\item {\bfseries Defining Multiplication over $\bbZ_{27}^*$ (25 points).} 
  In the class, we had considered the group $(\bbZ_{26},+)$ to construct a one-time pad for one alphabet messages. 
  A few students were interested in defining a group with 26 elements using a ``multiplication''-like operation. 
  This problem shall assist you to define the $(\bbZ_{27}^*,\times)$ group that has 26 elements.
  
  {\bfseries The first attempt from class.}
  Recall that in the class we had seen that the following is also a group.
    $$ (\bbZ_{27}\setminus\{0,3,6,9,12,15,18,21,24\},\times),$$
  where $\times$ is integer multiplication $\mod 27$. 
  However, the set had only 18 elements. 
  
  In this problem, we shall define $(\bbZ_{27}^*,\times)$ in an alternate manner such that the set has 26 elements. 
  
  {\bfseries A new approach.} 
  Interpret $\bbZ_{27}^*$ as the set of all triplets $(a_0,a_1,a_2)$ such that $a_0,a_1,a_2 \in \bbZ_3$ and at least one of them is non-zero. 
  Intuitively, you can think of the triplets as the ternary representation of the elements in $\bbZ_{27}^*$. 
  We interpret the triplet $(a_0,a_1,a_2)$ as the polynomial $a_0 + a_1X + a_2X^2$. 
  So, every element in $\bbZ_{27}^*$ has an associated non-zero polynomial of degree at most 2, and every non-zero polynomial of degree at most 2 has an element in $\bbZ_{27}^*$ associated with it. 
  
  The multiplication ($\times$ operator) of the element $(a_0,a_1,a_2)$ with the element $(b_0,b_1,b_2)$ is defined as the element corresponding to the polynomial
    $$(a_0 + a_1X + a_2X^2) \times (b_0 + b_1X + b_2X^2) \mod 2 + 2X + X^3$$
    
  The multiplication ($\times$ operator) of the element $(a_0,a_1,a_2)$ with the element $(b_0,b_1,b_2)$ is defined as follows.\newline
  %%%
  \begin{boxedminipage}{\linewidth}
  Input $(a_0,a_1,a_2)$ and $(b_0,b_1,b_2)$.
  \begin{enumerate}
  \item Define $A(X) \defeq a_0 + a_1X + a_2X^2$ and $B(X) \defeq b_0+b_1X+b_2X^2$
  \item Compute $C(X) \defeq A(X)\times B(X)$ (interpret this step as ``multiplication of polynomials with integer coefficients'') 
  \item Compute $R(X) \defeq C(X) \mod 2+2X+X^3$ (interpret this as step as taking a remainder where one treats both polynomials as polynomials with integer coefficients). 
    Let $R(X) = r_0 + r_1X + r_2X^2$
  \item Return $(c_0,c_1,c_2) = (r_0\mod 3, r_1\mod 3, r_2\mod 3)$

  \end{enumerate}
  \end{boxedminipage}
  %%%
  
  
  For example, the multiplication $(0,1,1)\times (1,1,2)$ is computed in the following way.
  \begin{enumerate}
  \item $A(X) = X + X^2$ and $B(X) = 1+X+2X^2$. 
  \item $C(X) = X + 2X^2 + 3X^3 + 2X^4$.
  \item $R(X) = -6-9X-2X^2$.
  \item $(c_0,c_1,c_2) = (0,0,1)$.
  \end{enumerate}
   
  
  According to \underline{this definition} of the $\times$ operator, solve the following problems. 
  \begin{itemize}
  \item (5 points) Evaluate $(1,0,1) \times (1,1,1) $ \newline
  {\bfseries Solution.} \newline
  % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
  
    \newpage
  \item (10 points) Note that $e=(1,0,0)$ is a identity element. Find the inverse of $(0,1,1)$.
  \newline
  {\bfseries Solution.} \newline
  % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
  
  \newpage
  
  \item (10 points) Assume that $(\bbZ_{27}^*,\times)$ is a group. 
    Find the order of the element $(1,1,0)$. 
    
    (Recall that, in a group $(G,\circ)$, the order of an element $x\in G$ is the smallest positive integer $h$ such that $\overbrace{x\circ x \circ \dotsi \circ x}^{h\text{-times}} = e$)
    \newline
  {\bfseries Solution.}  \newline
 % \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
 
    \newpage
  \end{itemize}


    \item {\bfseries Elliptic curve (10 points).} 
In class, we have briefly discussed elliptic curve.
Here we will see some concrete examples of elliptic curve on finite prime fields.

    \begin{enumerate}
    \item (5 points).
    Let $Y^2 = X^3 + X$ be an elliptic curve over the field $(F_{23}, +, \cdot).$
    A point $(X, Y)$ lies on the elliptic curve if it satisfies the equation $Y^2 = X^3 + X.$
        \begin{enumerate}
        \item (2 points)
        Verify that the two points $P = (21, 6)$ and $Q = (18, 10)$ are on the curve.
        
        {\bfseries Solution.}  
    
        \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
        \item (3 points)
        Find the point $R$ where the line connecting $P$ and $Q$ intersects the elliptic curve $Y^2 = X^3 + X.$ 
        For $R=(x,y)$, define the ``inverse of $R$'' to be the point $S = (x,-y)$. 
        Find the inverse of point $R.$
        Recall from the lecture that ``$P + Q$'' is defined to be the point $S$.  
            
        {\bfseries Solution.}  
    
        \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
            
        \end{enumerate}
    \newpage    
        
    \item (5 points).
    Let $Y^2 = X^3 + X + 7$ be an elliptic curve over the field $(F_{17}, +, \cdot).$
        \begin{enumerate}
        \item (2 points)
        Verify that the two points $P = (5, 16)$ and $Q = (1, 3)$ are on the curve.
        
        {\bfseries Solution.}  
    
        \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
        \item (3 points)
        Find the point $R$ where the line connecting $P$ and $Q$ intersects the elliptic curve $Y^2 = X^3 + X + 7.$ 
        Find the inverse of point $R.$
            
        {\bfseries Solution.}  
    
        \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
            
        \end{enumerate}
    \end{enumerate}
\newpage  
\end{enumerate}
\newpage


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PLEASE LIST COLLABORATORS BELOW  %%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\bfseries Collaborators :} \newline 
% ENTER THEIR NAMES HERE  

\end{document}
