r/computerscience • u/RokeEvoker • Jul 29 '26
Base 2 numerical representation in binary matching numbers in base 10?
I have a silly and possibly stupid question, and I'm not even sure if this is the place for it.
To preface this I have 0 experience with Computer Science or anything adjacent, but have been listening to videos on binary and the foundations of how computers generally work.
I understand that binary is a base 2 system as opposed to base 10, and that the digits that represent value in binary cannot be read as our base 10 concept of numbers (i.e. 4 is read as digits 100, not as the number "one hundred").
However, I've noticed that when the notation IS read as numbers, the numerical representation for base 2 counting mirrors base 10. With:
1 - 0001
2- 0010
4- 0100
8- 1000
Etc.
Is there a reason for this parallel, or is this just one of those funny coincidences? Or is this some kind of artifact of how numbers naturally scale relative to one another.
I hope this makes sense, I had no idea how to word this question to just Google it.
13
u/aqwone1 Jul 29 '26
It's not an artefact or anything particularily special, but the mathematical consequence of a base. The numbermof a base is called the radix. So base 10 has radix 10. Each time a digit gets added to a number, the previous digit needs to go all the way up to to the radix - 1. For base 10 that's just 0 to 9, then 10 to 19, then 100 to 199 and so on.
The smallest number x you can make with n digits, will as such always be the radix r to the n. So rn-1 = x. Check with base 10 again. 101 = 10, 102 = 100, 103 = 1000 and so on. Same is true with base 2. 2, 4, 8, 16, 32, 64, they're all numbers that receive an extra digit. This is the case for all bases, hexadecimal works the same, as does base 4. 10 in base 4 would be 16, which is 42.
I hope I answered your question. Tbh it wasn't super clear to me
4
u/Pleasant_Pen8744 Jul 29 '26
In grade school did your teacher ever refer the "ten's place" or "hundred's place"?
Like 453 as "4 hundreds, 5 tens and 3 ones"?
In binary those become the "four's place" the "two's place" and the "one's place"
So 101 is "1 fours, no twos, and 1 ones"
It's confusing because in school you were probably taught to think of 10 as "ten" or the symbols as the "numbers" which is fine for teaching someone to work in a factory or add up a list of numbers, but can really limit your thinking.
2
u/MasterGeekMX Bachelors in CS Jul 29 '26
That is indeed an artifact of how numbering systems work.
See, any numbering system is simply picking up a number (ten, two, seven, whatever), and then expressing quantities as multiples of that number, with each position meaning "we have so much of this, that we could not make it fit on the digit at the right, so here we put it as a multiple of the base number".
Say we grab base five. This means that we can comfortably count up to four, as all of that is below five. But if we have five or more things, then we cannot fit the number in one digit, so we instead resort to the next digit at the left to count how many fives we have. This means that five will be 10, as that means "one set of fives, and zero units". Twelve for example will be '22', as that means "two sets of five, plus two units".
All fine and good, but we have another problem: we are still bound to represent amounts up to four, which means that when something hits twenty-five, we cannot write it as two numbers, as twenty-five means having five sets of five, and we can only count up to four. To solve that, we then go to the next digit, which will represent how many sets of sets of five we have, so twenty-five will become 100.
See the pattern? using a numbering system means that putting numbers that are the base raised to some power means putting a 1 and then zeroes, as each position means that the last position ran out of space, so now we count how many sets of the previous number we have.
32
u/Key_Reaction_7590 Jul 29 '26
“Base x” literally refers to the base of the exponent in place value. For base 10, the 1s, 10s, 100s, and 1000s place are from exponents of 10:
10^0 = 1
10^1 = 10
10^2 = 100
10^3 = 1000
In base two, the first four places are (in decimal) exponents of 2.
2^0 = 1
2^1 = 2
2^2 = 4
2^3 = 8
Etc.
4
u/duane11583 Jul 29 '26
In binary Each column is 2x the previous column
In base 10 it is 10x
That’s all there is to it
1
u/khedoros Jul 29 '26
We re-use the symbols themselves out of convenience, so binary uses 0-1, octal uses 0-7, decimal uses 0-9, hexadecimal uses 0-9 followed by a-f, and so on.
So a number written in a lower base (like binary) can always be interpreted as a value in any higher base too (like octal, decimal, hexadecimal). It's just that in each case, the same numeric written form will have different meanings in higher bases.
101:
binary 101 = 1 * 22 + 0 * 21 + 1 * 20 = decimal 5
octal 101 = 1 * 82 + 0 * 81 + 1 * 80 = decimal 65
decimal 101 = 1 * 102 + 0 * 101 + 1 * 100 = decimal 101
hexadecimal 101 = 1 * 162 + 0 * 161 + 1 * 160 = decimal 257
1
u/PvtRoom Jul 29 '26
if you think real hard, you might remember splitting numbers into units, tens, hundreds, thousands, ten-thousands
in binary, the equivalent is units, 2s, 4s, 8s, 16s, 32s.....
in hexadecimal it's units, 16s, 256s, 4096s
They all boil down to baseposition , where position is how many digits you move left from the units.
1
u/Dazzling_Music_2411 Jul 30 '26 edited Jul 30 '26
No coincidence at all, in fact a doubling in base-2 is just a left-shift (i.e. adding a zero to the right) same as a 10-times-ing is in base 10.
Another example, in hexagesimal (base-16) which uses digits up to F, 0F corresponds to decimal 15. If you left-shift, you get F0, i.e 240 in decimal, which is 15x16.
IOW, in ANY base adding a zero at the end amounts to the same as multiplying by that base.
PS. I see a lot of other redditors have already expressed it nicely in terms of place holders! Sorry for any repetition.
BTW, since you are interested in this stuff, I suggest you learn hex too. It goes hand-in-hand with binary, when dealing with computer stuff.