Skip to content
Worked Examples · Example 12

Q.Show that f:N→Nf: \mathbb{N} \to \mathbb{N}, given by f(x)={x+1,if x is oddx−1,if x is evenf(x) = \begin{cases} x + 1, & \text{if } x \text{ is odd} \\ x - 1, & \text{if } x \text{ is even} \end{cases} is both one-one and onto.

Rajasthan RbseTextbookSubjective· 3mImportance★★★★★
38% · 40/104 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

The function swaps each odd number with the next even number and vice versa, pairing N\mathbb{N} into disjoint couples (1,2),(3,4),…(1,2), (3,4), \dots. This pairing is a bijection: it is injective because no two inputs map to the same output, and surjective because every natural number appears exactly once as an output.


Why a Bijection Proof Works

The key insight is that ff simply exchanges each odd number with the even number immediately after it.

  • If xx is odd, f(x)=x+1f(x) = x+1 (the next even number).
  • If xx is even, f(x)=x−1f(x) = x-1 (the previous odd number).

So the function pairs up numbers like (1,2)(1,2), (3,4)(3,4), (5,6)(5,6), … and within each pair, the two numbers swap places. This is a perfect matching — every natural number belongs to exactly one such pair, and the function just swaps the two members.

A function that is a bijection must be both one-one (injective) and onto (surjective). We’ll prove each separately.


Step-by-Step Proof

1. Proving ff is one-one (injective)

We need to show: if f(a)=f(b)f(a) = f(b), then a=ba = b.

Consider two natural numbers aa and bb. Each is either odd or even. There are four cases to check.

Case 1: Both aa and bb are odd.

Then f(a)=a+1f(a) = a+1 and f(b)=b+1f(b) = b+1.

If a+1=b+1a+1 = b+1, then a=ba = b.

Case 2: Both aa and bb are even.

Then f(a)=a−1f(a) = a-1 and f(b)=b−1f(b) = b-1.

If a−1=b−1a-1 = b-1, then a=ba = b.

Case 3: aa is odd, bb is even.

Then f(a)=a+1f(a) = a+1 (which is even) and f(b)=b−1f(b) = b-1 (which is odd).

An even number can never equal an odd number, so f(a)≠f(b)f(a) \neq f(b). This case cannot happen if f(a)=f(b)f(a) = f(b).

Case 4: aa is even, bb is odd.

Symmetric to Case 3 — f(a)f(a) is odd, f(b)f(b) is even, so they cannot be equal.

Thus the only way f(a)=f(b)f(a) = f(b) is when both inputs have the same parity, and then equality forces a=ba = b. Hence ff is injective.

Watch out

A common mistake is to forget that an odd output and an even output can never be equal. Always check parity when dealing with piecewise functions like this.


2. Proving ff is onto (surjective)

We need to show: for every y∈Ny \in \mathbb{N}, there exists some x∈Nx \in \mathbb{N} such that f(x)=yf(x) = y.

Take any natural number yy. We consider two cases based on whether yy is odd or even.

Case 1: yy is odd.

Since yy is odd, y+1y+1 is even. Let x=y+1x = y+1. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.