Ordering Numbers

A sports league table, a list of high scores, the class lined up shortest to tallest — all of these are numbers put in order. Being able to sort a jumble of numbers yourself is a handy everyday skill.

Once you can compare two numbers, you can put a whole set of numbers in order. Ordering means arranging them from smallest to largest — called ascending — or from largest to smallest, called descending.

The trick is simple: compare the numbers in pairs to find the smallest one, set it down first, then look for the next smallest from what is left, and keep going. So a jumble like 5,\ 2,\ 9 sorts into:

2 < 5 < 9

Read smallest first, the order is two, five, nine. Turn the whole row around and you get the same numbers in descending order, 9 > 5 > 2 — ascending and descending are just the same line read from opposite ends.

Suppose three friends each bring their pets. Sara brings cat cat two cats, Tom brings duck duck duck duck duck five ducks, and Mia brings nine fish. To line them up smallest group first we ask "who has the fewest?" — two cats. Then five ducks. Then nine fish. The order of the groups is exactly the order of their counts: 2 < 5 < 9. Counting things and ordering numbers are the very same job.

Compare digit by digit, from the left

For bigger numbers the safe way to compare is to line them up and read from the left — the most important digit first. The leftmost digit is worth the most (it is the place value that counts highest), so it decides the winner before you even look at the rest.

Take 19 and 21:

Only when the leftmost digits are equal do you move one place to the right. To order 34 and 37, the tens match (3 = 3), so the ones break the tie: 4 < 7, giving 34 < 37.

Two traps when you order numbers:

Three worked examples

Use the same recipe every time: pick the smallest, set it down, repeat.

fish Here is a lovely shortcut: every number has its own home on the number line, and homes are arranged small-on-the-left, big-on-the-right. So if you simply drop each number onto the line, they sort themselves — reading left to right gives ascending order for free. That is why ordering and the number line are best friends: the line is a picture of order.

See it: drop the numbers onto the line

A few numbers turn up out of order. Step through: we find the next smallest and drop it onto its home on the line. Because the line already runs small-to-large, the numbers land in ascending order from left to right. Press Refresh for a new set.

Here is the same idea as an animation. Press play. A few numbers appear out of order; we pick the smallest and slide it to its place, then the next, until they sit neatly along the line from small to large. Replay it: each time it shuffles a fresh set of numbers.

Khan Academy works through ordering numbers here: