Function: a special relation
A vending machine gives exactly one drink for each button you press. One input, one output, no confusion.
A relation from A to B is a function f : A → B if every element of A has exactly one image in B. We write y = f(x); x is the input (argument) and y the output (image).
Formula: f : A → B, y = f(x)
In the figure: 1 and 2 both go to a (allowed). Each input has exactly one arrow. Not every output needs an arrow.
Rule 1: Is it a function — Test: (i) every element of A is used, (ii) no element has two arrows.
- Easy: {(1, 2), (2, 3), (3, 4)} from {1, 2, 3}: function.
- Medium: {(1, 2), (1, 3), (2, 4)}: not a function, since 1 has two images.
- Exam-type: {(1, 2), (2, 2), (3, 2)}: function (constant).
Rule 2: Value of a function — Replace x by the given number.
- Easy: f(x) = 3x − 2: f(2) = 4.
- Medium: f(x) = 3x − 2: f(−1) = -5.
- Exam-type: f(x) = x² + 1: f(a + 1) = a² + 2a + 2.
Many inputs may share one output, but one input can never give two outputs.
Thinking a function needs different outputs for different inputs.
Function = One input, One output.
Spot the difference
| Relation | Function |
|---|---|
| Any subset of A × B | Each x has exactly one image |
| One x may have several y | One x has one y |
Practice questions
- 1Is {(1, 5), (2, 5)} a function?
- 2Is {(1, 5), (1, 6)} a function?
- 3f(x) = 2x + 3. Find f(4).
- 4f(x) = x² − 4. Find f(−3).
- 5f(x) = 5x − 7. Find x if f(x) = 18.
- 6f(x) = x² + 2x. Find f(3) − f(1).
- 7f(x) = 4x − 1. Find f(x + 1) − f(x).
- 8From A = {1, 2} to B = {a, b, c}, how many functions exist?
Show answers (try them yourself first)
- 1Yes.
- 2No — 1 has two images.
- 311
- 45
- 55x = 25, so x = 5
- 615 − 3 = 12
- 74(x + 1) − 1 − (4x − 1) = 4
- 8Each of 2 inputs picks 1 of 3 outputs: 3² = 9
Domain, codomain and range of a real function
A calculator shows "Error" when you take the square root of a negative number or divide by 0. Those inputs are outside the domain.
For a real function, the domain is the set of all real x for which f(x) is a real number. The range is the set of all outputs. Three checks: no division by 0, no square root of a negative number, and the usual rules for other operations.
In the figure: f(x) = √(x − 3): domain is [3, ∞).
Rule 1: Find the domain — Find the values of x that break the rules, then remove them.
- Easy: f(x) = 1/(x − 2): x ≠ 2, domain R − {2}.
- Medium: f(x) = √(x − 3): need x − 3 ≥ 0, domain [3, ∞).
- Exam-type: f(x) = 1/√(5 − x): need 5 − x > 0, domain (−∞, 5).
Rule 2: Find the range — Think about what values the output can take.
- Easy: f(x) = x²: output ≥ 0, range [0, ∞).
- Medium: f(x) = 2x + 1: every real value is possible, range R.
- Exam-type: f(x) = √x: range [0, ∞).
For a fraction, the denominator can never be 0; for an even root, the inside can never be negative.
Allowing 0 under a square root. √0 = 0 is fine; negative is not.
Domain = Dos and Don'ts for x.
Practice questions
- 1Find the domain of f(x) = 1/(x − 7).
- 2Find the domain of f(x) = √(x + 4).
- 3Find the range of f(x) = x² + 3.
- 4Find the domain of f(x) = 1/(x² − 9).
- 5Find the domain of f(x) = √(6 − 2x).
- 6Find the range of f(x) = |x| + 1.
- 7Find the domain of f(x) = √(x − 1) + 1/(x − 4).
- 8f : {1, 2, 3, 4} → N is f(x) = 2x + 1. Find its range.
Show answers (try them yourself first)
- 1R − {7}
- 2[−4, ∞)
- 3[3, ∞)
- 4x ≠ 3 and x ≠ −3, so R − {−3, 3}
- 56 − 2x ≥ 0 gives x ≤ 3, so (−∞, 3]
- 6[1, ∞)
- 7x ≥ 1 and x ≠ 4, so [1, 4) ∪ (4, ∞)
- 8{3, 5, 7, 9}
Some standard functions
A taxi fare that adds a flat charge, a parking fee that is a fixed amount, or a ticket price rounded down to complete years: each is a familiar function pattern.
Important real functions: identity f(x) = x; constant f(x) = c; polynomial (like x² − 3x + 1); rational p(x)/q(x) with q(x) ≠ 0; modulus |x| (x if x ≥ 0, −x if x < 0); signum (1, 0 or −1 according as x is positive, zero or negative); greatest integer [x] = the largest integer not greater than x.
Formula: |x| = x for x ≥ 0, |x| = −x for x < 0
Rule 1: Modulus — Distance from 0, never negative.
- Easy: |5| = 5, |−5| = 5.
- Medium: |3 − 8| = 5.
- Exam-type: |x| = 4 gives x = 4 or x = −4.
Rule 2: Greatest integer [x] — Step down to the integer on the left (or the number itself).
- Easy: [3.7] = 3.
- Medium: [−2.3] = -3 (not −2).
- Exam-type: [5] = 5 and [0.99] = 0.
Rule 3: Signum — Only the sign matters.
- Easy: sgn(8) = 1.
- Medium: sgn(−0.5) = −1.
- Exam-type: sgn(0) = 0.
The graph of |x| is a V with its corner at the origin; the graph of [x] is a staircase.
Writing [−2.3] = −2. The greatest integer not exceeding −2.3 is −3.
[x] = floor: slide DOWN.
Spot the difference
| x | [x] | ||
|---|---|---|---|
| Always ≥ 0 | Can be negative | ||
| Range [0, ∞) | Range Z (integers) |
Practice questions
- 1Find |−9|.
- 2Find [6.4].
- 3Find [−0.5].
- 4Solve |x| = 7.
- 5Solve |x − 3| = 2.
- 6Find [2.5] + [−2.5].
- 7What is the range of f(x) = [x]?
- 8Find f(−3) + f(0) + f(4) for f(x) = sgn(x).
Show answers (try them yourself first)
- 19
- 26
- 3-1
- 4x = 7 or x = −7
- 5x − 3 = 2 or −2, so x = 5 or 1
- 62 + (-3) = -1
- 7The set of all integers Z.
- 8−1 + 0 + 1 = 0
Algebra of real functions
Total bill = food bill + service charge; profit = income − expense. We add or multiply two rules at the same x.
For real functions f and g with a common domain: (f + g)(x) = f(x) + g(x); (f − g)(x) = f(x) − g(x); (fg)(x) = f(x)·g(x); (f/g)(x) = f(x)/g(x), where g(x) ≠ 0; (cf)(x) = c·f(x).
Formula: (f + g)(x) = f(x) + g(x)
Rule 1: Add, subtract, multiply — Work at the same x and then simplify.
- Easy: f(x) = 2x, g(x) = x + 3: (f + g)(x) = 3x + 3.
- Medium: f(x) = x², g(x) = x − 1: (f − g)(x) = x² − x + 1.
- Exam-type: f(x) = x, g(x) = x + 2: (fg)(x) = x² + 2x.
Rule 2: Quotient — Exclude the x for which g(x) = 0.
- Easy: f(x) = x + 1, g(x) = x − 3: (f/g)(x) = (x + 1)/(x − 3), x ≠ 3.
- Medium: f(x) = x², g(x) = x: (f/g)(x) = x, x ≠ 0.
- Exam-type: Value check: (f/g)(5) = 6/2 = 3.
The domain of f + g, f − g and fg is the common part of the two domains; for f/g also remove the zeros of g.
Dividing f by g and forgetting x ≠ zeros of g.
Same x, then operate.
Practice questions
- 1f(x) = x + 4, g(x) = 2x. Find (f + g)(x).
- 2f(x) = 3x, g(x) = x − 2. Find (f − g)(x).
- 3f(x) = x + 1, g(x) = x − 1. Find (fg)(x).
- 4f(x) = x², g(x) = x + 5. Find (f + g)(2).
- 5f(x) = 2x + 3, g(x) = x − 1. Find (f/g)(3).
- 6Find the domain of f/g for f(x) = x, g(x) = x − 6.
- 7f(x) = x², g(x) = 3x. Find x for which (f − g)(x) = 0.
- 8f(x) = 2x − 1, g(x) = 4x + 5. Find (3f − g)(x).
Show answers (try them yourself first)
- 13x + 4
- 22x + 2
- 3x² − 1
- 44 + 7 = 11
- 59/2
- 6All real x except 6.
- 7x² − 3x = 0, so x = 0 or 3
- 86x − 3 − 4x − 5 = 2x − 8