# The Magic Box

### By: Fabian Meraz

## When should I use the Magic Box?

Before I go over how to use the magic box, we will first learn WHEN to use it. We can use the magic box whenever we have an equation of the form ax±by=1 and we are trying to find two integers x, and y that satisfy it (or in general ax±by=kg where g is the least common multiple of a and b and k is some integer). This last statement should look familiar; it is Bezout's theorem.Recall that Bezout’s theorem states, if the greatest common divisor of a and b is g, then there exist x and y so that ax+by=g.

## How do I use the Magic Box?

Now that you know when to use it, you are ready to learn how to do the magic. The first step is to use the Euclidean algorithm until you get a remainder of zero. The numbers that you will need for the magic box are the quotients (Q1, Q2, Q3,….Qi) you used during the Euclidean algorithm. Next start by drawing the box as shown in the picture. You do not need to write the “Q1…..Qi” you can plug in the corresponding values for the quotients. Now that we have our magic box set up, we will work through an example on how to use the magic box.

Since reading the steps can be confusing, we will see the steps in the following video.

## Exam Problem:

Find two integers x and y that satisfy 21x+13y=5.