Relevant Textbook Sections:
3.1 (The Euclidean Algorithm), 3.2 (The Extended Euclidean Algorithm).
To Do:
- If you’d like a refresher on today’s material, watch my videos on the Euclidean algorithm and the Extended Euclidean algorithm (also on the Notes/Videos page). You can also play with the new Euclidean Algorithm page, which shows the algorithm as piles of dots and walks you through the recipe cards; use it to check your answers below.
- Compute the gcd of 135 and 170. Show all the steps of the algorithm.
- Consider the equation . Find an integer solution to this equation using inspection or trial and error. Using it, tell me the inverse of modulo and the inverse of modulo . (This should require no computation, just look at your solution and have an aha moment!)
- Compute the gcd of 183 and 105. Show all the steps of the algorithm. Verify using the Sage Sandbox.
- Solve by expanding your work above into “recipe cards” as shown in class. Verify your answer using Sage’s command
xgcdin the Sage Sandbox. - What if we want to solve ? The zero is the weird part. Then we don’t use the Euclidean algorithm.
- Give one solution by inspection (just find a clever one).
- Now give another one different from the first.
- Now give infinitely many.
- Find a solution to (using the algorithm from class, or by guessing one).
- Now find infinitely many different solutions to . (Hint: use parts 1–4.)
- The goal of this exercise is to work out the runtime of the Euclidean algorithm (you may have seen this already, but do this without looking anything up). Think of the Euclidean algorithm as replacing one pair with a new pair at each step. For example, if we start with , then we get at the next step.
- Show that, if , then .
- Show that, if , then .
- Conclude that after two steps , the size of the first entry has decreased by at least half.
- What is the runtime of the Euclidean algorithm?
- (AI suggestion) Run the Euclidean algorithm on and and count the steps. Now try some other pairs of numbers of about the same size. Why are consecutive Fibonacci numbers such slow inputs? How does this compare with your bound in the previous problem?
- (AI suggestion) Which integers can be written as for integers ? Explain. Then find all integer solutions of .
- (AI suggestion) Use Sage to compute , and a few more like it, such as for other . Guess a formula. Can you explain it by running the Euclidean algorithm “in the exponents”? (Hint: .)