Functions and Graphs: Domain, Range, Composition and Inverse

A function is a rule that gives exactly one output for every input, written y = f(x). Entry tests such as ECAT, NUST NET and JEE Main ask quick questions on domain and range, composite functions like f(g(x)), inverse functions and even or odd symmetry. These ideas also form the base for limits, calculus and graph sketching, so a few clear rules here pay off across the whole syllabus.

Asked in: ECAT, NUST NET, JEE Main, FSc and Class 11-12 boards

What a function is

A function f from a set A to a set B pairs every element x of A with exactly one element f(x) of B. A is the domain, B the co-domain, and the set of outputs actually produced is the range.

On a graph, a curve is a function of x if every vertical line meets it at most once. A circle x² + y² = 4 fails this test, while y = x² passes it.

A function is one-one (injective) if different inputs always give different outputs; every horizontal line then meets its graph at most once. It is onto (surjective) if its range equals the co-domain.

Finding the domain

Unless a question says otherwise, the domain is every real x for which the formula gives a real value. Only three things usually restrict it: a denominator cannot be zero, an even root needs a non-negative quantity inside, and a logarithm needs a positive argument.

Write down every restriction separately and then take the values that satisfy all of them together (the intersection).

Finding the range

For simple functions, use known ranges: x² ≥ 0, |x| ≥ 0, sin x and cos x lie in [−1, 1], eˣ takes every positive value and ln x takes every real value.

For a quadratic, complete the square: x² − 6x + 13 = (x − 3)² + 4, so the smallest value is 4 and the range is [4, ∞). For other functions, put y = f(x), solve for x, and see which values of y give a real x.

Composite functions

The composite (f∘g)(x) means f(g(x)): first apply g, then feed its output into f. In general f(g(x)) and g(f(x)) are different, so the order matters.

To evaluate f(g(2)), work from the inside out: find g(2), then apply f to that number. The domain of f∘g contains only those x in the domain of g for which g(x) lies in the domain of f.

Inverse functions

A function has an inverse f⁻¹ only when it is one-one and onto (a bijection). To find it, write y = f(x), solve for x in terms of y, then rename y as x.

The inverse undoes the function: f(f⁻¹(x)) = x and f⁻¹(f(x)) = x. Its graph is the mirror image of the graph of f in the line y = x, and the domain and range swap places. Note that f⁻¹(x) is not 1/f(x).

Even and odd functions

Replace x by −x. If f(−x) = f(x) the function is even and its graph is symmetric about the y-axis (x², cos x, |x|). If f(−x) = −f(x) it is odd and its graph is symmetric about the origin (x³, sin x, tan x).

Most functions are neither. Products follow sign rules: even × even = even, odd × odd = even, even × odd = odd. The only function that is both even and odd is f(x) = 0.

Shifting and reflecting graphs

Once you know the graph of y = f(x), many others follow by moving it. Adding a constant outside shifts the graph up or down; replacing x by x − h shifts it h units to the right.

A minus sign outside, −f(x), reflects the graph in the x-axis; a minus sign inside, f(−x), reflects it in the y-axis. Multiplying by a number stretches the graph vertically.

Solved examples

  1. Find the domain of f(x) = √(x − 2) + 1/(x − 5).
    1. The square root needs x − 2 ≥ 0, so x ≥ 2.
    2. The fraction needs x − 5 ≠ 0, so x ≠ 5.
    3. Both conditions together: x ≥ 2 but x ≠ 5.
    Answer: Domain = [2, 5) ∪ (5, ∞)
  2. Find the range of f(x) = x² − 6x + 13.
    1. Complete the square: x² − 6x + 9 + 4 = (x − 3)² + 4.
    2. (x − 3)² ≥ 0, with its smallest value 0 at x = 3.
    3. So f(x) ≥ 4, and it can take every value from 4 upward.
    4. Check with the formula: (4ac − b²)/4a = (52 − 36)/4 = 4.
    Answer: Range = [4, ∞)
  3. If f(x) = 2x + 3 and g(x) = x² − 1, find f(g(x)), g(f(x)) and f(g(2)).
    1. f(g(x)) = 2(x² − 1) + 3 = 2x² + 1.
    2. g(f(x)) = (2x + 3)² − 1 = 4x² + 12x + 9 − 1 = 4x² + 12x + 8.
    3. f(g(2)): first g(2) = 4 − 1 = 3, then f(3) = 6 + 3 = 9. The formula agrees: 2(4) + 1 = 9.
    4. The two composites are different, which shows the order matters.
    Answer: f(g(x)) = 2x² + 1, g(f(x)) = 4x² + 12x + 8, f(g(2)) = 9
  4. Find the inverse of f(x) = (3x + 2)/(x − 1), x ≠ 1.
    1. Write y = (3x + 2)/(x − 1), so y(x − 1) = 3x + 2.
    2. Expand and collect x-terms: xy − 3x = y + 2, so x(y − 3) = y + 2.
    3. x = (y + 2)/(y − 3). Rename y as x.
    4. Check: f(2) = 8/1 = 8, and the inverse gives (8 + 2)/(8 − 3) = 2.
    Answer: f⁻¹(x) = (x + 2)/(x − 3), x ≠ 3
  5. Classify each as even, odd or neither: f(x) = x³ − sin x, g(x) = x² cos x, h(x) = x² + x.
    1. f(−x) = −x³ + sin x = −(x³ − sin x) = −f(x), so f is odd.
    2. g(−x) = (−x)² cos(−x) = x² cos x = g(x), so g is even.
    3. h(−x) = x² − x, which equals neither h(x) nor −h(x), so h is neither.
    Answer: f is odd, g is even, h is neither
  6. If f(x) = (x − 1)/(x + 1), find f(f(x)) and hence f(f(f(f(x)))).
    1. f(f(x)) = [(x − 1)/(x + 1) − 1] ÷ [(x − 1)/(x + 1) + 1].
    2. Multiply top and bottom by (x + 1): (x − 1 − x − 1)/(x − 1 + x + 1) = −2/(2x) = −1/x.
    3. Applying f twice more is the same as applying f∘f to −1/x: −1/(−1/x) = x.
    4. So four applications of f bring every x back to itself.
    Answer: f(f(x)) = −1/x and f(f(f(f(x)))) = x

Exam shortcuts

Common mistakes

Practice MCQs

  1. If f(x) = 3x − 4, what is f(5)?
    A) 19
    B) 11
    C) 1
    D) 15
    Answer: B) 11 — f(5) = 3 × 5 − 4 = 15 − 4 = 11. (19 comes from adding 4 instead of subtracting.)
  2. What is the domain of f(x) = 1/(x² − 9)?
    A) All real numbers except −3 and 3
    B) All real numbers except 9
    C) All real numbers except 3
    D) [3, ∞)
    Answer: A) All real numbers except −3 and 3 — The denominator x² − 9 = (x − 3)(x + 3) is zero at x = 3 and x = −3, so both values must be removed.
  3. What is the domain of f(x) = √(4 − x)?
    A) [4, ∞)
    B) (−∞, 4)
    C) (−∞, 4]
    D) [−4, 4]
    Answer: C) (−∞, 4] — We need 4 − x ≥ 0, so x ≤ 4. The value x = 4 is allowed because √0 = 0, so the bracket at 4 is closed.
  4. What is the range of f(x) = x² + 2x + 5?
    A) [4, ∞)
    B) [5, ∞)
    C) [−1, ∞)
    D) [6, ∞)
    Answer: A) [4, ∞) — x² + 2x + 5 = (x + 1)² + 4. The square is at least 0, so the least value is 4 (at x = −1). The value −1 is where the minimum occurs, not the minimum itself.
  5. If f(x) = x² and g(x) = x + 3, then f(g(x)) equals:
    A) x² + 3
    B) x² + 9
    C) x² + 3x
    D) x² + 6x + 9
    Answer: D) x² + 6x + 9 — f(g(x)) = f(x + 3) = (x + 3)² = x² + 6x + 9. The option x² + 3 is g(f(x)), the composite in the other order.
  6. If f(x) = 2x + 1 and g(x) = x², what is (g∘f)(1)?
    A) 3
    B) 9
    C) 4
    D) 6
    Answer: B) 9 — (g∘f)(1) = g(f(1)) = g(3) = 9. Doing it in the other order, f(g(1)) = f(1) = 3, is the common slip.
  7. What is the inverse of f(x) = 4x − 7?
    A) (x − 7)/4
    B) (x + 7)/4
    C) 4x + 7
    D) 1/(4x − 7)
    Answer: B) (x + 7)/4 — Put y = 4x − 7, so x = (y + 7)/4; rename y as x. Check: f(2) = 1 and (1 + 7)/4 = 2. The option 1/(4x − 7) is the reciprocal, not the inverse.
  8. Which of the following functions is odd?
    A) x³ + cos x
    B) x sin x
    C) x⁴ − x²
    D) x³ + sin x
    Answer: D) x³ + sin x — x³ and sin x are both odd, so their sum is odd. x sin x is odd × odd = even, x⁴ − x² is even, and x³ + cos x mixes odd and even parts, so it is neither.
  9. The function f(x) = ln[(1 + x)/(1 − x)], for x between −1 and 1, is:
    A) odd
    B) even
    C) neither even nor odd
    D) both even and odd
    Answer: A) odd — f(−x) = ln[(1 − x)/(1 + x)] = −ln[(1 + x)/(1 − x)] = −f(x), so f is odd.
  10. If f(x) = (2x + 1)/(x − 3), then f⁻¹(x) is:
    A) (x − 3)/(2x + 1)
    B) (3x − 1)/(x − 2)
    C) (3x + 1)/(x − 2)
    D) (3x + 1)/(x + 2)
    Answer: C) (3x + 1)/(x − 2) — y(x − 3) = 2x + 1 gives xy − 2x = 3y + 1, so x = (3y + 1)/(y − 2). Shortcut: (b − dx)/(cx − a) with a = 2, b = 1, c = 1, d = −3 gives (1 + 3x)/(x − 2). The option (x − 3)/(2x + 1) is 1/f(x).
  11. What is the range of f(x) = (2x + 1)/(x − 3)?
    A) All real numbers except 3
    B) All real numbers except −1/2
    C) All real numbers except 2
    D) All real numbers
    Answer: C) All real numbers except 2 — Solving y = (2x + 1)/(x − 3) for x gives x = (3y + 1)/(y − 2), which fails only at y = 2. So 2 = a/c is the one value never reached. The number 3 is excluded from the domain, not the range.
  12. What is the domain of f(x) = ln(x² − 4x + 3)?
    A) (1, 3)
    B) (−∞, 1) ∪ (3, ∞)
    C) [1, 3]
    D) (−∞, 1] ∪ [3, ∞)
    Answer: B) (−∞, 1) ∪ (3, ∞) — We need (x − 1)(x − 3) positive, which happens outside the roots: x below 1 or x above 3. The roots themselves are excluded because ln 0 is undefined.
  13. If f(x) = 3x + 2, what is f⁻¹(f⁻¹(26))?
    A) 8
    B) 242
    C) 8/3
    D) 2
    Answer: D) 2 — f⁻¹(x) = (x − 2)/3. f⁻¹(26) = 24/3 = 8, then f⁻¹(8) = 6/3 = 2. The value 242 is f(f(26)), and 8/3 forgets to subtract 2 the second time.
  14. For x ≥ 2, the function f(x) = x² − 4x has an inverse. What is f⁻¹(x)?
    A) 2 + √(x + 4)
    B) 2 − √(x + 4)
    C) √(x + 4) − 2
    D) 2 + √(x − 4)
    Answer: A) 2 + √(x + 4) — y = x² − 4x = (x − 2)² − 4, so (x − 2)² = y + 4 and x − 2 = ±√(y + 4). Since x ≥ 2 we take the + sign: f⁻¹(x) = 2 + √(x + 4). The minus sign gives values below 2, outside the original domain.
  15. The graph of y = (x − 2)² + 3 is obtained from the graph of y = x² by shifting it:
    A) 2 units left and 3 units up
    B) 2 units right and 3 units down
    C) 2 units right and 3 units up
    D) 3 units right and 2 units up
    Answer: C) 2 units right and 3 units up — Replacing x by x − 2 moves the graph 2 units to the right, and adding 3 outside moves it 3 units up. The vertex moves from (0, 0) to (2, 3).

Questions

How do I find the domain quickly in an MCQ?

Look only for the three trouble spots: a denominator (must not be zero), an even root (inside must be zero or positive) and a logarithm (inside must be positive). Solve each condition and keep the x-values that satisfy all of them.

When does a function have an inverse?

Only when it is one-one and onto. If a horizontal line cuts the graph twice, as with y = x² on all reals, there is no inverse unless you restrict the domain, for example to x ≥ 0.

Is f⁻¹(x) the same as 1/f(x)?

No. f⁻¹ reverses the rule of f, so f⁻¹(f(x)) = x. The reciprocal 1/f(x) is a completely different function, written [f(x)]⁻¹ if a power is meant.

Can a function be both even and odd?

Only the zero function f(x) = 0 is both, because f(x) = f(−x) and f(x) = −f(−x) together force f(x) = 0. Most functions are neither even nor odd.