This is making think the function is contradicting

1. Apr 18, 2012

look416

This is making think the function is contradicting.
the question is asking me to find a function f : N → Z which is one-to-one and has range Z.
the problem is the number is integers in Z is bigger than the number of integers in N.

The only way i can think of is optional function, even that i also have no idea on solving it

2. Apr 18, 2012

micromass

Staff Emeritus
Re: Functions

Try a function which "jumps around". That is: one time a value will be a positive integer, the next time it will be negative.

3. Apr 18, 2012

chiro

Re: Functions

Hey look416.

Following micromasses suggestion, try thinking about f(N) = (-1)^N [N/2] where [N/2] returns the integer part of N/2.

4. Apr 18, 2012

look416

Re: Functions

Thx Chiro, i see how the sequence goes ady. So, we are ignoring the floating point division but instead focusing on the integer division... i see

5. Apr 18, 2012

look416

Re: Functions

Now,i got one more question, when n = 0, f[x] = 0, but when n = 1, f[x] = 0 too, this will make my function into a not one to one function ady

6. Apr 18, 2012

jing2178

Re: Functions

How about f(N) = (-1)^(N+1) [(N+1)/2]

7. Apr 18, 2012

chiro

Re: Functions

That should work as well :)

8. Apr 19, 2012

jing2178

Re: Functions

Sorry Chiro I do not understand the 'as well' comment.

f(N) = (-1)^N [N/2] fails the 1 to 1 condition as f(0)=0 and f(1)=0;

Whereas for f(N) = (-1)^(N+1) [(N+1)/2]

f(0) = 0 f(1) = 1 f(2) = -1 f(3) = 2 f(4) = -2 f(5) = 3 f(6) = -3

f(7) = 4 f(8) = -4 etc

9. Apr 19, 2012

chiro

Re: Functions

Before I answer I should ask whether the function is onto not onto.

10. Apr 19, 2012

jing2178

Re: Functions

look416 set the range as Z so for me that means onto

11. Apr 19, 2012

HallsofIvy

Staff Emeritus
Re: Functions

Rather than trying to give a specific formula, map odd positive numbers, of the form 2n+1, to -n and even positive numbers, of the form 2n, to n. That is both one to one and onto the set of integers.

12. Apr 19, 2012

jing2178

Re: Functions

I agree HallsofIvy. It is just that if a formula is tried and found not to work but is correctable then does it not behove us to correct it?

13. Apr 19, 2012

look416

Re: Functions

i need more clarification of this,
HallsofIvy, why we are mapping from 2n+1 to -n for odd numbers and 2n to n for even numbers?

14. Apr 20, 2012

Number Nine

Re: Functions

Because it works. Did you try it?
Try writing it out for a few values of N.

15. Apr 20, 2012

HallsofIvy

Staff Emeritus
Re: Functions

You said you wanted a function that mapped positive integers to all integers. That's what this does.