# Quick math question in Binary

• 03-12-2012
cplusplusnoob
Quick math question in Binary
Hey, guys! Thank you for every one who commented on my previous thread about todays use with Binary.

Getting more indepth, I came across this one math problem that has become very irritating, because it just doesn't make sense to me...

It's pretty simple. My problem is found while converting a binary number into its decimal form.

Here it is:

The Binary number were converting is "11101.01".

The formula which represents the relationship between a digit,base, and position is:

DIGIT*BASE_position#

We know Binary is a base-2 number system. So, we put the base number "2 above all the numbers. Than we go to the step were my problem resides... We now add their subscripts. Starting with "-2" at the far right, with -1, 0, 1, 2, 3, 4 continuing towards the far left. Now we multiply the base and subscript, and once we find the andswer, we then multiply it with the binary nuber below. After I do all the steps, I get everything correct EXCEPT the base number 2 with the subscript 0. Maybe I just don't fully understand the existence for the subscript, but isn't base 2 multiplied by subscript 0, equal 0? And when you multiply it by 1, it still equals 0?
But all the tutorials I have read and covered say base 2 with the subcript 0 equal, 1???

Can any one explain to me how this can defy the laws of math as I know, haha.
But in all seriousness, I just need to understand the formula used to get 2 times 0 , times the binary number 1, equaling 1?
• 03-12-2012
oogabooga
It isn't 2 times 0, it's 2 to the power of 0, and any non-zero number to the power of 0 is 1. (0 to the power of 0 is undefined.)

Let ** mean "to the power of" and consider

2**2 * 2**3 = 2**5

Notice that to multiply the two numbers 2**2 and 2**3 you simply have to add their exponents.

But if you can multiply just by adding exponents, then

2**2 * 2**0 = 2**2

And to make that true, 2**0 must be equal to 1.
• 03-12-2012
Cynic
Bit 0 is the first bit, going right to left, in a non-decimal. You can think of it as the exponent.

1001 = 1 * 2^3 + 0 * 2^2 + 0 * 2^1 + 1 * 2^0 = 8 + 0 + 0 + 1 (any base to the power of 0 is always 1) = 9.
• 03-12-2012
nonoob
Code:

```  4      3      2      1      0    -1    -2        exponent  2      2      2      2      2      2      2          base 16    8      4      2      1    0.5    0.25      value```
• 03-12-2012
oogabooga
Quote:

Originally Posted by cplusplusnoob
I get everything correct EXCEPT the base number 2 with the subscript 0.
...
I just need to understand the formula used to get 2 times 0 , times the binary number 1, equaling 1?

His (somewhat long-winded) question is "Why does 2 to the power of 0 equal 1?" which I answered in post#2. I believe he understands the other aspects of binary powers.
• 03-13-2012
cplusplusnoob
Thank you to everyone whom commented! I really do appreciate the help!

But, none of the comments really answered my question to WHY the rule, that any number to the power of 0 is 1, exists. oogabooga (I couldn't help chuckle why spelling your name haha), your first comment helped explain the properties of the base and subscript, but it didn't really reveal the logic and mathmatics BEHIND the rule, justifying its purpose. It still appeared to me just being an "announced" mathematics without proof; because we could encounter a problem such as (-3)**0, and just using the facts from what you guys gave me I wouldn't be able to explain how -3 could be 1, except just saying its a rule.

But now I was able to learn a more in depth explanation for my problem, and now I understand!

I apologize if my thread was in the wrong place, or if it still is. I know you guys prefer questions over programming or math that relates to an actual programming issue. Not something I should of learned from 6th grade math haha.
• 03-13-2012
oogabooga
I explained exactly why (-3)**0 is equal to 1.

(-3)**2 TIMES (-3)**3 EQUALS (-3)**5, simply by adding the exponents. That part is obvious if you think about it. (-3)**2 is (-3)(-3), (-3)**3 is (-3)(-3)(-3), multiplying them gives (-3)(-3)(-3)(-3)(-3) or (-3)**5.

Therefore, since adding exponents multiplies numbers with the same base,
(-3)**2 TIMES (-3)**0 EQUALS (-3)**2, by adding the exponents.

For that to be true, (-3)**0 must be equal to 1.

It's that simple.

There is no deeper explanation.

Quote:

But now I was able to learn a more in depth explanation for my problem, and now I understand!
What do you mean by this?
• 03-13-2012
laserlight
Moved to General Discussions.
• 03-13-2012
brewbuck
If:

2^2 = 2*2
2^1 = 2
2^0 = ???

Well, we obviously can't have '???' because that's not helpful, so we have to PICK something that 2^0 is equal to. Note that everything remains consistent if we multiply the RHS of this progression by 1:

2^2 = 2*2*1
2^1 = 2*1
2^0 = 1

Another way to think about it is that you are taking the value and repeatedly multiplying it into a running product. This product naturally has to be started at 1. If it started at 0, then it would never be anything BUT 0. And if it started at something other than 1, its particular value would influence the result for no reason.

Yet another way of seeing why is:

a = b^c = b^(x+y) = b^x*b^y.

Now let x=c, y=0 (this is consistent with b^c = b^(x+y)):

b^c=b^c*b^0

Divide both sides by b^c:

1=b^0
• 03-14-2012
cplusplusnoob
Quote:

Originally Posted by oogabooga

It's that simple.

There is no deeper explanation.

What do you mean by this?

Check this out: Proof that a number to the zero power is one - math lesson from Homeschool Math

I'm sorry if I miss wrote my intentinal meaning in my previous comment. I didn't mean to state your comment had no help towards my question. You gave the exact answer to my question. But as you can see, I am like a caveman when it comes to math...My ability to understand math concepts through purely text writing is difficult. Poor understanding in basic math is not the best quality in the field programming, hehe.

I was confused, because I was thinking what if we had two DIFFERENT base's, such as: 5**2 * 1**0. Simply adding their exponents couldn't result into the right answer. But now I understand the concept from the help of you, my fellow programmers who also commented, and the video I stated above.
• 03-14-2012
cplusplusnoob
Thank you also for you help! Your second method, was a similiar example I found in a video explaining the logic behind this rule.