This is making think the function is contradicting

  • Thread starter Thread starter look416
  • Start date Start date
  • Tags Tags
    Function
look416
Messages
87
Reaction score
0
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
 
Mathematics news on Phys.org


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


Hey look416.

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


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
 


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
 


chiro said:
Hey look416.

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

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


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

That should work as well :)
 


chiro said:
Hey look416.

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

look416 said:
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

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

chiro said:
That should work as well :)

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
 


jing2178 said:
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

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


look416 said:
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

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


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


HallsofIvy said:
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.

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


HallsofIvy said:
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.

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


look416 said:
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?

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


look416 said:
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?
You said you wanted a function that mapped positive integers to all integers. That's what this does.
 
Back
Top