WishWasTraining Academy
NDA & Naval Academy entrance exam school
โ† home
Chapter M5-2 ยท 2 of 8 in Differential Calculus ยท 13 min read

Composite and inverse functions

35 real NDA questions of this kind in the 19 papers of 2017 to 2026.

Try three questions free โ†“
This chapter has a video lessonWatch it, practise with a drill and keep your record, all with a free account. No fee, no card.

Why this lesson matters. This chapter drew 17 questions in the seven papers from NDA II 2023 to NDA II 2026. The exam asks four kinds of question: is the function one-to-one or onto, how many functions or onto functions are there between two small sets, what is โ€‹f(g(x))โ€‹, and what is the inverse of โ€‹fโ€‹. Six real questions are solved in section 7.

What you will be able to do

  • Test whether a function is one-to-one, onto, or both (bijective).
  • Count the functions, the one-to-one functions and the onto functions between two small sets.
  • Find the composite functions โ€‹f \circ gโ€‹ and โ€‹g \circ fโ€‹, and find โ€‹gโ€‹ when โ€‹g \circ fโ€‹ is given.
  • Find the inverse of a bijective function in three steps.

Before you start you should know: what a function, its domain, its codomain and its range are (Chapter M5-1), and how to count choices by multiplying (Chapter M1-9).

1. One-to-one functions

A function is one-to-one (also written one-one, or injective) if different inputs always give different outputs. No output is used twice.

Test. Suppose โ€‹f(a) = f(b)โ€‹. If this forces โ€‹a = bโ€‹, the function is one-to-one.

  • โ€‹f(x) = 2x + 3โ€‹ is one-to-one: โ€‹2a + 3 = 2b + 3โ€‹ gives โ€‹a = bโ€‹.
  • โ€‹f(x) = x^2โ€‹ on โ€‹\mathbb{R}โ€‹ is not one-to-one: โ€‹f(2) = f(-2) = 4โ€‹.

On the graph: a function is one-to-one if every horizontal line cuts the graph at most once. A horizontal line at height 4 cuts the U-shaped graph of โ€‹x^2โ€‹ at two points, so โ€‹x^2โ€‹ fails.

A horizontal line cuts the parabola y = x squared at two points, and cuts the line y = 2x + 3 at one point

A function that is always increasing, or always decreasing, is one-to-one.

2. Onto functions, and bijective functions

A function โ€‹f : A \to Bโ€‹ is onto (surjective) if every element of the codomain โ€‹Bโ€‹ is the output of some input. In other words, the range is the whole of โ€‹Bโ€‹.

  • โ€‹f : \mathbb{R} \to \mathbb{R}โ€‹, โ€‹f(x) = 2x + 3โ€‹ is onto: any โ€‹yโ€‹ is reached by โ€‹x = \dfrac{y - 3}{2}โ€‹.
  • โ€‹f : \mathbb{R} \to \mathbb{R}โ€‹, โ€‹f(x) = x^2โ€‹ is not onto: โ€‹-1โ€‹ is never an output.

Whether a function is onto depends on the codomain. The same rule โ€‹f(x) = x^2โ€‹ from โ€‹\mathbb{R}โ€‹ to โ€‹[0, \infty)โ€‹ is onto.

A function that is both one-to-one and onto is called bijective. Only bijective functions have an inverse.

The four possible cases, drawn as arrow diagrams from โ€‹Aโ€‹ to โ€‹Bโ€‹:

Four arrow diagrams from A to B: one-to-one and onto; one-to-one but not onto; onto but not one-to-one; neither

3. Counting functions between two small sets

Let โ€‹Aโ€‹ have โ€‹mโ€‹ elements and โ€‹Bโ€‹ have โ€‹nโ€‹ elements. To make a function from โ€‹Aโ€‹ to โ€‹Bโ€‹, choose an image for each element of โ€‹Aโ€‹.

What is counted Number Example
All functions from โ€‹Aโ€‹ to โ€‹Bโ€‹ โ€‹n^mโ€‹ โ€‹Aโ€‹ has 2 elements, โ€‹Bโ€‹ has 3: โ€‹3^2 = 9โ€‹
One-to-one functions (possible only if โ€‹m \le nโ€‹) โ€‹n(n-1)(n-2)\dotsโ€‹ with โ€‹mโ€‹ factors โ€‹Aโ€‹ has 2, โ€‹Bโ€‹ has 3: โ€‹3 \times 2 = 6โ€‹
Onto functions when โ€‹Bโ€‹ has exactly 2 elements โ€‹2^m - 2โ€‹ โ€‹Aโ€‹ has 3, โ€‹Bโ€‹ has 2: โ€‹8 - 2 = 6โ€‹
Bijective functions (possible only if โ€‹m = nโ€‹) โ€‹n!โ€‹ Both have 3: โ€‹3! = 6โ€‹

Why โ€‹2^m - 2โ€‹? There are โ€‹2^mโ€‹ functions in all. Only two of them are not onto: the one that sends everything to the first element of โ€‹Bโ€‹, and the one that sends everything to the second.

4. Composite functions

To form a composite, put one function inside another.

(g \circ f)(x) = g(f(x)) \qquad (f \circ g)(x) = f(g(x))

In โ€‹g \circ fโ€‹, the function โ€‹fโ€‹ acts first and โ€‹gโ€‹ acts second. Read it from the right. The paper also writes โ€‹gof(x)โ€‹ for โ€‹g \circ f(x)โ€‹.

Two machines in a row: x goes into f, f(x) goes into g, and g(f(x)) comes out; with numbers, 2 becomes 3 and then 9

Take โ€‹f(x) = x + 1โ€‹ and โ€‹g(x) = x^2โ€‹. Then

  • โ€‹g \circ f(x) = g(x + 1) = (x + 1)^2โ€‹,
  • โ€‹f \circ g(x) = f(x^2) = x^2 + 1โ€‹.

These are different. In general โ€‹f \circ g \ne g \circ fโ€‹.

5. The inverse function

If โ€‹fโ€‹ is bijective, its inverse โ€‹f^{-1}โ€‹ undoes it: if โ€‹f(x) = yโ€‹ then โ€‹f^{-1}(y) = xโ€‹. So

f^{-1}(f(x)) = x \quad \text{and} \quad f(f^{-1}(x)) = x

Three steps to find the inverse.

  1. Write โ€‹y = f(x)โ€‹.
  2. Solve this equation for โ€‹xโ€‹ in terms of โ€‹yโ€‹.
  3. Swap the letters: write โ€‹xโ€‹ in place of โ€‹yโ€‹. The result is โ€‹f^{-1}(x)โ€‹.

For โ€‹f(x) = 2x + 3โ€‹: โ€‹y = 2x + 3โ€‹ gives โ€‹x = \dfrac{y - 3}{2}โ€‹, so โ€‹f^{-1}(x) = \dfrac{x - 3}{2}โ€‹. Check: โ€‹f^{-1}(f(1)) = f^{-1}(5) = 1โ€‹.

On the graph: the graph of โ€‹f^{-1}โ€‹ is the mirror image of the graph of โ€‹fโ€‹ in the line โ€‹y = xโ€‹.

The line y = 2x + 3 and its inverse y = (x - 3) over 2 are mirror images in the dashed line y = x; the point (1, 5) reflects to (5, 1)

A useful fact. A function of the form โ€‹f(x) = \dfrac{ax + b}{cx - a}โ€‹ is its own inverse: โ€‹f(f(x)) = xโ€‹. Look at the first and last coefficients: they are โ€‹aโ€‹ and โ€‹-aโ€‹.

6. Worked examples

Example 1. Let โ€‹f(x) = 3x - 2โ€‹ and โ€‹g(x) = x^2 + 1โ€‹. Find โ€‹f \circ g(2)โ€‹ and โ€‹g \circ f(2)โ€‹.

โ€‹f \circ g(2) = f(g(2)) = f(5) = 13โ€‹.

โ€‹g \circ f(2) = g(f(2)) = g(4) = 17โ€‹.

Example 2. โ€‹Aโ€‹ has 3 elements and โ€‹Bโ€‹ has 2 elements. How many functions are there from โ€‹Aโ€‹ to โ€‹Bโ€‹? How many are onto? How many are one-to-one?

All functions: โ€‹2^3 = 8โ€‹. Onto: โ€‹2^3 - 2 = 6โ€‹. One-to-one: none, because 3 inputs cannot have 3 different outputs when only 2 outputs exist.

Example 3. Let โ€‹f(x) = \dfrac{2x + 1}{x - 3}โ€‹ for โ€‹x \ne 3โ€‹. Show that โ€‹fโ€‹ is one-to-one and find โ€‹f^{-1}โ€‹.

One-to-one: suppose โ€‹\dfrac{2a + 1}{a - 3} = \dfrac{2b + 1}{b - 3}โ€‹. Cross-multiply: โ€‹2ab - 6a + b - 3 = 2ab - 6b + a - 3โ€‹, so โ€‹-7a = -7bโ€‹ and โ€‹a = bโ€‹.

Inverse: write โ€‹y = \dfrac{2x + 1}{x - 3}โ€‹. Then โ€‹y(x - 3) = 2x + 1โ€‹, so โ€‹xy - 2x = 3y + 1โ€‹ and โ€‹x = \dfrac{3y + 1}{y - 2}โ€‹. Swap the letters:

f^{-1}(x) = \frac{3x + 1}{x - 2}

Check with โ€‹x = 4โ€‹: โ€‹f(4) = 9โ€‹ and โ€‹f^{-1}(9) = \dfrac{28}{7} = 4โ€‹. Correct.

Example 4. If โ€‹f(x) = x + 2โ€‹ and โ€‹g \circ f(x) = x^2 + 4x + 7โ€‹, find โ€‹g(x)โ€‹.

We know โ€‹g(x + 2) = x^2 + 4x + 7โ€‹. Let โ€‹u = x + 2โ€‹, so โ€‹x = u - 2โ€‹. Then

โ€‹g(u) = (u - 2)^2 + 4(u - 2) + 7 = u^2 - 4u + 4 + 4u - 8 + 7 = u^2 + 3โ€‹.

So โ€‹g(x) = x^2 + 3โ€‹. Check: โ€‹g(f(x)) = (x + 2)^2 + 3 = x^2 + 4x + 7โ€‹. Correct.

7. From the real papers

These six questions are from the Mathematics papers of NDA & NAVAC from 2023 to 2026. Try each for 75 seconds before reading the solution.

NDA II 2023, Q42. Let โ€‹f(x) = x^2 - 1โ€‹ and โ€‹gof(x) = x - \sqrt{x} + 1โ€‹. What is โ€‹g(15)โ€‹ equal to?

(a) 1โ€ƒโ€ƒ(b) 2โ€ƒโ€ƒ(c) 3โ€ƒโ€ƒ(d) 4

Solution. We need an โ€‹xโ€‹ with โ€‹f(x) = 15โ€‹: โ€‹x^2 - 1 = 15โ€‹ gives โ€‹x = 4โ€‹ (the positive value, because โ€‹\sqrt{x}โ€‹ must exist). Then โ€‹g(15) = g(f(4)) = 4 - \sqrt{4} + 1 = 3โ€‹. Answer (c).

NDA I 2024, Q35. Let โ€‹A = \{1, 2, 3, 4, 5\}โ€‹ and โ€‹B = \{6, 7\}โ€‹. What is the number of onto functions from โ€‹Aโ€‹ to โ€‹Bโ€‹?

(a) โ€‹10โ€‹โ€ƒโ€ƒ(b) โ€‹20โ€‹โ€ƒโ€ƒ(c) โ€‹30โ€‹โ€ƒโ€ƒ(d) โ€‹32โ€‹

Solution. Each of the 5 elements of โ€‹Aโ€‹ goes to 6 or to 7, so there are โ€‹2^5 = 32โ€‹ functions. Two of them are not onto: all to 6, and all to 7. So โ€‹32 - 2 = 30โ€‹. Answer (c).

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

(a) I onlyโ€ƒโ€ƒ(b) II onlyโ€ƒโ€ƒ(c) Both I and IIโ€ƒโ€ƒ(d) Neither I nor II

Solution. I: the four inputs give four different outputs 1, 4, 7, 10, so โ€‹fโ€‹ is one-one. II: the natural numbers 2, 3, 5 and many others are never outputs, so โ€‹fโ€‹ is not onto. Answer (a).

NDA II 2025, Q90. Consider the function โ€‹f(x) = \frac{10^x - 10^{-x}}{10^x + 10^{-x}}โ€‹. What is the inverse of the function?

(a) โ€‹\log_{10}(2x - 1)โ€‹โ€ƒโ€ƒ(b) โ€‹\frac{1}{2}\log_{10}(2x - 1)โ€‹โ€ƒโ€ƒ(c) โ€‹\frac{1}{4}\log_{10}\left(\frac{2x}{2 - x}\right)โ€‹โ€ƒโ€ƒ(d) โ€‹\frac{1}{2}\log_{10}\left(\frac{1 + x}{1 - x}\right)โ€‹

Solution. Write โ€‹y = f(x)โ€‹ and multiply top and bottom by โ€‹10^xโ€‹: โ€‹y = \dfrac{10^{2x} - 1}{10^{2x} + 1}โ€‹. Then โ€‹y \cdot 10^{2x} + y = 10^{2x} - 1โ€‹, so โ€‹10^{2x} = \dfrac{1 + y}{1 - y}โ€‹ and โ€‹x = \dfrac{1}{2}\log_{10}\left(\dfrac{1 + y}{1 - y}\right)โ€‹. Swap the letters. Answer (d).

NDA II 2026, Q99. Consider the following statements in respect of the function โ€‹f : R - \left\{\frac{3}{5}\right\} \to R - \left\{\frac{3}{5}\right\}โ€‹ such that โ€‹f(x) = \frac{3x + 2}{5x - 3}โ€‹ : I. โ€‹f(x)โ€‹ is a bijective function. II. โ€‹f^{-1}(x) = f(x)โ€‹ Which of the statements given above is/are correct?

(a) I onlyโ€ƒโ€ƒ(b) II onlyโ€ƒโ€ƒ(c) Both I and IIโ€ƒโ€ƒ(d) Neither I nor II

Solution. Write โ€‹y = \dfrac{3x + 2}{5x - 3}โ€‹. Then โ€‹y(5x - 3) = 3x + 2โ€‹, so โ€‹x = \dfrac{3y + 2}{5y - 3}โ€‹. Every โ€‹y \ne \frac{3}{5}โ€‹ comes from exactly one โ€‹xโ€‹, so โ€‹fโ€‹ is bijective. The inverse has the same formula as โ€‹fโ€‹. This is the useful fact of section 5 with โ€‹a = 3โ€‹. Answer (c).

NDA II 2026, Q100. Let โ€‹Aโ€‹ and โ€‹Bโ€‹ be the sets having only 2 and 3 elements respectively. What is the total number of mappings from โ€‹Aโ€‹ to โ€‹Bโ€‹?

(a) โ€‹4โ€‹โ€ƒโ€ƒ(b) โ€‹6โ€‹โ€ƒโ€ƒ(c) โ€‹8โ€‹โ€ƒโ€ƒ(d) โ€‹9โ€‹

Solution. Each of the 2 elements of โ€‹Aโ€‹ can go to any of the 3 elements of โ€‹Bโ€‹: โ€‹3 \times 3 = 3^2 = 9โ€‹. Answer (d).

8. Mistakes that cost marks

  1. Reading โ€‹g \circ fโ€‹ in the wrong order. In โ€‹g \circ f(x) = g(f(x))โ€‹ the function โ€‹fโ€‹ acts first. With โ€‹f(x) = x + 1โ€‹ and โ€‹g(x) = x^2โ€‹, โ€‹g \circ f(2) = g(3) = 9โ€‹, not โ€‹f(4) = 5โ€‹.
  2. Taking โ€‹f^{-1}(x)โ€‹ as โ€‹\dfrac{1}{f(x)}โ€‹. The inverse function undoes โ€‹fโ€‹. For โ€‹f(x) = 2xโ€‹, โ€‹f^{-1}(x) = \dfrac{x}{2}โ€‹, not โ€‹\dfrac{1}{2x}โ€‹.
  3. Writing โ€‹m^nโ€‹ for the number of functions. From a set of โ€‹mโ€‹ elements to a set of โ€‹nโ€‹ elements there are โ€‹n^mโ€‹ functions: the number of choices, raised to the number of inputs.
  4. Calling a function onto without looking at the codomain. โ€‹f(x) = x^2โ€‹ is not onto โ€‹\mathbb{R}โ€‹, but it is onto โ€‹[0, \infty)โ€‹.

9. Quick check

Do these without help. Answers are at the end.

  1. Let โ€‹f(x) = 2x + 1โ€‹ and โ€‹g(x) = x^2โ€‹. Find โ€‹g \circ f(3)โ€‹ and โ€‹f \circ g(3)โ€‹.
  2. Find the inverse of โ€‹f(x) = 5x - 4โ€‹.
  3. โ€‹Aโ€‹ has 3 elements and โ€‹Bโ€‹ has 4 elements. How many functions are there from โ€‹Aโ€‹ to โ€‹Bโ€‹? How many of them are one-to-one?
  4. Is โ€‹f : \mathbb{R} \to \mathbb{R}โ€‹, โ€‹f(x) = x^3โ€‹ bijective?
  5. Let โ€‹f(x) = \dfrac{x + 1}{x - 1}โ€‹ for โ€‹x \ne 1โ€‹. Find โ€‹f(f(x))โ€‹.

10. Read and watch more, free

What Where Language
Textbook NCERT Class 12 Mathematics, Chapter 1 Relations and Functions ยท Hindi edition English, Hindi
Self-study notes NIOS Mathematics, Lesson 23 Relations and Functions-II ยท Hindi edition English, Hindi
Video, the chapter for NDA NDA Vijay by Unacademy: Maths Free Milestone Batch (the class named Functions, about 3 hours 35 minutes) Hinglish
Video, the chapter for NDA Maths Jugad Se: NDA 2 2026 Maths Calculus (the class named Function, about 4 hours) Hinglish
Past NDA questions ExamSIDE: Functions English

The videos were chosen from their titles, length and views; they have not yet been watched by a teacher.

Answers to the quick check

  1. โ€‹g \circ f(3) = g(7) = 49โ€‹ and โ€‹f \circ g(3) = f(9) = 19โ€‹.
  2. โ€‹y = 5x - 4โ€‹ gives โ€‹x = \dfrac{y + 4}{5}โ€‹, so โ€‹f^{-1}(x) = \dfrac{x + 4}{5}โ€‹.
  3. All functions: โ€‹4^3 = 64โ€‹. One-to-one: โ€‹4 \times 3 \times 2 = 24โ€‹.
  4. Yes. It is always increasing, so it is one-to-one, and every real number โ€‹yโ€‹ is the cube of โ€‹\sqrt[3]{y}โ€‹, so it is onto.
  5. โ€‹f(f(x)) = xโ€‹. The function has the form โ€‹\dfrac{ax + b}{cx - a}โ€‹ with โ€‹a = 1โ€‹, so it is its own inverse.

Next chapter: Limits.

Free ยท no sign-up

Try three questions on this chapter

Exam-pattern questions from this chapter's drill. Pick an answer for each, then check.

  1. Question 1 of 3
    Let โ€‹\mathbb{Z}โ€‹ be the set of integers. The function โ€‹f : \mathbb{Z} \to \mathbb{Z}โ€‹ defined by โ€‹f(x) = x^3โ€‹ is
  2. Question 2 of 3
    Let โ€‹f(x) = \dfrac{2x - 3}{x + 4}โ€‹ for โ€‹x \ne -4โ€‹. Consider the following statements: I. โ€‹fโ€‹ is one-to-one. II. โ€‹f^{-1}(x) = \dfrac{4x + 3}{2 - x}โ€‹ for โ€‹x \ne 2โ€‹. Which of the statements given above is/are correct?
  3. Question 3 of 3
    Which one of the following functions from โ€‹\mathbb{R}โ€‹ to โ€‹\mathbb{R}โ€‹ is bijective?
Free sign-up

You have read the chapter. Now make it stick.

A free account adds the video lesson, a drill of ten questions on this chapter marked like the exam, the timed mock papers, a study plan to your exam date and your own record of what you have done. No fee, no card.

Past questions quoted are from the official UPSC paper named in the text; the explanations are WishWas's own and have been checked against the official key. The links under โ€œRead and watch moreโ€ go to free material on other sites; nothing is copied.