Functions are one of the most important topics in mathematics, and they carry real weight in the preparation for aptitude tests. Major universities such as IBA, LUMS, FAST, NED and others regularly test functions in the mathematics section of their admission tests. Questions range from deciding whether a relation is a function, to classifying functions, to even/odd properties, inverses and composite functions. Mastering them also builds the foundation for graphs, calculus and the SAT’s algebra and function questions.
This chapter begins with the idea of a function as an input-output machine (the domain is the input; the codomain/range is the output) and then builds up step by step. Study the four examples in each concept (the two marked IBA level are in the style of IBA past-paper questions), and finish with the 20 practice questions.
- Functions: domain, codomain and range
- Is it a function? Relations and the vertical line test
- Types of functions
- Linear functions and their graphs
- Finding the domain and range
- Algebra of functions (sum, product, quotient)
- Even and odd functions
- Inverse of a function
- Composite functions
- Aptitude-test shortcuts
- Practice questions
1. Functions: Domain, Codomain and Range
A function is a rule that assigns to each input exactly one output. If f is a function from a set X to a set Y we write f : X → Y, and for an input x the output is written y = f(x) (“f of x”).
| Term | Meaning | Role |
|---|---|---|
| Domain | The set of all allowed inputs (x-values) of the function | Input |
| Codomain | The set Y in f : X → Y, where the outputs are allowed to lie | Output “target” |
| Range | The set of outputs that actually occur, {f(x) : x in the domain}. It is a subset of the codomain | Actual output |
In everyday lecture language the outputs are often described together as “the range / co-domain”. Strictly speaking, the range equals the codomain only when the function is onto. Other key terms: for f(a) = b, b is the image of a, and a is a pre-image of b. The input variable x is independent; the output y is dependent.
Ways to represent a function
- Set of ordered pairs: {(1, 2), (2, 4), (3, 6)}
- Arrow (mapping) diagram: arrows from each input to its output
- Table of values, graph, or formula: f(x) = 2x
Understanding the concept
Think of a function as a machine: you feed in an input from the domain, and it returns exactly one output. Different inputs may give the same output, but one input can never give two different outputs. To evaluate f(a), replace every x in the formula by a. To find the range from ordered pairs, list the second components that appear.
Domain = {1, 2, 3} (inputs). Range = {2, 4, 6} (outputs).
Domain = X = {a, b, c}. Codomain = Y = {1, 2, 3, 4}. Range = outputs that actually occur = {1, 3}.
The range is smaller than the codomain because 2 and 4 are never produced (so f is not onto). Note that two inputs may share the output 3 and f is still a function.
We want the input x + 1 to equal 3, so x = 2.
Check by finding the rule: put t = x + 1, so x = t − 1 and f(t) = 2(t − 1) + 5 = 2t + 3, so f(3) = 9 ✓.
2. Is It a Function? Relations and the Vertical Line Test
A relation is any set of ordered pairs (x, y). It is a function only if no input is paired with two different outputs.
- Ordered pairs: look for repeated first components with different second components. {(1, 0), (1, 1), (3, 2)} is not a function; {(1, 2), (2, 2), (3, 5)} is (repeated outputs are fine).
- Arrow diagram: every input must have exactly one arrow leaving it.
- Equation: solve for y. If some x gives two values of y (for example y = ±√x), it is not a function of x.
- Vertical line test (VLT): a graph is a function if every vertical line meets it at most once.
Understanding the concept
A function must be predictable: the same input always gives the same output. A circle fails because a vertical line cuts it at two points, meaning one x-value has two y-values. The sideways parabola x = y² fails for the same reason. Remember that x = y² is a function if you treat y as the input and x as the output.
First set: inputs 1, 2, 3 each appear once, so it is a function (the output 2 repeats, which is allowed).
Second set: the input 2 is paired with both 1 and 4, so it is not a function.
Solve for y: y = ±√x. Take x = 4, then y = 2 or y = −2. One input gives two outputs.
Graphically, the vertical line x = 3 meets the curve at two points (see the middle graph), so the vertical line test fails. It is not a function of x.
Answer: (i) and (iv).
A: written out, the repeated pair (1, 2) is the same element, so A = {(1, 2), (2, 3)}. Each input has one output: function.
B: input 1 has two outputs: not a function.
C: every input gives 5 (a constant function): function.
3. Types of Functions
| Type | Definition | Quick test |
|---|---|---|
| One-to-one (injective) | Different inputs always give different outputs: f(a) = f(b) ⇒ a = b | Horizontal line test; no output has two arrows |
| Onto (surjective) | Every element of the codomain is an output, so range = codomain | Every element of Y receives an arrow |
| Into | Not onto: at least one element of the codomain is never an output | Some element of Y is missed |
| Bijective | Both one-to-one and onto (a perfect pairing) | Has an inverse function |
| Many-to-one | Some different inputs share an output | Not injective, e.g. f(x) = x² |
| Constant | f(x) = c for every x. Range is just {c}; graph is a horizontal line | Not injective (if domain has 2+ elements) |
| Identity | f(x) = x: every element is its own image | Bijective; graph y = x |
Counting functions (finite sets)
Let A have m elements and B have n elements.
- Total functions A → B: nᵐ
- One-to-one functions (need n ≥ m): n × (n − 1) × … × (n − m + 1)
- Bijections (need m = n): n!
- An onto function needs m ≥ n; a one-to-one function needs m ≤ n.
Understanding the concept
Injective means “no collisions” in the outputs; surjective means “no unused targets”. The same formula can switch type when the sets change: f(x) = x² is not injective on all real numbers (f(2) = f(−2) = 4) and not onto R (negatives are never outputs), but it is injective on [0, ∞) and onto [0, ∞) when that is the codomain. Always check the stated domain and codomain.
f is a constant function (neither one-to-one nor onto). g is the identity function (bijective). h is bijective: each output has exactly one input, x = (y − 1)/2, and every real number is reached. k is many-to-one and into: k(2) = k(−2), and negative numbers are never outputs.
Each input has a different output (one-to-one), and every element of B is used (onto). So f is bijective. Both sets have 3 elements, as required for a bijection.
1 and 3 both map to x, so f is not one-to-one. Both x and y appear as outputs, so f is onto. (Since 4 inputs map into 2 outputs, no function from A to B can be one-to-one.)
For one-to-one, input 1 has 5 choices, input 2 then has 4 remaining, and input 3 has 3.
4. Linear Functions and Their Graphs
A linear function has the form f(x) = mx + b, with graph a straight line. Here m is the slope (change in y per unit change in x) and b is the y-intercept (the value f(0)).
- Domain and range: both are all real numbers when m ≠ 0.
- m > 0: increasing (rises left to right). m < 0: decreasing. m = 0: constant function, a horizontal line.
- Zero (x-intercept): solve mx + b = 0, giving x = −b/m.
- Slope from two points: m = (y₂ − y₁)/(x₂ − x₁).
- A linear function with m ≠ 0 is bijective, so it always has an inverse.
The graph of y = x (identity function)
It is a straight line through the origin with slope 1 at 45° to the axes. Every point has equal coordinates, such as (−3, −3), (0, 0), (3, 3), so the line lies in quadrants I and III and is the mirror line used for graphing inverse functions.
Understanding the concept
Moving one unit to the right always changes the output by exactly m. That constant rate of change is the defining feature of a linear function. The y-intercept shifts the whole line up or down without changing its steepness.
Pick inputs and read the outputs: (−3, −3), (0, 0), (3, 3). Plotting these gives a straight line through the origin with slope 1 (see the graph above).
Answer: a straight line through the origin at 45°, passing through quadrants I and III. For y = −x the slope is −1 and the line passes through quadrants II and IV.
Slope m = 2 and y-intercept b = −3. The x-intercept solves 2x − 3 = 0, so x = 3/2. And f(4) = 2(4) − 3 = 5.
The slope is the change in f per unit of x: (f(5) − f(3)) ÷ (5 − 3) = 6 ÷ 2 = 3.
So f(x) = 3x + 1, which satisfies f(2) = 7 ✓.
5. Finding the Domain and Range
If a function is given only by a formula, its domain is all real numbers for which the formula is defined. Restrictions come from:
- Division by zero: exclude values that make a denominator 0.
- Even roots: the expression under √ must be ≥ 0.
- Polynomials (including linear functions) have domain R.
Range tips: a non-constant linear function has range R. Squares are ≥ 0 and √ gives values ≥ 0. For a quadratic on a restricted interval, evaluate the vertex and the end points. On a finite domain, simply evaluate f at each input.
Understanding the concept
Domain is about which inputs are legal; range is about which outputs result. For range, ask “what values can y take?” and use the shape of the graph: a parabola opening upward starts at its minimum value; an absolute value starts at 0.
The denominator x − 4 cannot be 0, so x ≠ 4.
Need x − 3 ≥ 0, so x ≥ 3. The output of a square root is never negative, and it reaches every non-negative value.
Two conditions: x + 2 ≥ 0 (so x ≥ −2) and x − 1 ≠ 0 (so x ≠ 1).
The parabola has its minimum at x = 0, and 0 lies in the interval: f(0) = −4. Check the end points: f(−1) = −3 and f(3) = 5. The largest value is 5.
6. Algebra of Functions (Sum, Product, Quotient)
Functions can be combined like numbers, with the operation applied to the outputs:
- (f + g)(x) = f(x) + g(x) (f − g)(x) = f(x) − g(x)
- (f · g)(x) = f(x) · g(x)
- (f / g)(x) = f(x) ÷ g(x), where g(x) ≠ 0
The domain of the combined function is the common domain of f and g (and, for a quotient, with the zeros of g removed). Do not confuse this with the composite f(g(x)) in Concept 9.
Understanding the concept
To evaluate (f · g)(3), find f(3) and g(3) separately, then multiply. To get a formula, multiply or add the two expressions and simplify. These combined functions are what the even/odd questions (Concept 7) test, for example “is f(x) · g(x) even?”.
Domain: x ≠ 3, because g(3) = 0.
f(3) = 7 and g(3) = −1.
7. Even and Odd Functions
| Test | Graph symmetry | Examples | |
|---|---|---|---|
| Even | f(−x) = f(x) | About the y-axis | x², x⁴, |x|, cos x, constants |
| Odd | f(−x) = −f(x) | About the origin | x, x³, 1/x, sin x |
| Neither | Both tests fail | None | x² + x, 2x + 1, 2ˣ |
Rules for combining parity
- even ± even = even odd ± odd = odd
- even × even = even odd × odd = even even × odd = odd
- Composition: if the inner function g is even, f(g(x)) is even. If f is even and g is odd, f(g(x)) is even. If both are odd, f(g(x)) is odd.
- A polynomial with only even powers is even; only odd powers is odd. A non-zero constant term is even, so “odd power + constant” is neither.
Understanding the concept
Replace x by −x and compare with the original. If nothing changes, it is even; if every term flips sign, it is odd; if only some terms flip, it is neither. Powers decide the parity of a term: x² keeps its sign when x becomes −x, while x³ changes sign.
f(−x) = −2x + 1. This is not f(x) = 2x + 1 and not −f(x) = −2x − 1, so f is neither. The function 2x is odd, and the constant 5 is even.
f·g = x² sin x: even × odd = odd.
f(g(x)) = sin(x²): g is even, so f(g(−x)) = f(g(x)): even.
g(f(x)) = sin²x: even.
f is odd and g is even.
f · g: odd × even = odd. f(g(x)) = |x|³ − |x| is even (the inner function is even). g(f(x)) = |x³ − x| is even.
8. Inverse of a Function
The inverse function f−1 undoes f: if f(a) = b then f−1(b) = a. It swaps inputs and outputs.
- Exists only if f is one-to-one (horizontal line test). It is defined on the whole codomain only if f is also onto, i.e. bijective; otherwise restrict the codomain to the range of f.
- f−1(f(x)) = x and f(f−1(x)) = x.
- Domain of f−1 = range of f; range of f−1 = domain of f.
- The graph of f−1 is the reflection of the graph of f in the line y = x.
- Warning: f−1(x) is not 1/f(x). The −1 is not an exponent.
How to find the inverse (4 steps)
- Write y = f(x).
- Interchange x and y (or solve for x in terms of y).
- Solve for y.
- Replace y by f−1(x), and check with f(f−1(x)) = x.
Understanding the concept
If f multiplies by 8 and then adds 7, the inverse must subtract 7 and then divide by 8: the steps are reversed in the opposite order. For a quick value, {INV}(a) is just the x for which f(x) = a, so you can solve f(x) = a instead of finding the whole formula.
Check: f(f⁻¹(x)) = 8·(x − 7)/8 + 7 = x ✓.
Check: f(4) = (4 + 2)/3 = 2 ✓.
Collect the terms containing x on one side, then factorise. Restrictions: f is defined for x ≠ 3 and never takes the value 2, so f⁻¹ is defined for x ≠ 2 (the two domains differ).
The range of f is y ≥ 3, so the domain of f⁻¹ is x ≥ 3.
9. Composite Functions
A composite function is formed by replacing the variable of one function by another function. The composite (f ∘ g)(x) = f(g(x)) means: apply g first, then apply f to the result.
- How to build f(g(x)): in the formula of f, replace every x by the whole expression g(x).
- Order matters: in general f(g(x)) ≠ g(f(x)).
- Domain: x must be in the domain of g, and g(x) must be in the domain of f.
- Inverse link: f and g are inverses exactly when f(g(x)) = x and g(f(x)) = x.
- Equations: a statement such as f(g(x)) = g(f(x)) is solved by building both composites and equating them.
Understanding the concept
Read f(g(x)) from the inside out. The inner function g acts first, and its output becomes the input of f. Use brackets whenever you substitute an expression, especially with powers or negative signs: if f(x) = x² and g(x) = x + 1, then f(g(x)) = (x + 1)², not x² + 1.
f ∘ g = f(g(x)): replace x in f by x² + 2.
g ∘ f = g(f(x)): replace x in g by x + 1.
Compare with f ∘ g = x² + 2, which is different: order matters.
For k = −2 both composites equal x, so f and g are inverses.
Aptitude-Test Shortcuts
- Function test: no input may have two different outputs (repeated outputs are fine). Use the vertical line test on graphs.
- One-to-one: horizontal line test; for finite sets count with n(n − 1)…; onto needs m ≥ n.
- Bijective ⇒ invertible. For inverse: write y = f(x), solve for x, swap.
- Inverse value: to find f⁻¹(a), solve f(x) = a.
- Even/odd: test f(−x). odd × odd = even, even × odd = odd. Odd power + constant is neither.
- Composite: f(g(x)) means g first. Substitute with brackets and never assume f(g) = g(f).
- Domain: exclude zero denominators and negatives under even roots.
Practice Questions: Test Yourself
Choose an answer to see instantly whether it is right or wrong. If you pick a wrong option, the correct one is highlighted. Then press Show Solution to review the steps.
Show SolutionHide Solution
Correct answer: B. No, because the input 1 is paired with two different outputs
A function gives each input exactly one output.
Here the input 1 appears twice: (1, 0) and (1, 1), so one input has two outputs.
Hence it is not a function. (Repeating an output would have been fine, but repeating an input with different outputs is not.)
Show SolutionHide Solution
Correct answer: B. Codomain
In f : X → Y, X is the domain (set of inputs) and Y is the codomain (the set in which the outputs lie).
The range is only the set of outputs that actually occur, a subset of Y. It equals Y only when f is onto, so the set Y is not generally called the range.
Answer: codomain. (Some school textbooks loosely call the output set “range / co-domain”, but when the options are listed separately, choose the codomain.)
Show SolutionHide Solution
Correct answer: B. f = {(5, 2), (6, 2), (7, 4)}
Check each option: is it a function on A, and does it use every element of B?
Option A: 7 has no image, so it is not a function from A.
Option C: 6 is paired with both 4 and 2, so it is not a function.
Option D: it is a function, but 4 is never an output, so it is not onto.
Option B: 5, 6, 7 each have one image, and the outputs {2, 4} cover all of B, so it is onto.
Show SolutionHide Solution
Correct answer: D. f = {(2, 1), (8, 9), (6, 5)}
A one-to-one function needs every element of A to have exactly one image, and different inputs to have different images.
Option A: 2 and 6 both map to 1, so it is not one-to-one.
Option B: 2 is paired with 3 and with 9, so it is not a function.
Option C: 3 is not in A (and 6 is missing).
Option D: 2 → 1, 8 → 9, 6 → 5 are all different, so it is one-to-one.
I. f(x) · g(x) II. f(g(x)) III. g(f(x))
Show SolutionHide Solution
Correct answer: C. III only
f(x) = cos x is even, but g(x) = 2x + 1 is neither even nor odd.
I: f(x)g(x) = (2x + 1)cos x. At x = 1 it is 3cos 1 ≈ 1.62; at x = −1 it is −cos 1 ≈ −0.54. Not equal, so not even.
II: f(g(x)) = cos(2x + 1). At x = 1: cos 3 ≈ −0.99; at x = −1: cos(−1) ≈ 0.54. Not even.
III: g(f(x)) = 2cos x + 1, and 2cos(−x) + 1 = 2cos x + 1, so it is even.
Answer: III only.
I. f(x) · g(x) II. f(g(x)) III. g(f(x))
Show SolutionHide Solution
Correct answer: A. I only
f is odd (x³) and g is even (x² + 1).
I: f · g = x³(x² + 1) = x⁵ + x³. Both powers are odd, so it is odd.
II: f(g(x)) = (x² + 1)³ is a function of x², so it is even.
III: g(f(x)) = (x³)² + 1 = x⁶ + 1, which is even.
Answer: I only (odd × even = odd).
Show SolutionHide Solution
Correct answer: A. 4
Find the input that gives 2: solve (x + 2)/3 = 2, so x + 2 = 6 and x = 4.
Or find the inverse: y = (x + 2)/3 gives x = 3y − 2, so f⁻¹(x) = 3x − 2 and f⁻¹(2) = 4.
Note: 1/3 would be the slope (derivative) of f, not its inverse value.
Show SolutionHide Solution
Correct answer: D. x + 11 − x
Start with y = (x − 1)/(x + 1), where x ≠ −1.
Interchange x and y: x = (y − 1)/(y + 1).
Multiply both sides by (y + 1): x(y + 1) = y − 1, so xy + x = y − 1.
Collect the y terms: xy − y = −x − 1, so y(x − 1) = −(x + 1), hence y = (x + 1)/(1 − x).
So f⁻¹(x) = (x + 1)/(1 − x).
Domains: f is defined for x ≠ −1 and never takes the value 1, so its range is y ≠ 1. Therefore f⁻¹ is defined for x ≠ 1, and its range is y ≠ −1. The two domains are different.
Check: f(3) = 2/4 = 1/2 and f⁻¹(1/2) = 1.5/0.5 = 3 ✓.
Show SolutionHide Solution
Correct answer: B. (2x − 3)²
Start with y = (√x + 3)/2, where x ≥ 0.
Multiply both sides by 2: 2y = √x + 3.
Subtract 3 from both sides: 2y − 3 = √x.
Square both sides: x = (2y − 3)². (This is valid because √x ≥ 0 forces 2y − 3 ≥ 0.)
Interchange x and y: f⁻¹(x) = (2x − 3)².
Restrictions: f has domain x ≥ 0 and range y ≥ 3/2 (because √x ≥ 0). So f⁻¹ has domain x ≥ 3/2 and range y ≥ 0. The formula (2x − 3)² must not be used for x ‹ 3/2.
Check: for x ≥ 3/2, f(f⁻¹(x)) = (√((2x − 3)²) + 3)/2 = (|2x − 3| + 3)/2 = ((2x − 3) + 3)/2 = x ✓.
Show SolutionHide Solution
Correct answer: E. 5
f(g(x)) = 2 · (x − 5)/2 + k = x − 5 + k.
g(f(x)) = (2x + k − 5)/2 = x + (k − 5)/2.
Equate: −5 + k = (k − 5)/2 → 2k − 10 = k − 5 → k = 5.
Check with k = 5: f(g(x)) = x and g(f(x)) = x ✓.
Show SolutionHide Solution
Correct answer: D. x² − 3x + 5
g(f(x)): replace x in g by f(x).
g(f(x)) = f(x) + 1 = x² − 3x + 4 + 1 = x² − 3x + 5.
(The other order gives f(g(x)) = (x + 1)² − 3(x + 1) + 4 = x² − x + 2, which is the second option.)
Show SolutionHide Solution
Correct answer: B. −2
f(x + y) = 3(x + y) − 2 = 4 → x + y = 2.
g(x − y) = −(x − y) + 1 = 7 → x − y = −6.
Add the two equations: 2x = −4, so x = −2 (and y = 4).
Check: f(2) = 4 ✓ and g(−6) = 7 ✓.
Show SolutionHide Solution
Correct answer: D. x − 78
Write y = 8x + 7.
Solve for x: 8x = y − 7, so x = (y − 7)/8.
Swap the variables: f⁻¹(x) = (x − 7)/8.
Check: f((x − 7)/8) = 8 · (x − 7)/8 + 7 = x ✓.
Show SolutionHide Solution
Correct answer: D. No, because x = 4 gives both y = 2 and y = −2
Solving for y gives y = ±√x.
For x = 4 there are two outputs, y = 2 and y = −2, so one input has two outputs.
On the graph, the vertical line x = 4 cuts the sideways parabola twice, so it fails the vertical line test.
So y is not a function of x. (Every y does give exactly one x, so x is a function of y, but that is a different question.)
Show SolutionHide Solution
Correct answer: D. x² + y² = 9
The vertical line test: a relation is a function of x only if every vertical line meets its graph at most once.
x² + y² = 9 is a circle of radius 3 centred at the origin. The vertical line x = 2 meets it at (2, √5) and (2, −√5), so it fails.
y = 2x + 1, y = x² and y = |x| each give exactly one y for every x, so each of them passes the test.
Show SolutionHide Solution
Correct answer: D. f(x) = 2x + 1
Injective means different inputs give different outputs. Surjective means every element of the codomain (here R) is an output. Bijective means both.
f(x) = 2x + 1: if 2a + 1 = 2b + 1 then a = b, so it is injective (its slope is not zero). For any real y, the real number x = (y − 1)/2 gives f(x) = y, so it is surjective. Hence it is bijective.
f(x) = x² from R to R is not injective (f(2) = f(−2) = 4) and not surjective (no real x gives −1).
f(x) = |x| from R to R is not injective (f(2) = f(−2)) and not surjective (it never gives a negative value).
f(x) = 5 is constant: not injective (f(0) = f(1)) and not surjective (only 5 is reached).
Show SolutionHide Solution
Correct answer: B. f(x) = x³ + x
A function is odd if f(−x) = −f(x) for every x in its domain (the domain must be symmetric about 0; here it is R). It is even if f(−x) = f(x).
x³ + x: f(−x) = (−x)³ + (−x) = −x³ − x = −(x³ + x) = −f(x), so it is odd.
x² + 1: f(−x) = x² + 1 = f(x), so it is even (and not odd, since f(1) = 2 but −f(1) = −2 differs from f(−1) = 2).
|x|: f(−x) = |x| = f(x), so it is even.
cos x: cos(−x) = cos x, so it is even.
Only x³ + x is odd.
Show SolutionHide Solution
Correct answer: D. f(x) = −4
A constant function gives the same output for every input.
f(x) = −4 always returns −4 (its graph is a horizontal line), so it is constant.
f(x) = x is the identity function; |x| and x³ change with x.
Show SolutionHide Solution
Correct answer: D. 17
(f ∘ g)(2) = f(g(2)): apply g first.
g(2) = 2 + 4 = 6.
f(6) = 3(6) − 1 = 17.
(The other order, g(f(2)) = g(5) = 9, is a different number.)
Show SolutionHide Solution
Correct answer: B. 60
The first element has 5 choices of image, the second has 4 remaining choices, and the third has 3.
5 × 4 × 3 = 60.
(125 = 5³ is the total number of functions, not just one-to-one ones.)
