Class 12 Maths, Worked in Full Past papersGet updates
Chapter 1 · Relations and Functions

Exercise 1.2 · Q9: Is the halving-and-rounding-up function bijective?

Exercise 1.2One-one and onto functions · Section 1.3
The question

Let f:N→Nf : \N \to \N be defined by f(n)={n+12,if n is oddn2,if n is evenfor all n∈N.f(n) = \begin{cases} \dfrac{n+1}{2}, & \text{if } n \text{ is odd} \\[2mm] \dfrac{n}{2}, & \text{if } n \text{ is even} \end{cases} \qquad \text{for all } n \in \N. State whether the function ff is bijective. Justify your answer.

Exam answer

f(1)=1+12=1f(1) = \frac{1 + 1}{2} = 1 and f(2)=22=1f(2) = \frac22 = 1⁠, but 1≠21 \ne 2⁠. So ff is not one-one.

Let m∈Nm \in \N⁠. Then 2m∈N2m \in \N is even, and f(2m)=2m2=mf(2m) = \frac{2m}{2} = m⁠. So ff is onto.

ff is onto but not one-one. Hence ff is not bijective.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

Work out a few values and the pattern is plain: f(1)=1f(1)=1⁠, f(2)=1f(2)=1⁠, f(3)=2f(3)=2⁠, f(4)=2f(4)=2⁠, and so on. The function pairs up neighbours, 2k−12k-1 and 2k2k⁠, and sends both to kk⁠. Every output is reached, so ff is onto. But every output is reached twice, so ff is not one-one. A bijection must be both, so ff is not bijective.

Given, to find, and the plan
Given
A rule ff with two cases, one for odd nn and one for even nn⁠, from N={1,2,3,… }\N = \{1,2,3,\dots\} to N\N⁠.
To find
Whether ff is bijective, that is, both one-one (injective) and onto (surjective), with a justification.
Plan
(1) Confirm ff really is a function from N\N to N\N⁠. (2) Tabulate values to see the pattern. (3) Test one-one. If it fails, a single counterexample settles it. (4) Test onto by solving f(n)=mf(n)=m for an arbitrary mm⁠. (5) Conclude.

Basics you need

1A function given "piece by piece"

A piecewise rule uses a different formula on different parts of the domain. To evaluate f(n)f(n)⁠, first decide which piece nn falls in (here: is nn odd or even?), then use only that piece. Basics: what a function is

2One-one (injective)

ff is one-one if different inputs always give different outputs: f(x1)=f(x2)⇒x1=x2f(x_1)=f(x_2) \Rightarrow x_1 = x_2⁠. To show it fails, one pair x1≠x2x_1 \ne x_2 with f(x1)=f(x2)f(x_1)=f(x_2) is enough. Basics: one-one and onto

3Onto (surjective)

f:A→Bf : A\to B is onto if every yy in the codomain BB is the image of something: for each y∈By\in B there is an x∈Ax\in A with f(x)=yf(x)=y⁠. To prove it, take an arbitrary yy and construct such an xx⁠.

4Odd and even natural numbers

Every even natural number is 2k2k⁠, and every odd natural number is 2k−12k-1⁠, for some k∈Nk\in\N⁠. (So 1=2⋅1−11 = 2\cdot1-1⁠, 3=2⋅2−13 = 2\cdot2-1⁠, and so on.) Basics: even and odd

5Bijective

Bijective means one-one and onto. If either property fails, the function is not bijective. Basics: one counterexample disproves a "for all"

Solution

  1. Check that ff really maps N\N into N\N

    The formulas contain divisions by 2, so first make sure the outputs are natural numbers, not fractions.

    • If nn is odd, then n+1n+1 is even, so n+12\frac{n+1}{2} is a whole number. It is at least 1+12=1\frac{1+1}{2} = 1⁠, so it is in N\N⁠.
    • If nn is even, then n2\frac{n}{2} is a whole number, at least 22=1\frac{2}{2} = 1⁠, so it is in N\N⁠.

    Every natural number is either odd or even, never both, so exactly one formula applies to each nn⁠. Hence ff assigns exactly one natural number to every natural number: it is a genuine function N→N\N\to\N⁠.

    The question says f:N→Nf : \N \to \N⁠, but with a piecewise formula it is worth confirming. If some output were 32\tfrac{3}{2}⁠, the codomain N\N would be wrong and the question would not make sense. The check also tells us that the two pieces never overlap or leave gaps.
    Odd + 1 = even: if n=2k−1n = 2k-1⁠, then n+1=2kn+1 = 2k⁠. That is why n+12=k\frac{n+1}{2} = k comes out whole.
  2. Tabulate values and spot the pattern

    nn12345678910
    parityoddevenoddevenoddevenoddevenoddeven
    formula1+12\frac{1+1}{2}22\frac223+12\frac{3+1}{2}42\frac425+12\frac{5+1}{2}62\frac627+12\frac{7+1}{2}82\frac829+12\frac{9+1}{2}102\frac{10}{2}
    f(n)f(n)1122334455

    Each output appears exactly twice. In general, write the odd number as 2k−12k-1 and the even number just after it as 2k2k⁠:

    f(2k−1)=(2k−1)+12=2k2=k,f(2k)=2k2=k.\begin{aligned} f(2k-1) &= \frac{(2k-1)+1}{2} = \frac{2k}{2} = k,\\[1mm] f(2k) &= \frac{2k}{2} = k. \end{aligned}
    inputs n outputs f(n) 12345678 1234 …… two arrows land here
    Each pair of neighbours 2k−1,2k2k-1, 2k lands on the same output kk⁠. Every output receives an arrow (onto), but every output receives two (not one-one).
    Before trying to prove anything about a strange-looking function, compute a few values. The table shows what to expect: two-to-one behaviour, so one-one should fail and onto should hold. The general formula f(2k−1)=f(2k)=kf(2k-1)=f(2k)=k confirms the pattern holds for every kk⁠, not just the ten we listed.
    Writing odd numbers as 2k−12k-1 and even numbers as 2k2k (Basic 4) turns "odd" and "even" into algebra we can substitute into the formulas.
  3. One-one? No: one counterexample settles it

    From the table,

    f(1)=1+12=1andf(2)=22=1.f(1) = \frac{1+1}{2} = 1 \qquad\text{and}\qquad f(2) = \frac{2}{2} = 1.

    So f(1)=f(2)f(1) = f(2) although 1≠21 \ne 2⁠. Two different inputs share an output, so ff is not one-one.

    "One-one" is a claim about every pair of inputs: whenever the outputs agree, the inputs must agree. A claim about every pair is destroyed by a single pair that breaks it. So we do not need the general argument here; the specific pair 1, 2 is a complete and rigorous disproof.
    To disprove "for all", give one counterexample. To prove "for all", you need a general argument. Basics: proving and disproving
  4. Onto? Yes: build an input for any output

    Take an arbitrary m∈Nm \in \N⁠. We need some n∈Nn\in\N with f(n)=mf(n) = m⁠. From Step 2 we know where to look: mm is the output of the even number 2m2m⁠. Choose n=2mn = 2m⁠. This is a natural number, and it is even, so the second formula applies:

    f(2m)=2m2=m.f(2m) = \frac{2m}{2} = m.

    So every m∈Nm\in\N is an image under ff⁠, and ff is onto. (The odd number 2m−12m-1 works too, since f(2m−1)=2m2=mf(2m-1) = \frac{2m}{2} = m⁠. That second preimage is exactly why ff is not one-one.)

    "Onto" says every element of the codomain is hit. That is a "for every mm" claim, so a few examples will not do. We take a general mm and produce an input that works. Guessing the input is legitimate, provided we then check it: we confirm that 2m2m is in the domain N\N and that f(2m)f(2m) really equals mm⁠.
    To prove onto: for an arbitrary yy in the codomain, find xx in the domain with f(x)=yf(x)=y⁠. Always check that the xx you find actually lies in the domain. Basics: one-one and onto
  5. Conclude

    A bijection must be both one-one and onto. ff is onto (Step 4) but not one-one (Step 3), so ff is not bijective.

    Note how this compares with finite sets. In Examples 13 and 14 the textbook shows that for a function from a finite set to itself, one-one and onto always come together. This exercise is a reminder that on an infinite set like N\N they can split apart: here we have onto without one-one. (Example 10 is another such case.)
Result

No, ff is not bijective. It is onto, because every m∈Nm\in\N equals f(2m)f(2m)⁠. It is not one-one, because f(1)=f(2)=1f(1) = f(2) = 1⁠. In fact ff is exactly two-to-one: f(2k−1)=f(2k)=kf(2k-1) = f(2k) = k⁠. (Textbook answer: "No".)

Play this problem

Balloon Pop, in the chapter’s Games tab. Machine 2 is this function: find the double hit, and see that every balloon can be hit. Play Balloon Pop ↗

Check it with numbers

Pick an output, say m=37m = 37⁠. Step 4 says n=74n = 74 should give it: 7474 is even, so f(74)=74/2=37f(74) = 74/2 = 37⁠. ✓ The other preimage is 7373⁠: it is odd, so f(73)=(73+1)/2=37f(73) = (73+1)/2 = 37⁠. ✓ Two inputs, one output, exactly as the analysis predicts.

Common mistakes
  1. Using the wrong piece. f(3)f(3) uses n+12\frac{n+1}{2} because 3 is odd; it is 22⁠, not 1.51.5⁠.
  2. "Each piece is one-one, so ff is one-one." Each formula on its own never repeats a value, but the two pieces can collide with each other, and here they always do.
  3. Stopping at "not one-one" without saying why onto holds. The question asks you to justify; a complete answer reports both properties.
  4. Forgetting to check the preimage is in the domain. If the codomain included 0, there would be no natural nn with f(n)=0f(n)=0⁠, and onto would fail.
What to take away
  1. With a piecewise function, test one-one across the pieces, not just within each piece.
  2. One-one fails with one counterexample. Onto is proved by constructing a preimage for an arbitrary output, then checking it.
  3. On infinite sets, onto and one-one are independent. Finite sets mapped to themselves are the special case where they coincide.

Every fact used, and where it comes from

FactUsed inSource
Odd numbers are 2k−12k-1⁠, even numbers are 2k2k⁠, k∈Nk\in\NSteps 1, 2Definition of odd and even
f(2k−1)=f(2k)=kf(2k-1) = f(2k) = kSteps 2–4Direct substitution into the two formulas
Definitions of one-one, onto, bijectiveSteps 3–5Definitions 5–7, Section 1.3 (Lesson: types of functions)
One counterexample disproves a "for all" statementStep 3Logic of quantifiers
Finite sets: one-one ⇔ ontoStep 5 remarkExamples 13 and 14
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →