\documentclass[12pt]{article}
\usepackage{fancyhdr,fancybox,amssymb,epsfig, amsmath, latexsym}
\usepackage[all]{xy}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes.geometric}
%\usepackage{tikz-3dplot}
\usepackage{tkz-graph}
\usepackage{tikz-cd}
\usepackage{enumerate}


\topmargin=-.5in
\headsep=0.2in
\oddsidemargin=0in
\textwidth=6.7in
\textheight=9.2in
\footskip=.5in


% Useful math macros
\def\ds{\displaystyle}
\def\bold{\bm}     % Change ``bm'' to ''mathbf'' for upright boldface.

\newcommand{\vv}[2]{\begin{bmatrix} #1 \\ #2 \end{bmatrix}}
\newcommand{\vvv}[3]{\begin{bmatrix} #1 \\ #2 \\ #3 \end{bmatrix}}
\newcommand{\vvvv}[4]{\begin{bmatrix} #1 \\ #2 \\ #3 \\ #4 \end{bmatrix}}
\newcommand{\vvvvv}[5]{\begin{bmatrix} #1 \\ #2 \\ #3 \\ #4 \\ #5 \end{bmatrix}}
\def\<{\langle}
\def\>{\rangle}
\newcommand{\ceil}[1] {\left\lceil #1 \right\rceil}
\newcommand{\floor}[1] {\left\lfloor #1 \right\rfloor}
\def\normal{\lhd}
\def\normaleq{\unlhd}
\def\nnormal{\ntriangleleft}
\def\nnormaleq{\ntrianglelefteq}
\def\Dot{\bm{.}}

%\def\subgroup{\leqslant}
%\def\nsubgroup{\nleqslant}
%\def\normal{\leqslant}
%\def\nnormal{\nleqslant}

\newcommand{\rddots}{\rotatebox{90}{$\ddots$}}
\def\setmin{-}

\def\Sum{\sum\limits}
\def\Prod{\prod\limits}
\def\Cap{\mathop\cap\limits}
\def\Cup{\mathop\cup\limits}
\def\Times{\mathop\times\limits}
\def\Oplus{\mathop\oplus\limits}
\def\Lim{\mathop\lim\limits}

\def\And{\wedge}
\def\Or{\vee}
\def\Not{\neg}

\def\longto{\longrightarrow}
\def\into{\hookrightarrow}
\def\longinto{\longhookrightarrow}

\def\A{\mathbb{A}}
\def\C{\mathbb{C}}
\def\F{\mathbb{F}}
\def\HH{\mathbb{H}}
\def\N{\mathbb{N}}
\def\Q{\mathbb{Q}}
\def\R{\mathbb{R}}
\def\Z{\mathbb{Z}}

\DeclareMathOperator{\Id}{Id}
\DeclareMathOperator{\Lcm}{lcm}
\DeclareMathOperator{\del}{\nabla}
\DeclareMathOperator{\Trace}{tr}
\DeclareMathOperator{\Span}{Span}
\DeclareMathOperator{\Image}{Im}
\DeclareMathOperator\Perm{Perm}
\DeclareMathOperator\Char{char}
\DeclareMathOperator\Aut{Aut}
\DeclareMathOperator\Inn{Inn}
\DeclareMathOperator\Out{Out}
\DeclareMathOperator\Orb{Orb}
\DeclareMathOperator\Stab{Stab}
\DeclareMathOperator\Fix{Fix}
\DeclareMathOperator\Syl{Syl}
\DeclareMathOperator\Pre{Pre}
\DeclareMathOperator\Ker{Ker}
\DeclareMathOperator\Sym{Sym}
\DeclareMathOperator\Mat{Mat}
\DeclareMathOperator{\cl}{cl}
\DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\SL}{SL}
\DeclareMathOperator\PGL{PGL}
\DeclareMathOperator\PSL{PSL}
\DeclareMathOperator\PSU{PSU}
\DeclareMathOperator\PSP{PsP}
\DeclareMathOperator\Heis{Heis}
\DeclareMathOperator\Dic{Dic}
\DeclareMathOperator\Mod{Mod}
\DeclareMathOperator\Gal{Gal}
\DeclareMathOperator\Deg{Deg}

\DeclareMathOperator\Rect{\mathbf{Rect}}
\DeclareMathOperator\Tri{\mathbf{Tri}}
\DeclareMathOperator\Frieze{\mathbf{Frz}}
\DeclareMathOperator\Coin{\mathbf{Coin}}
\DeclareMathOperator\BOX{\mathbf{Box}}
\DeclareMathOperator\Light{\mathbf{Light}}
\DeclareMathOperator\Sq{\mathbf{Sq}}

% Colors 
\usepackage{xcolor}
\usepackage{color}
\definecolor{darkblue}{rgb}{0, 0, .6}
\definecolor{grey}{rgb}{.7, .7, .7}
%\hypersetup{colorlinks=true,linkcolor=darkblue,anchorcolor=darkblue,
%  citecolor=darkblue,pagecolor=darkblue,urlcolor=darkblue,
%  pdftitle={},pdfauthor={}
%}                               %% THIS CAUSES COMPILER ERROR
\colorlet{lightred}{red!30!white}
\colorlet{lightblue}{blue!30!white}
\colorlet{lightyellow}{yellow!30!white}
\colorlet{keylime}{green!10!white}
\colorlet{darkgreen}{green!50!black}
\colorlet{midgreen}{green!70!black}
\colorlet{lightgreen}{darkgreen!30!white}
\colorlet{lightpurple}{violet!60!white}
\colorlet{darkgrey}{black!70}
\colorlet{midgrey}{black!50}
\definecolor{Red}{rgb}{.9,0,0}
\definecolor{Blue}{rgb}{0,0,.9}
\definecolor{Green}{rgb}{0,.9,0}

\definecolor{conj-purple}{HTML}{E4B7FF}
\definecolor{conj-orange}{HTML}{FFD4B7}

\colorlet{lred}{red!50!white}
\definecolor{lblue}{rgb}{0.60, 0.75, 1}
\colorlet{lgreen}{green!40!white}
\colorlet{lyellow}{yellow!30!white}
%\definecolor{lpurple}{rgb}{0.6 0.35 0.8}
\definecolor{lpurple}{rgb}{0.7 0.45 0.9}
\colorlet{lorange}{orange!50!white}
\definecolor{lightgrey}{rgb}{.85, .85, .85}
\definecolor{faded}{rgb}{.75,.75,.75}
\definecolor{midgrey}{rgb}{.5,.5,.5}
%\definecolor{midgrey}{rgb}{.35, .35, .35}
%\definecolor{amethyst}{rgb}{0.6 0.4 0.8}
\definecolor{amethyst}{rgb}{0.54 0.17 0.89}
\definecolor{amber}{rgb}{1.0 0.49 0.0}

% COLORS FOR MULTIPLICATION TABLES  
\colorlet{tred}{red!70!white}
\colorlet{tblue}{blue!60!white}     %(higher number is more faded)
\colorlet{tgreen}{green!75!black}   %(higher number is brighter)
\colorlet{tyellow}{yellow!60!white}
\colorlet{tlime}{green!80!white}
\colorlet{tpink}{pink}
\colorlet{tpurple}{lpurple}
\colorlet{torange}{orange}

\colorlet{lightestblue}{blue!15!white}
\colorlet{lightestred}{red!15!white}

\newcommand*{\n}{5}   % counter for Cayley tables

%% CAYLEY DIAGRAM GLOBAL DEFAULTS
\tikzstyle{v} = [circle, draw, fill=lightgrey,inner sep=0pt, 
  minimum size=6mm]
\tikzstyle{r} = [draw, very thick, Red, -stealth]        % Red --->
\tikzstyle{b} = [draw, very thick, Blue, -stealth]       % Blue --->
\tikzstyle{g} = [draw, very thick, darkgreen, -stealth]  % Green --->
\tikzstyle{p} = [draw, very thick, amethyst, -stealth]     % Purple --->
\tikzstyle{rr} = [draw, very thick, Red]                 % Red ----
\tikzstyle{bb} = [draw, very thick, Blue]                % Blue ----
\tikzstyle{gg} = [draw, very thick, darkgreen]           % Green ----
\tikzstyle{pp} = [draw, very thick, amethyst]           % Purple ----
\tikzstyle{oo} = [draw, very thick, orange]             %% Orange ----

\tikzstyle{R} = [draw, very thick, Red, -stealth']        % Red --->
\tikzstyle{B} = [draw, very thick, Blue, -stealth']       % Blue --->
\tikzstyle{G} = [draw, very thick, darkgreen, -stealth']  % Green --->

\tikzset{r/.style={draw, very thick, Red, -stealth}}        % Red --->
\tikzset{R/.style={draw, very thick, Red, -stealth'}}        % Red --->

\tikzset{v/.style={circle, draw, fill=lightgrey,inner sep=0pt, 
  minimum size=6mm}}

\renewcommand\labelitemi{\rule[0.12em]{0.4em}{0.4em}}
\renewcommand\labelitemii{\normalfont\bfseries \rule[0.15em]{0.3em}{0.3em}}
\renewcommand\labelitemiii{\textasteriskcentered}
\renewcommand\labelitemiv{\textperiodcentered}

\renewcommand{\footrulewidth}{1pt}
\newenvironment{proof}[1][Proof.]{\smallskip\begin{trivlist}
    \item[\hskip \labelsep {\sffamily #1}]}{\qed\end{trivlist}\bigskip}
\newenvironment{sol}[1][Solution.]{\smallskip\begin{trivlist}
    \item[\hskip \labelsep {\sffamily #1}]}{\qed\end{trivlist}\bigskip}
\newenvironment{fminipage}%
{\setlength{\fboxsep}{15pt}\begin{Sbox}\begin{minipage}}%
{\end{minipage}\end{Sbox}\fbox{\TheSbox}}
\newcommand{\qed}{\hfill \ensuremath{\Box}}
\newcommand{\disp}{\displaystyle}


\pagestyle{fancy} \lhead{{\sf Homework 3 $|$ Due February 10 (Friday)
}} \rhead{\thepage} \cfoot{{\sf Math 4130/6130 $|$ Visual Algebra $|$
    Spring 2023 $|$ M.~Macauley}}

\begin{document}

%$\;$ \vspace{-4mm}

\begin{enumerate}

  %%--------------------------------------------------------------------

\item The ``rectangular'' quadratic integer rings $R_m=\Z[\sqrt{m}]$
  are norm-Euclidean for $m=-2,-1,2,3$. The proof involves
  constructing the quotient $q$, as the nearest element to $a/b$, as
  shown below:
  \[
  \hspace{-5mm}\begin{tikzpicture}[scale=3.8]
    \tikzstyle{B} = [circle, draw, Blue, fill=Blue,inner sep=0pt, 
      minimum size=1mm]
    \draw [faded] (0,-.15) to (0,1.566);
    \draw [faded] (1,-.15) to (1,1.566);
    \draw [faded] (-.15,0) to (1.15,0);
    \draw [faded] (-.15,1.414) to (1.15,1.414);
    \node [B] (q) at (0,0) {};
    \node [B] (a/b) at (.4,.6) {};
    \node [Blue,anchor=west] at (0,.7) {\footnotesize $\frac{a}{b}=s\!+\!t\sqrt{m}\in\Q(\sqrt{m})$};
    \node [Blue,anchor=west] at (.05,.1)
          {\footnotesize $q=c\!+\!d\sqrt{m}\in\Z(\sqrt{m})$};
    \draw [g] (a/b) to (q);
    \node [darkgreen] at (.5,.3) {\footnotesize $\frac{r}{b}\in\Q(\sqrt{m})$};
    \node at (.5,1.3) {\small$a=bq+r$};
    \node at (.5,1.15) {\small$\Updownarrow$};
    \node at (.5,.95) {\small$q=\frac{a}{b}-\frac{r}{b}$};
    \draw[decorate,decoration={brace,amplitude=3pt}] 
    (.398,-.02) -- (.02,-.02);
    \draw[decorate,decoration={brace,amplitude=3pt}] 
    (-.02,.02) -- (-.02,.58);
    \node at (-.25,.3) {\scriptsize $\leq \frac{1}{2}\sqrt{m}$};
    \node at (.2,-.15) {\scriptsize $\leq \frac{1}{2}$};
    \node[anchor=west] at (1.3,.55)  {\small For each $m=-2,-1,2,3$,};
        \node[anchor=west] at (1.3,.25)  {$-1<N(\tfrac{r}{b})=\underbrace{(c-s)^2}_{\leq\frac{1}{4}}-m\underbrace{(d-t)^2}_{\leq\frac{1}{4}}<1$.};
  \end{tikzpicture}
  \]
  Prove the same result for the ``triangular'' quadratic integer ring $R_m=\Z\big[\frac{1+\sqrt{m}}{2}\big]$, for $m=-3$, $-7$, and $-11$. Include an analogous picture illustrating the idea. [\emph{Hint}: Mimic the proof of the rectangular cases, but note that to reach nearest quadratic integer, one needs to travel at most a horizontal distance of $1/2$ and a vertical distance of $\sqrt{m}/2$.]
% choose $d\in\Z$ nearest to $2t$ and then $c\in\Z$ so that $c$ is as near to $2s$ as possible with $c\equiv d\pmod 2$, then set $q=(c+d\sqrt{m})/2$. Show that this works.
 

  %%--------------------------------------------------------------------
  
\item Find a solution to each of the following systems of equations,
  as guaranteed by the Sunzi remainder theorem, and show your work.
  \begin{enumerate}
  \item In the ring $\Z$ of integers:
    \[
    x\equiv 1 \pmod{8}\,,\qquad
    x\equiv 3 \pmod{7}\,,\qquad
    x\equiv 9 \pmod{11}\,
    \]
  \item In the ring $R_{-1}=\Z[i]$ of Gaussian integers:
    \[
    x\equiv i \pmod{i+1}\,,\qquad
    x\equiv 1 \pmod{2-i}\,,\qquad
    x\equiv 1+i \pmod{3+4i}\,
    \]
  \item In $F[x]$, where $F$ is a field in which $1+1\neq 0$:
    \[
    f(x)\equiv 1 \pmod{x-1}\,,\qquad
    f(x)\equiv x \pmod{x^2+1}\,,\qquad
    f(x)\equiv x^3 \pmod{x+1}\,
    \]
  \end{enumerate}

  %%--------------------------------------------------------------------

\item An \emph{idempotent} is an element $e\in R$ satisfying
  $e^2=e$. Two nonzero idempotents $e_1,e_2$ are an \emph{orthogonal
  pair} if $e_1+e_2=1$ and $e_1e_2=0$.
  \begin{enumerate}
  \item Show that the following are equivalent:
    \begin{enumerate}[(i)]
    \item $R$ contains an idempotent different from 0 and 1.
    \item $R$ contains an orthogonal pair of idempotents.
    \item $R\cong R_1\times R_2$ for some rings $R_1$ and $R_2$.
    \end{enumerate}
  \item Give an example of a non-orthogonal pair of distinct idemponents.
  \item Find all idempotents in the ring $\Z/20\Z\cong\Z_5\times\Z_4$.
  \end{enumerate}
  
\end{enumerate}
  
  %%----------------------------------------------------------
  
\end{document}


