Quick math question in Binary

This is a discussion on Quick math question in Binary within the General Discussions forums, part of the Community Boards category; Hey, guys! Thank you for every one who commented on my previous thread about todays use with Binary. Getting more ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    67

    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?

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    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.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Sep 2007
    Posts
    131
    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.

  4. #4
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,831
    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

  5. #5
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    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.

  6. #6
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    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.

  7. #7
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    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.

    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?
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,451
    Moved to General Discussions.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,236
    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
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  10. #10
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    Quote Originally Posted by oogabooga View Post

    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.

  11. #11
    Registered User
    Join Date
    Nov 2011
    Posts
    67
    Thank you also for you help! Your second method, was a similiar example I found in a video explaining the logic behind this rule.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how quick using binary read file ?
    By zcrself in forum C Programming
    Replies: 5
    Last Post: 01-12-2010, 09:40 AM
  2. Very quick math question
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 10-26-2005, 11:05 PM
  3. quick math
    By firefly in forum C++ Programming
    Replies: 1
    Last Post: 07-06-2005, 08:46 PM
  4. quick physics/math question
    By confuted in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 05-01-2003, 09:21 AM
  5. Quick math question
    By PJYelton in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 04-03-2003, 09:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21