# Due Wednesday, August 31st

For Wednesday:

1. Remember that you only need to spend 1 hour.  If you get stuck on a problem, don’t spin your wheels; try some others instead and sleep on it.  You can come back to things.  I will post full solutions for these.
2. Here are some solutions to the last daily post, which you should compare to your own answers from last time.
3. Compute the Euler phi functions $\varphi(12)$, $\varphi(26)$, $\varphi(27)$.  For each of these $n$, verify your answer by computing the set $(\mathbb{Z}/n\mathbb{Z})^*$.
4. Another ciphertext exchange on discord!
• Use Hill cipher to encrypt the answer to the question “What is your favourite vegetable?”  You can use some Hill Cipher tools here, to avoid by-hand computations.  Or you can write your own encryption/decryption program.  You can choose your own (valid!) key.
• Post your key and ciphertext.  Use someone else’s key & ciphertext to get their plaintext and announce the result.  There’s a #ciphertexts channel for this.
5. Can you find the Hill cipher key?  The Hill cipher (with 2×2 matrices) was used to encrypt the plaintext SOLVED to get the ciphertext GEZXDS.
6. Consider Hill cipher with the matrix $$\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$$ modulo $26$.  Can you find two plaintexts that encrypt to the same ciphertext?  (The plaintexts don’t need to be english, they can just be any letters.)  What’s wrong with this matrix?
7. Prove that
• if you take successive powers of $a$ mod $n$, i.e. $a,a^2,a^3,a^4,a^5,\cdots$, that eventually you will get a repeat (the same residue will appear more than once, e.g. $a^2$ might equal $a^7$)
• if $a$ is invertible, then eventually you will get a $1$
• Remind yourself how to use the Multiplicative Dynamics tools.  Can you find an example where you never get a $1$ in that list?

# Due Monday, August 29th

For Monday:

• A note about daily posts!  Sometimes the tasks may take more than an hour, or be frustrating.  Sometimes I give you tasks BEFORE I’ve taught you how to do them.  (My philosophy is that that’s part of the exploratory, messy nature of effective mathematics learning.)  In these circumstances, you should feel you have done your due diligence after one hour and hand in what you have (maybe skip over the frustrating task, at least at first).  Then you can come back to them later sometime, as needed.  For example, after Friday’s class, the Wednesday tasks should seem doable if they were not before, and you can go back to them to solidify understanding.
• Quick review question:  What is the inverse of 7 mod 11?  What is the inverse of 7 mod 14?  (Watch for trick questions!)
• I’m assuming you know about binary, and how to write things in binary.  If not, this PBS YouTube video gives a good review in the first four minutes.  (The rest of the video is also relevant and interesting (about ASCII and unicode etc.) if you are curious.)
• I’ve warned you several times that you cannot reduce an exponent modulo $n$ even when you are working in $\mathbb{Z}/n\mathbb{Z}$.  So we might sometimes need to compute large exponents.  Let’s suppose we need to compute $2^5$.  We could start with $2$, and then:
1. multiply by $2$ to get $2^2=2 \times 2 =4$
2. multiply by $2$ to get $2^3=4 \times 2=8$
3. multiply by $2$ to get $2^4=8 \times 2=16$
4. multiply by $2$ to get $2^5=16 \times 2=32$
• That’s four multiplications.  Instead, we could do this:
1. multiply by $2$ to get $2^2=4$
2. now that we have $2^2=4$, we could multiply it by itself to get $2^4 = 4 \times 4 = 16$
3. multiply by $2$ to get $2^5 = 32$
• That was only three multiplications!  That’s more efficient.  So, the challenge is to compute a high power by doing as few multiplications as possible.
• Your challenge is to compute $2^{148}$ modulo $1000$.  Imagine you have a calculator that will multiply two numbers modulo $1000$ for you (for example, you can use google, wolfram alpha or Sage on the course website), but WON’T just do big exponents.  (Remember, it’s always efficient to reduce mod n between each multiplication, so you never get more than 3 digit numbers to work with.)  How can you do this with the fewest multiplications possible?  Try to do the best you can, and count the multiplications you use.
• Then, watch this video (6:09) which gives a general algorithm.
• Use the double-and-add algorithm of the video (by writing 148 in binary) to demonstrate an efficient way to compute $2^{148}$.
• What you just learned is what computers do, when implementing cryptosystems in modular arithmetic.
• Now read Section 3.5 “Modular Exponentiation” of your textbook for another, different approach.  Now work out this method for $2^{148}$?  Better or worse?  This is an easier algorithm to internalize and remember for use on a test.
• Time left?  I wouldn’t want you to get bored.  If you still have some time left, you can optionally try to create a nice implementation of the double-and-add algorithm in your favourite language.  I’d be happy to see that in the canvas inbox if you do.  If you are new to programming, implementing the simpler algorithm of just multiplying by 2 repeatedly using a for-loop is a good first challenge.  There are tons of “learn python” resources online; here’s a YouTube playlist that seems popular.  Reach out to me!

# Due Friday August 26th

For Friday:

• Make sure you understand the ins and outs of the course setup (you’ve read all the top bar info on this site, heard me discuss in class, and have asked any questions if you have some), and have the textbook.
• Please make sure you have set a nickname/alias in discord that is your first name with last initial or last name.  Discord is meant to be a continuance of class, so we build community (so we like to know who is who).
• Take a look at the multiplication table modulo $26$, and figure out when a function $\alpha x+\beta \pmod{26}$ is suitable for encryption (this is affine cipher).  In other words, for which pairs $(\alpha,\beta)$ is the function $f(x)=\alpha x+\beta \pmod{26}$ invertible?  Write out a complete answer (some way of describing which pairs work and which don’t).  (If needed, remind yourself about invertible, bijective, injective, surjective.)
• Come up with a short (one word is best) answer to the question “What’s the coolest math?”  This is your plaintext.
• Choose a pair $(\alpha,\beta) \in (\mathbb{Z}/26\mathbb{Z})^2$ to use as a key.   Make sure you choice is suitable as described above.
• Encrypt the plaintext with affine cipher (by hand, using the cryptography tools sheet if you like).  If you need some notes on affine cipher, it’s Section 2.2 in the text.  This gives you your ciphertext.
• Post your ciphertext on the discord channel #ciphertexts, along with the key.
• Choose the most recent user’s post (besides yours) from #ciphertexts, and decrypt it (by hand).  Post the answer in the form “So-and-so thinks the coolest math is….”
• Suppose you eavesdrop on your little sister’s communications, and she is using affine cipher.  Her ciphertext is CRWWZ.  You know she starts every message she writes with “HA” (she’s weird that way).  Decrypt the message.  Explain how you did it.
• Write a proof for the Main Theorem of modular arithmetic that we did in class today (here are the lecture notes).  This theorem can be found everywhere (including in your textbook), but try to write your own proof first.  If you can’t, then look at a proof to understand the idea and then try to write your own with notes closed.
• Check out this tool for drawing pictures of the function $f(x)=ax \pmod{n}$.  Try it for $n=5$ and $n=6$ with different $a$’s.
• Check out this tool for making addition and multiplication tables modulo $n$.  Try it for $n=5$ and $n=6$ with different $a$’s.
• Form a conjecture about which values of $a$ result in the function $f(x)=ax$ being invertible modulo n.  You might want to try different $n$’s.
• What do you think is the essential reason that $f(x)=3x$ is not invertible modulo $6$?
• OPTIONAL:  If you would like a longer discussion of how and why modular arithmetic is a well-defined mathematical system, and all the formal mathematics underlying it, then I’ve got a video for you (17:26). But watching it is optional; in this course we focus on the intuition, properties and applications, not the mathematical formalism in terms of equivalence relations.

# Due Wednesday August 24th

Before Wednesday’s class:

• Get yourself set up on discord.  Before you use the invite link available in canvas, make sure your username is not offensive (I get a notification the moment you click the link).   Discord has channels where you can chat with each other, and message are public by default.  It also have a video/voice channel capability.  Please choose an alias on our server that is your first name and last initial or first name and last name (let me know of any concern).
• Read carefully through each of the pages that is listed on the TOP menu bar of this website (History, Notes/Videos, About, etc.).  These constitute the syllabus for the course.
• Make sure you have the textbook (Wade Trappe, Lawrence C. Washington, Introduction to Cryptography with Coding Theory, 2nd or 3rd edition).  The third edition seems only available electronically.   The editions are very similar and either one is fine.
• Note: the next activity is to watch a video and do an accompanying worksheet.  I strongly suggest working on this in groups, and collaborating on daily tasks with classmates in general.  To that end, I’ve set two designated times to meet on discord to do the video with peers (totally optional):
• Monday August 22nd at 9 pm
• Tuesday August 23rd at 6 pm
• The main activity for this daily post is to watch my video “Modular Arithmetic: User’s Manual” (9:22 mins:secs) and do the accompanying self-check worksheet.  Please be sure to show your work on the last problem.  (Note: you don’t need to print; you can work on a separate sheet of paper if desired.)
• You will track your work on daily posts using this evaluation form.  You’ll keep this all semester –you might want to print it out and clip it to your wall.  Give yourself a score for your work today.  You can always find the link to this file under “Notes/Videos” on the top bar.
• After each daily post, there are two things for you to do:  first, update your daily evaluation worksheet (the bullet point above), and then second, upload a record of your work to canvas.  (There’s only one upload box on canvas, which you will use over and over again.)  The record of your daily post activity should be ONE file including images/copy of your written work, and including a copy of your self-evaluation sheet as it stands currently (both sides).  This is so we have a record we can return to if anything gets lost (chances are non-trivial that some student will lose their sheet at some point).  If you’re having trouble making one file out of a bunch of images, one basic way that works is to put them into a google doc or word file and then print to pdf.
• I’m flexible about it as you get used to this “daily task” system.  Just try it out and let me know if there are any hiccups.  I’m here to answer questions.

# Welcome to Math 4440/5440 Fall 2022

Welcome!

This website will be your guide to the course.  You’ll come here for an hour between every lecture to do your daily assignments and keep up with the course.