1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Question: Is Hamming function one to one?

  1. Apr 9, 2013 #1
    1. The problem statement, all variables and given/known data

    I have a Hamming function which takes two inputs, domain & co-domain and the output is how many bits are different.

    Example: f(11100, 11101) = 1 (only one bit is different).

    Is this one to one?

    I say no because there could be many other combinations if inputs that can produce the same answer as the output. For example f(11110, 11100) = 1 also.

    I just want to know if my thinking is correct or totally off base.

    Thanks for any feedback!
    Last edited: Apr 9, 2013
  2. jcsd
  3. Apr 9, 2013 #2


    Staff: Mentor

    I think you're right. If you were to plot the function using all binary numbers from 00000 to 11111 there are 32 choices but only 5 bits so the reverse mapping would have several y values for any given x value on the 0 to 5 domain.
  4. Apr 9, 2013 #3
    I didn't even think to check it out that way. So with 32 inputs (domain) and 5 outputs (range), there's no way it can be one to one unless I'm missing something.

    Now if it we're an encoding function where it would have to encode/decode back and forth, that would be one to one I think.

    Thanks for the input.

  5. Apr 9, 2013 #4

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    Your example shows that f is not 1:1; end of story.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted