kids encyclopedia robot

Euclidean algorithm facts for kids

Kids Encyclopedia Facts

The Euclidean algorithm is a clever method used in mathematics. It helps us find the biggest number that can divide two other numbers exactly, without leaving a remainder. This special number is called the greatest common divisor (GCD). It's like finding the largest piece you can cut from two different lengths of string so that both original strings can be made up of only those pieces.

What is the Greatest Common Divisor (GCD)?

The greatest common divisor (GCD) of two numbers is the largest number that divides both of them without any remainder. For example, the numbers 12 and 18 can both be divided by 1, 2, 3, and 6. The largest of these common divisors is 6, so the GCD of 12 and 18 is 6. The Euclidean algorithm is a quick way to find this number, even for very large numbers.

How did Euclid explain it?

The ancient Greek mathematician Euclid probably didn't invent this algorithm, but he wrote about it around 300 BC. He explained it using lengths, not numbers. Imagine you have two lines of different lengths. Euclid's idea was:

If you have two distances, AB and CD, and you always take away the smaller from the bigger, you will end up with a distance that measures both of them.

This means you keep subtracting the smaller length from the larger one until you have a remainder that is smaller than the length you just subtracted. You then repeat the process with this remainder and the previous smaller length. The last length you find that divides everything perfectly is the GCD.

How the Algorithm Works Step-by-Step

The Euclidean algorithm works by repeatedly dividing numbers and looking at the remainders. It's a bit like a game of "remainder tag."

Here are the steps to find the GCD of two positive whole numbers, let's call them m and n:

  • Step 1: Make sure m is the larger number. If n is larger than m, simply swap them.
  • Step 2: Divide m by n and find the remainder. Let's call this remainder r.

* For example, if m is 49 and n is 21: * 49 divided by 21 is 2 with a remainder of 7. So, r = 7.

  • Step 3: Now, the old n becomes the new m.

* In our example, 21 becomes the new m.

  • Step 4: The remainder r becomes the new n.

* In our example, 7 becomes the new n.

  • Step 5: If the new n is not 0, go back to Step 2 and repeat the process.

* So now we divide 21 by 7. * 21 divided by 7 is 3 with a remainder of 0. So, r = 0.

* Since our remainder was 0, the last m value (which was 7) is the GCD of 49 and 21.

This method always works and is quite fast, even for very large numbers!

Images for kids

See also

Kids robot.svg In Spanish: Algoritmo de Euclides para niños

kids search engine
Euclidean algorithm Facts for Kids. Kiddle Encyclopedia.