Kodeclik Blog
About
Kodeclik is an online coding academy for kids and teens to learn real world programming. Kids are introduced to coding in a fun and exciting way and are challeged to higher levels with engaging, high quality content.
Popular Classes
Scratch Coding
Minecraft Coding
TinkerCAD
Roblox Studio
Python for Kids
Javascript for Kids
Pre-Algebra
Geometry for Kids
Copyright @ Kodeclik 2024. All rights reserved.
Whether the non-terminating decimal 0.999… is the same as 1 is a key question that students and experts sometimes grapple with. There are many ways to argue no and equally many ways to argue yes.
Some people will argue that the two values are not equal because they are different decimal representations and numbers are expected to have unique representations. In other words, we can always find some decimal numbers “hiding” in the space between these numbers irrespective of how long the decimal representation gets.
Some people will argue that they are equal and this can be done in many ways. One approach is to view the decimal as the summation of the infinite series 0.9 + 0.09 + 0.009 + …, which converges to 1, thus indicating the numbers are equal. Thus the ellipsis (“...”) is viewed as representing an infinite series.
Here is yet another “proof” that they are equal:
In this proof we first assign variable “x” to denote the non-terminating decimal representation in equation (1). We then multiply both sides of equation (1) by 10 to yield equation (2). We then subtract (1) from (2) to yield a simple “9x=9” from which “x=1” follows. Cunning, isn’t it?
Another way to think of this question is to write a computer program. In our case, we will write a Python program:
The above Python program iterates through a range of numbers from 1 to 19 (inclusive). Note that 20 is the index outside the range. For each iteration, it constructs the desired decimal as a quotient and compares it to 1. For example, when i is 1, the constructed expression represents the decimal number 0.9; when i is 2, the expression represents the decimal number 0.99; and so on.
If the constructed value is equal to 1, it assigns the message " is the same as 1" to a variable called message; otherwise, it assigns the message " is not the same as 1". Finally, it prints the calculated value along with the message.
The output will be something like:
Because the default Python arithmetic operations do not use infinite precision arithmetic after some time the returned quotients are essentially 1 and thus the Python program concludes that it is the same as 1.
This is why Kodeclik’s answer to “Is 0.999… equal to 1?” is “it depends”! As a programmer you have to ask yourself whether the approximations induced by the Python program (or any language for that matter) are steps you are comfortable with.
If you liked working with small numbers, you will like our blogpost about the birthday paradox calculator.
Want to learn Javascript or Python with us? Sign up for 1:1 or small group classes.
for i in range (1,20):
num = (10**i-1)/(10**(i))
if (num == 1):
message = " is the same as 1"
else:
message = " is not the same as 1"
print(str(num) + message)
0.9 is not the same as 1
0.99 is not the same as 1
0.999 is not the same as 1
0.9999 is not the same as 1
0.99999 is not the same as 1
0.999999 is not the same as 1
0.9999999 is not the same as 1
0.99999999 is not the same as 1
0.999999999 is not the same as 1
0.9999999999 is not the same as 1
0.99999999999 is not the same as 1
0.999999999999 is not the same as 1
0.9999999999999 is not the same as 1
0.99999999999999 is not the same as 1
0.999999999999999 is not the same as 1
0.9999999999999999 is not the same as 1
1.0 is the same as 1
1.0 is the same as 1
1.0 is the same as 1