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

1. Apr 9, 2013

### Topgun_68

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. Apr 9, 2013

### 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.

3. Apr 9, 2013

### Topgun_68

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.

4. Apr 9, 2013

### Ray Vickson

Your example shows that f is not 1:1; end of story.