Every computer uses binary. You're probably already aware of this.
The reason binary is used in computers is because computers use transistors to store computer data. Transistors can have one of two states: on or off. In binary, 0 can represent off and 1 can represent on.
(Also, side tangent, a boolean is equal to one byte and not one bit because the standard unit for data processable by a CPU is one byte. So a boolean equals one byte even though theoretically a boolean can be saved as 0 (false) or 1 (true))
In this post, I'm going to show you how to count in binary.
In day-to-day life, we use Base 10 as our counting system. Let me give an example of how this works.
Lets say we have the number 7683.
We can also write it like this:
7*10^3+6*10^2+8*10^2+3*10^0
(If you don't already know, the ^ operator/symbol denotes exponents, and the * operator/symbol denotes multiplication.)
7683 can also be written like
7000+600+80+3
So every digit in 7683 is multiplied by a power of 10, starting with 0 and going up one per place value.
Base 10 means we can use digits from 0 to 9 in our number.
But Base 10 is not the only way to count.
We also have Base 2.
Binary is Base 2.
Now, in Base 2, we can only use the digits 0 and 1.
And we multiply each digit in the number by a power of 2 instead of 10.
Let's try this concept on the number 1001.
1*2^3+0*2^2+0*2^1+1*2^0, or 8+0+0+1.
So 1001 in binary equals 9 in Base 10.
That can also be displayed like 1001^2 = 9^10
Let's try another example.
Can you, following the formula, convert 1100010001 from binary to a Base 10 numeral?
Go try it out by yourself. If you can't figure it out, come back and read the solution.
Ok, here is the solution:
1*2^9+1*2^8+0*2^7+0*2^6+0*2^5+1*2^4+0*2^3+0*2^2+0*2^1+1*2^0
Oof, that's big. Let's format it a bit.
(1*2^9)+(1*2^8)+(0*2^7)+(0*2^6)+(0*2^5)+(1*2^4)+(0*2^3)+(0*2^2)+(0*2^1)+(1*2^0)
Which can also be written as:
512+256+0+0+0+16+0+0+0+1
Which equals 785!
So 1100010001^2 = 785^10
But let's say we wanted to convert a numeral into binary.
Here is how we do that.
Let's try converting 7 to binary.
What we do is take the number and divide it by 2 until the quotient is 0, and then we take the remainder and add it as a bit. Let me show you.
So first:
7/2 = 3, with a remainder of 1. The bit place is 0.
3/2 = 1, with a remainder of 1. The bit place is 1.
1/2 is 0, with a remainder of one. The bit place is 2.
We put the remainder of the biggest hit place first, then going down and placing the remainders of the others.
1, then 1, then 1.
So 7 is 111 in binary.
Or 7^10 = 111^2
It's challenge time again.
Can you convert 243 to binary?
Here is the solution.
243/2 is 121, remainder 1, bit place 0.
121/2 is 60, remainder 1, bit place 1.
60/2 is 30, remainder 0, bit place 2.
30/2 is 15, remainder 0, bit place 3.
15/2 is 7, remainder 1, bit place 4.
7/2 is 3, remainder 1, bit place 5.
3/2 is 1, remainder 1, bit place 6.
1/2 is 0, remainder 1, bit place 7.
Let's start with the biggest bit place and go down, taking the remainders and going down.
1, then 1, then 1, then 1, then 0, then 0, then 1, then 1.
243 is 11110011 in binary.
Or 243^10 = 11110011^2
Now you know how to convert numbers to and from binary!
Here are some binary squares you should know.
1 in binary is 1 in Base 10.
10 in binary is 2 in Base 10.
100 in binary is 4 in Base 10.
1000 in binary is 8 in Base 10.
10000 in binary is 16 in Base 10.
100000 in binary is 32 in Base 10.
1000000 in binary is 64 in Base 10.
10000000 in binary is 128 in Base 10.
100000000 in binary is 256 in Base 10.
1000000000 in binary is 512 in Base 10.
And thus ends my tutorial!
If you enjoyed this, please consider checking out my social network, Inkwyl.
https://inkwyl.vercel.app/
Top comments (0)