NDA Maths · Functions

What a Function Is, and How to Classify It

A function assigns each input exactly one output; classifying it as one-one, onto, or bijective is about how inputs and outputs are paired.

Why this matters

Eight PYQs, all EASY–MODERATE — the vocabulary the rest of the chapter is built on. The bank tests three things: whether a given rule even is a function (the vertical-line / well-defined test), whether it is one-one and/or onto, and how to count functions of a given type. Get the definitions exact and these are free marks; blur 'onto' and 'into' and you lose them.

Concept 1 of 4

Domain, codomain, range — the vocabulary

Intuition

Every function comes with three sets. The domain is what you are allowed to put in, the codomain is the declared set of possible outputs, and the range is the part of the codomain you actually hit. Range is always a subset of the codomain — the gap between them is exactly what 'onto' is about.

Definition

For f:ABf:A\to B:

  • Domain =A=A: the set of all valid inputs.
  • Codomain =B=B: the declared target set.
  • Range =f(A)={f(x):xA}=f(A)=\{f(x):x\in A\}: the set of values actually taken. Always f(A)Bf(A)\subseteq B.
  • Image of xx is f(x)f(x); pre-image of yy is any xx with f(x)=yf(x)=y.

Worked example

For f:RRf:\mathbb{R}\to\mathbb{R}, f(x)=x2f(x)=x^2, state the domain, codomain and range.
  1. Domain is the declared input set R\mathbb{R} — every real has a square.
  2. Codomain is the declared target R\mathbb{R}.
  3. Range is what is actually produced: squares are 0\ge 0, so range =[0,)=[0,\infty).
  4. Range [0,)R[0,\infty)\subsetneq\mathbb{R} — the negatives are never hit, so this is not onto.
Answer:Domain R\mathbb{R}, codomain R\mathbb{R}, range [0,)[0,\infty).
Practice this concept4 quick reps

Practice — Level 1 (4 reps)

Quick reps to lock in the method. Try each, then check.

  1. 1.
    Range vs codomain — which can be smaller?
  2. 2.
    Domain of f(x)=x3f(x)=x^3 on R\mathbb{R}?
  3. 3.
    Image of 33 under f(x)=2x1f(x)=2x-1?
  4. 4.
    A pre-image of 44 under f(x)=x2f(x)=x^2?

Concept 2 of 4

Is it a function? Well-defined and the vertical-line test

Intuition

A rule is a function only if every input gives exactly one output — no input left out, none sent to two places. On a graph this is the vertical-line test: any vertical line meets the graph at most once.

Definition

f:ABf:A\to B is a function iff for every xAx\in A there is one and only one yBy\in B with f(x)=yf(x)=y. Failures: a value with no output (gap in domain) or a value with two outputs (relation, not a function). A piecewise rule must agree at the join to stay well-defined.

Worked example

Does y2=xy^2=x define yy as a function of xx for x>0x>0?
  1. Solve for yy: y=±xy=\pm\sqrt{x}.
  2. For x=4x=4 this gives y=2y=2 and y=2y=-2 — two outputs for one input.
  3. The vertical line x=4x=4 meets the curve twice.
Answer:No — one input has two outputs, so it is not a function.

From the bank · past-year question

Example 2FunctionsMODERATE
Let A={xR:1x1}A = \{x \in \mathbb{R} : -1 \leq x \leq 1\}, B={yR:1y1}B = \{y \in \mathbb{R} : -1 \leq y \leq 1\} and S be the subset of A×BA \times B, defined by S={(x,y)A×B:x2+y2=1}S = \{(x,y) \in A \times B : x^2 + y^2 = 1\}. Which one of the following is correct?

[Q25 · Sep · 2018]

Piecewise rules must agree at the boundary

A two-piece rule like f(x)=x2f(x)=x^2 on [0,4][0,4] and 3x3x on [4,8][4,8] is only a function if the pieces give the same value at the shared point x=4x=4 (here 161216\neq12, so it is not well-defined). Always check the join before declaring it a function.

Concept 3 of 4

One-one, onto, and bijective

Intuition

One-one (injective): different inputs give different outputs — no two arrows land together. Onto (surjective): every element of the codomain is hit — range equals codomain. Bijective: both at once, so inputs and outputs pair up perfectly (and the function is invertible).

Definition

  • Injective: f(x1)=f(x2)x1=x2f(x_1)=f(x_2)\Rightarrow x_1=x_2 (equivalently, every horizontal line meets the graph at most once).
  • Surjective: range == codomain, i.e. every yBy\in B has a pre-image.
  • Bijective: injective and surjective. Only bijections have an inverse.

Onto depends on the codomain you declare — shrinking the codomain to the range makes any function onto.

One-one (injective): distinct inputs → distinct outputstarget 4 unused — one-one but not ontoOnto (surjective): every output is hittwo inputs share output 3 — onto but not one-oneBijective: perfect pairing (one-one AND onto)invertible

Worked example

Classify f:RRf:\mathbb{R}\to\mathbb{R}, f(x)=x2f(x)=x^2, as one-one / onto.
  1. One-one? f(2)=f(2)=4f(2)=f(-2)=4 — two inputs, one output, so not one-one.
  2. Onto? Range is [0,)[0,\infty), which is not all of R\mathbb{R} — negatives are missed, so not onto.
  3. If instead f:[0,)[0,)f:[0,\infty)\to[0,\infty), it becomes both one-one and onto — a bijection. Domain/codomain matter.
Answer:On RR\mathbb{R}\to\mathbb{R}: neither one-one nor onto.
Practice this conceptself-check

Try it yourself

Is f:RRf:\mathbb{R}\to\mathbb{R}, f(x)=2x+3f(x)=2x+3, a bijection?

From the bank · past-year question

Example 3FunctionsMODERATE
Consider the following statements: 1. A function f:ZZf:\mathbb{Z}\to\mathbb{Z}, defined by f(x)=x+1f(x)=x+1, is one-one as well as onto. 2. A function f:NNf:\mathbb{N}\to\mathbb{N}, defined by f(x)=x+1f(x)=x+1, is one-one but not onto. Which of the above statements is/are correct?

[Q38 · Apr · 2021]

'Onto' is not absolute — it depends on the codomain

f:NNf:\mathbb{N}\to\mathbb{N}, f(x)=x+1f(x)=x+1 is one-one but not onto (nothing maps to 1). The same rule on ZZ\mathbb{Z}\to\mathbb{Z} is onto. Read the declared domain and codomain before deciding.

Concept 4 of 4

Counting functions of a given type

Intuition

Counting how many functions exist from a finite set to another is just the multiplication principle: each input independently picks an output. Restricting to one-one or onto narrows the count.

Definition

Let A=m|A|=m, B=n|B|=n.

  • All functions ABA\to B: nmn^m (each of mm inputs has nn choices).
  • One-one (needs nmn\ge m): n(n1)(nm+1)=nPmn(n-1)\cdots(n-m+1)={}^{n}P_{m}.
  • Onto (general): inclusion–exclusion; for n=2n=2 it is 2m22^m-2.

Number of functions A → B

A=m, B=n  functions=nm,injections=nPm|A|=m,\ |B|=n\ \Rightarrow\ \text{functions}=n^{m},\quad \text{injections}={}^{n}P_{m}

Worked example

With A=3|A|=3, B=4|B|=4: how many functions, and how many are one-one?
  1. All functions: nm=43=64n^m=4^3=64.
  2. One-one: 4P3=432=24{}^{4}P_{3}=4\cdot3\cdot2=24.
Answer:64 functions in all, of which 24 are one-one.
Practice this concept4 quick reps

Practice — Level 1 (4 reps)

Quick reps to lock in the method. Try each, then check.

  1. 1.
    Functions from a 2-element to a 5-element set?
  2. 2.
    One-one functions from a 2-set to a 4-set?
  3. 3.
    Onto functions from a 4-set to a 2-set?
  4. 4.
    Can there be a one-one function from a 5-set to a 3-set?

From the bank · past-year question

Example 4FunctionsEASY
Let A={1,2,3,4,5}A=\{1,2,3,4,5\} and B={6,7}B=\{6,7\}. What is the number of onto functions from AA to BB?

[Q35 · Apr · 2024]

Summary — formulas & gotchas at a glance

A revision cheat-sheet for the formulas and gotchas above. Click any concept name to jump back to its full explanation.

Formulas (1)

  • Counting functions of a given type

    Number of functions A → B

    A=m, B=n  functions=nm,injections=nPm|A|=m,\ |B|=n\ \Rightarrow\ \text{functions}=n^{m},\quad \text{injections}={}^{n}P_{m}

Watch out for (2)

Mastery check — 5 interleaved questions

Try each one before clicking. Questions are interleaved across the concepts above, not grouped — interleaving sharpens transfer.

Example 1FunctionsMODERATE
Consider the statements: (1) f(x)=x3, 0x2f(x)=x^3,\ 0\le x\le2 and 4x, 2x84x,\ 2\le x\le8 is a function. (2) g(x)=x2, 0x4g(x)=x^2,\ 0\le x\le4 and 3x, 4x83x,\ 4\le x\le8 is a function. Which is/are correct?

[Q23 · Sep · 2023]

Example 2FunctionsMODERATE
Consider the following statements: 1. If f is the subset of Z × Z defined by f = {(xy, x−y); x, y ∈ Z}, then f is a function from Z to Z. 2. If f is the subset of N × N defined by f = {(xy, x+y); x, y ∈ N}, then f is a function from N to N.
Which of the statements given above is/are correct?

[Q4 · Sep · 2022]

Example 3FunctionsEASY
Let f={(1,1),(2,4),(3,7),(4,10)}f = \{(1,1),(2,4),(3,7),(4,10)\}.
If f(x)=px+qf(x) = px + q, then what is the value of (p+q)(p + q)?

[Q87 · Apr · 2025]

Example 4FunctionsMODERATE
Let A={xR:1<x<1}A=\{x\in\mathbb{R}:-1<x<1\}. Which of the following is/are bijective functions from AA to itself? (A) f(x)=xxf(x)=x|x| (B) g(x)=cos(πx)g(x)=\cos(\pi x) Select the correct answer using the code given below:

[Q22 · Apr · 2024]

Example 5FunctionsEASY
Let f={(1,1),(2,4),(3,7),(4,10)}f = \{(1,1),(2,4),(3,7),(4,10)\}.
Consider the following statements: (I). ff is one-one function. (II). ff is onto function if the codomain is the set of natural numbers. Which of the statements given above is/are correct?

[Q88 · Apr · 2025]

Drill every past-year question on this subtopic

8 questions from the bank — paginated, with cart and Word-export support.