Determining whether floor((n+1)/2) is 1-to-1 or onto

  • Thread starter Thread starter leo255
  • Start date Start date
Join the discussion
Registration is free. Start your own thread to ask a follow-up.
2 replies · 2K views
leo255
Messages
57
Reaction score
2

Homework Statement


[/B]
floor((n+1)/2)

Find whether this function is 1-to-1 and/or onto from Z to Z.

Homework Equations

The Attempt at a Solution



This is not one-to-one because f(1) = f(2) = 1.

Regarding onto, we need to show that f(a) = b

floor((n+1)/2) = b
2b = n + 1
n = 2b - 1

f(2b-1) = floor((2b-1) + 1)/2) =

floor(2b/2) = floor(b) = b.

I'm not sure how to take the floor function into account for my onto calculations.


 
Physics news on Phys.org
Let f be the function defined by f(n)=floor((n+1)/2) (n∈ℤ).

I may be confused, but haven't you actually proved that for b∈ℤ, f(2b-1)=b?
That proves that f in onto.
 
leo255 said:

Homework Statement


[/B]
floor((n+1)/2)

Find whether this function is 1-to-1 and/or onto from Z to Z.

Homework Equations

The Attempt at a Solution



This is not one-to-one because f(1) = f(2) = 1.

Regarding onto, we need to show that f(a) = b
In more detail, you need to show that for each ##b \in Z##, there exists an ##a \in Z## such that f(a) = b.
leo255 said:
floor((n+1)/2) = b
2b = n + 1
n = 2b - 1

f(2b-1) = floor((2b-1) + 1)/2) =

floor(2b/2) = floor(b) = b.

I'm not sure how to take the floor function into account for my onto calculations.