# Comparing Numbers

In comparing numbers, all you need to understand is the decimal number system itself and how it’s been constructed. When you understand that system, everything made in it including numbers, can be dealt with. We talked extensively about the decimal number system previously, so now, let’s get to some examples.

### Comparing Numbers With Different Numbers of Digits

There might be any number of different cases that you might come across at one time or another but let’s talk about the case where the numbers that you want to compare have different numbers of digits. For example,

22, 39, 457, 7578, 45889, 453098, 4576880

Please note that all across these mathematics articles, I use commas to separate numbers and not as a place holder indicator. Meaning that the list above contains seven different numbers. Wherever it’s required for me to use comma in a number to separate the digits, I’ll explicitly state it.

Alright, so in the list above, we have seven numbers, the first two have two digits each. The next one has three digits. The next one four digits and the last one 7 digits. As we discussed in the previous article as well, having more digits will always automatically mean that the value of the number is greater, no matter what sort of digits you have in the two numbers. Meaning that you can start counting the digits without paying any attention to the digits. If one of the numbers has more digits, it’s going to be greater. And the reason for that is, let’s say that you have a five-digit number like 99999. This is the greatest five-digit number. All the digits are 9’s. Let’s compare it with a six-digit number like 100000. This is the smallest six-digit number. All the digits except for the last one are zeros. Having all those 9’s in the five-digit number might have you believe that it’s a larger number compared to all the zeros in the other number. But you know that 99999 + 1 = 100000. Meaning that you do need to add a 1 to the five-digit number to get to the six-digit number. So only the fact that the six-digit number has one digit more than the other one, you can logically conclude that the six-digit number is greater, regardless of the digits in the two numbers.

### Comparing Numbers With Same Number of Digits

Now let’s consider the case that the numbers under study have the same number of digits. Let’s have the following list of numbers as an example:

1807, 1808, 1810, 1972, 9167, 9976

In this list, you have six numbers, all having four digits. So you cannot use the strategy used in the previous section. You can use the organization of the decimal number system to come up with a strategy to compare the numbers without having to spend much time unnecessarily on the problem. In computer science, they call this sometime the “CPU time.” When a software engineer wants to solve a problem, he has to solve it in the most efficient way, not having the computer do unnecessary things and getting the computer to solve the problem in such a way that the CPU has to do the least amount of calculation to get to the result. If they did not do this, your avatar in your favorite computer game would need probably 10 seconds to move to the left went you told him to do so by pressing some key on the keyboard or issuing the same command on your touch screen. The game would, in no way, seem or feel “real.” The strategy used to solve such a problem is called an “algorithm.” You too should come up with good and time-saving algorithms while solving your math problems. And, at the end of the day, computer science or programming is the very same thing as solving problems whose nature is purely numbers. So you need to understand your numbers well.

Now let’s get back to out list of numbers. You see that all of these numbers have four digits, the 1’s place, 10’s place, 100’s place and 1000’s place. You know that if some digit is in the 1000’s place value, it’s going to contribute to the overall value of the number much more than a digit in the 1’s value for example. For example, the two numbers 1009 and 9001 both have the same number of digits and also the very same digits. The only difference between the two numbers is that the digits have moved around. Now in 1009, you have 1 in the 1000’s place value. That’s 1 * 1000 = 1000. In 9001, you have a 9 in the 1000’s place value. That’s a 9 * 1000 = 9000. That’s already 8000 units difference between the two numbers. Even if you swapped both the zeros in 1009 with 9’s, the value of the three 9’s would be only 999 which is nothing compare to the value of 9 in 9001 which is 9000. So 9001 still wins even if all the digits except for the 1000’s place value in 1009 are 9’s. What does that tell you? That, if both the numbers have the same number of digits, you can simply start with the highest place value and compare the two digits between the two numbers in that place value. In whichever number the greater digit happens to be, that number is greater.

1807, 1808, 1810, 1972, 9167, 9976

Now since all of these number have the same number of digits, I can simple go to the last place value, the 1000’s. The first four numbers have 1’s in the 1000’s place value and the last two have 9’s. The the first four lose. The last two numbers have 9’s in the 1000’s place value so as far as the the 1000’s place value is concerned, they have the same values. Logically, what you’d do next is, move to the next lower place value, the 100’s. 9167 has a 1 in the 100’s place value. That’s a 1 * 100 = 100. 9976 has a 9 in the 100’s place value. That’s a 9 * 100 = 900. So 9976 wins. 9976 is the greatest number among all the six numbers on this list.

These articles are used by the author in a series of mathematics courses that will teach you mathematics from the sixth standard all the way up to 12th standard. The purpose of these courses are to help us understand mathematics so that you can use them professionally well. There is a road map that we have put together about the all the courses included, where to starts, etc. To know more about that and have access to those courses, please visit mathematics page on Great IT Courses. Thank you. Web Developer