Mathematics 1Week 5 · Functions: Line Tests, Exponential, Composite and Inverse Functions
Week 5 Notes
Mathematics for Data Science 1
Functions from the ground up: domain and range, the vertical and horizontal line tests, one-one and onto functions, exponential functions, composite functions and inverse functions.
Relation and function, domain and range, graphs, the vertical line test and some common functions.
1.1Relation and function
In simple words
A function is a machine: you put in an input and it gives exactly one output. The same input can never give two different outputs.
Definition
A relation from a set A to a set B is a subset of A×B. A relation f from A to B is a function, written f:A→B, if every a∈A has exactly one b∈B with (a,b)∈f. We write f(a)=b and call b the image of a.
Figure 1. A function and a relation that is not a function
Every element of A must have exactly one arrow leaving it. Two inputs may share an output (left: 1 and 3 both go to a), but one input may not have two outputs (right: the orange arrows from 1).
Example 1: is it a function?
Is R={(1,a),(2,b),(3,a),(1,b)} from A={1,2,3} to B={a,b} a function?
The element 1 has two images, a and b.
This breaks the "one input, one output" rule.
Answer: not a function.
Remember. All functions are relations, but not all relations are functions.
1.2Domain, codomain and range
Term
Meaning
Domain
the set A of allowed inputs
Codomain
the set B where outputs are allowed to lie
Range (image)
the outputs actually produced: {f(a)∣a∈A}⊂B
Range vs codomain. The range is inside the codomain but need not fill it. For f:R→R, f(x)=x2, the codomain is R but the range is only [0,∞).
Example 2: range of two functions
(a) f:R→R, f(x)=x2. (b) h:R→R, h(x)=x3+5. Find the range of each.
(a) x2≥0 for every real x, and every y≥0 equals (y)2. Range =[0,∞).
(b) x3 takes every real value, so x3+5 does too. Range =R (by the intermediate value theorem).
Answer: (a) [0, ∞) (b) ℝ.
1.3Finding the domain (NCERT)
In simple words
If no domain is given, take the largest set of real x where the formula makes sense. Three things break a formula:
Problem
Rule
Example → domain
Division by zero
denominator ≠ 0
x−21 → R∖{2}
Even root of a negative
expression under √ must be ≥ 0
x−3 → [3,∞)
Log of a non-positive
expression inside log must be > 0
log(5−x) → (−∞,5)
1.4Graph of a function
Definition
The graph of f:X→Y is the set Γ(f)={(x,f(x))∣x∈X}⊂X×Y. Example: f(x)=7x+2 has graph {(x,7x+2)∣x∈R}. To draw it, collect inputs and outputs, plot the points (x,f(x)) and join them.
1.5Vertical line test (NCERT)
In simple words
A graph is the picture of a function only if no input has two outputs. Two outputs for one x would be two points directly above each other, on the same vertical line.
Vertical line test
A curve in the plane is the graph of a function of x if and only if every vertical line cuts it at most once.
Figure 2. Vertical line test: the parabola passes, the circle fails
Left: the line x=1 meets the parabola once, and so does every vertical line, so it is a function. Right: x=0.6 meets the circle at (0.6,0.8) and (0.6,−0.8) (since 0.36+0.64=1), so the circle is not a function graph.
1.6Common types of functions
Type
Form
Notes
Linear
f(x)=ax+b
a=0; graph is a straight line
Quadratic
f(x)=ax2+bx+c
a=0; graph is a parabola
Polynomial of degree n
anxn+⋯+a1x+a0
an=0
Exponential
f(x)=ax
a>0 (a=1 to be useful); Chapter 3
Logarithmic
f(x)=logax
a>0,a=1; domain x>0
Trigonometric
sinx,cosx,tanx,…
periodic
1.7Step and modulus functions
Function
Meaning
Values
Floor ⌊x⌋
greatest integer ≤ x
⌊2.7⌋=2, ⌊−1.3⌋=−2
Ceiling ⌈x⌉
smallest integer ≥ x
⌈2.1⌉=3, ⌈−1.3⌉=−1
Modulus ∣x∣
x if x≥0; −x if x<0
∣−5∣=5, ∣3∣=3
Floor on [−1,2): ⌊x⌋=−1 for −1≤x<0, 0 for 0≤x<1, 1 for 1≤x<2. Ceiling on (−1,2): ⌈x⌉=0 for −1<x≤0, 1 for 0<x≤1, 2 for 1<x<2.
Figure 3. Floor and ceiling are step functions
Watch the negatives. Floor always rounds down (towards −∞), so ⌊−1.3⌋=−2, not −1. Ceiling rounds up.
1.8Going deeper
Domain rules combine (extra remark). For x−4x−1 apply both: x≥1 from the root and x=4 from the denominator, so the domain is [1,∞) without 4.
Floor and ceiling differ only off the integers (extra remark). For an integer n, ⌊n⌋=⌈n⌉=n; otherwise ⌈x⌉=⌊x⌋+1. In Figure 3 that is why the dots sit at opposite ends of the steps.
Both tests use lines. The vertical line test asks "is it a function?"; the horizontal line test of Chapter 2 asks "is it one-one?".
Exam tips
For "is it a function?", look for one input with two outputs.
For the domain, list every root, denominator and log, and intersect the conditions.
One-one and onto with the horizontal line test, bounded and monotonic functions, and arithmetic of functions.
2.1One-one and onto (NCERT)
In simple words
One-one: different inputs always give different outputs. Onto: every element of the codomain is actually hit by some input.
Name
Definition
Say it as
One-one (injective)
f(x1)=f(x2)⇒x1=x2
no two inputs share an output
Onto (surjective)
for every y in the codomain there is x with f(x)=y
range = codomain
Bijective
one-one and onto
perfect pairing of A with B
Proving one-one. Assume f(x1)=f(x2) and show x1=x2. To disprove it, give one pair of different inputs with the same output: (−2)2=22, so x2 on R is not one-one.
2.2Horizontal line test (NCERT)
Horizontal line test
f is one-one if every horizontal line meets the graph at most once. f is onto its codomain if every horizontal line at a height in the codomain meets the graph at least once. So f is bijective if every such line meets it exactly once.
Figure 4. Horizontal line test: x² fails, the cubic passes
The line y=4 meets y=x2 at x=−2 and x=2, so x2 on R is not one-one. Every horizontal line meets y=x3/3 exactly once, so this cubic is one-one and onto R.
Function
One-one?
Onto?
Verdict
2x+3, R→R
yes
yes
bijective
x2, R→R
no: f(2) = f(−2)
no: −1 is never hit
neither
x2, [0,∞)→[0,∞)
yes
yes
bijective
∣x∣, R→R
no: |−3| = |3|
no: range is [0, ∞)
neither
Changing the domain or codomain changes the answer
The same formula x2 is neither one-one nor onto on R→R, but bijective on [0,∞)→[0,∞). This is exactly how x2 gets an inverse in Chapter 5.
2.3Bounded functions
Definition
f:D→R is bounded if there are numbers m and M with m≤f(x)≤M for all x∈D. Otherwise f is unbounded.
Example 3: a bounded function
Is f:R→R, f(x)=x2+11 bounded?
x2+1≥1 for every x, so x2+11≤1.
It is also positive, so 0≤f(x)≤1 for all x.
Answer: bounded, with m = 0 and M = 1.
Example 4: an unbounded function
Is f:(0,∞)→R, f(x)=x1 bounded?
Suppose f(x)≤M for all x>0.
Take x=M+11, which lies in (0,∞). Then f(x)=M+1>M, a contradiction.
Answer: unbounded.
Figure 5. A bounded function and an unbounded one
A small gap (extra remark).x=M+11 is positive only if M>−1. If someone proposes M≤−1, even easier: f(1)=1>M. Either way no upper bound works.
2.4Monotonic functions
Definition
Increasing: x≤y⇒f(x)≤f(y) for all x, y in the domain. Decreasing: x≤y⇒f(x)≥f(y).
In simple words
Increasing: the graph never goes down as you move right. Decreasing: it never goes up.
Example 5: increasing or decreasing?
(a) f(x)=x2 on [0,∞). (b) f(x)=7−4x on R. (c) f(x)=∣x∣ on R.
(a) 0≤x≤y⇒x2≤y2: increasing.
(b) x≤y⇒−4y≤−4x⇒7−4y≤7−4x, that is f(y)≤f(x): decreasing.
(c) −3≤−2 but f(−3)=3≥2=f(−2), so not increasing; 2≤3 and f(2)=2≤3=f(3), so not decreasing: neither.
Note on the source. The lecture notes remark that monotonicity is hard to check without differentiability (a later topic). NCERT calls the strict versions (< instead of ≤) "strictly increasing / decreasing"; a strictly monotonic function is always one-one.
2.5Arithmetic of functions
In simple words
Functions can be added, subtracted, multiplied and divided pointwise: do it to the outputs at the same x.
Operation
Definition (f, g : A → ℝ)
Sum
(f+g)(x)=f(x)+g(x)
Difference
(f−g)(x)=f(x)−g(x)
Product
(fg)(x)=f(x)g(x)
Quotient
(gf)(x)=g(x)f(x), only where g(x)=0
Example 6: difference of two functions
f(x)=x3+5x+1 and g(x)=3x2+2x+5. Find (f−g)(x).
(f−g)(x)=(x3+5x+1)−(3x2+2x+5).
Subtract term by term: x3−3x2+3x−4.
Answer: x³ − 3x² + 3x − 4.
2.6Going deeper
Strictly monotonic ⇒ one-one. If x<y forces f(x)<f(y), two different inputs can never share an output. That is why ax (Chapter 3) passes the horizontal line test.
Onto depends on the codomain you announce.∣x∣ is onto if you write it as R→[0,∞), but not as R→R.
Quotients shrink the domain (extra remark). For f(x)=x+1, g(x)=x−1: fg=x2−1 on all of R, but gf=x−1x+1 needs x=1.
Exam tips
One-one: give a counterexample pair to say "no"; use the algebra test to say "yes".
Onto: compare the range with the stated codomain.
Common mistakes
Saying x2 is one-one without checking the domain.
Forgetting to remove the zeros of g from the domain of f/g.
Laws of exponents, graphs of aˣ, growth and decay, and the number e.
3.1What is an exponential function?
In simple words
In x2 the base moves and the power is fixed. In 2x the base is fixed and the power (exponent) is the variable. Each step of 1 in x multiplies the value by the same factor.
Definition
An exponential function is f(x)=ax with base a>0. (If a=1 it is just the constant 1, so we normally take a=1.) Domain =R.
3.2Laws of exponents (NCERT)
Law
Example
ax⋅ay=ax+y
23⋅22=25=32
ayax=ax−y
2225=23=8
(ax)y=axy
(23)2=26=64
(ab)x=axbx
(2⋅3)2=4⋅9=36
a0=1
50=1
a−x=ax1
2−3=81
a1/n=na
41/2=2, 82/3=4
Exponential is not power.x2 (variable base, fixed power) and 2x (fixed base, variable power) are different kinds of function. For large x, 2x eventually beats any xn.
3.3Table of values and graph
x
−2
−1
0
1
2
3
2x
1/4
1/2
1
2
4
8
(1/2)x
4
2
1
1/2
1/4
1/8
Figure 6. Exponential growth (a > 1) and decay (0 < a < 1)
Every curve passes through (0, 1), stays above the x-axis and gets very close to it on one side: the x-axis is an asymptote. Left: bases 2 and 3 climb steeply. Right: bases 1/2 and 1/3 fall towards 0 as x grows. Note that (1/2)x=2−x: the decay curve is the growth curve flipped left to right.
3.4Properties of f(x) = aˣ
Property
a > 1
0 < a < 1
Domain
R
R
Range
(0,∞), always positive
(0,∞), always positive
Passes through
(0, 1) and (1, a)
(0, 1) and (1, a)
Behaviour
increasing: growth
decreasing: decay
As x→∞
ax→∞
ax→0
As x→−∞
ax→0
ax→∞
One-one?
yes
yes
Onto R?
no, range is only (0,∞)
no, range is only (0,∞)
The number e
The most important base is the irrational number e≈2.71828. The function ex is called the exponential function; it is the one whose slope at each point equals its own value (see the derivative topics). Since e>1, it is increasing.
3.5Going deeper
One-one solves equations (extra remark). Because ax is one-one, au=av⇒u=v. So 2x+1=32=25 gives x+1=5, x=4.
Growth by a percentage is exponential (extra remark). 10% growth a year multiplies by 1.1 each year, so after t years the amount is P×1.1t; halving each hour gives P×(1/2)t.
Comparing values. Same exponent, bigger base wins when the exponent is positive: 23=8<33=27. With a base below 1, a larger exponent gives a smaller value: (1/2)3<(1/2)2.
Exam tips
Write both sides with the same base before comparing exponents.
Remember the range (0,∞): ax is never 0 or negative.
Common mistakes
Treating 2x like x2.
Writing axay=axy.
Forgetting that a0=1, so every graph passes through (0, 1).
g ∘ f, why the order matters, the domain of a composite, and breaking a function into parts.
4.1Chaining two functions
In simple words
Feed the output of one machine into another: first f, then g. It is written g∘f and read "g of f": the function on the right is applied first.
Figure 7. A composite as two machines in a row
Definition
Let f:D1→R and g:D2→R with range(f) ⊂ D2. The composition is
g∘f:D1→R,(g∘f)(x)=g(f(x))
The condition range(f) ⊂ D2 says every output of f is an allowed input of g.
Example 7: compose x² and 3x³ + 2x
f(x)=x2 and g(x)=3x3+2x. Find (g∘f)(x).
(g∘f)(x)=g(f(x))=g(x2): replace every x in g by x2.
=3(x2)3+2x2=3x6+2x2.
Answer: 3x⁶ + 2x².
Example 8: find a from f(f(x))
f(x)=x+ax for x>0, a>0. If f(f(x))=3x+4x, find a.
f(f(x))=f(x)+af(x)=x+ax+ax+ax
Multiply top and bottom by x+a: x+a(x+a)x=(1+a)x+a2x
Compare with 3x+4x: 1+a=3 and a2=4, so a=2 (both hold; a=−2 is ruled out by a>0).
Answer: a = 2.
Check (extra remark). With a=2 and x=1: f(1)=1/3, then f(1/3)=1/3+21/3=71, and 3+41=71. ✓
4.2Order matters
g ∘ f is usually not f ∘ g
Changing the order changes the function: composition is not commutative. With f(x)=x+1 and g(x)=x2: (g∘f)(x)=(x+1)2 but (f∘g)(x)=x2+1. At x=3 these are 16 and 10.
4.3Domain of a composite (NCERT)
In simple words
For g∘f, x must be allowed in f and f(x) must be allowed in g.
Example: f(x)=x, g(x)=x−4. Then g∘f=x−4 needs only x≥0, so its domain is [0,∞); but f∘g=x−4 needs x≥4, domain [4,∞).
4.4Breaking a function into pieces (NCERT)
In simple words
Most formulas are compositions. Look for an "inside" (done first) and an "outside" (done last).
h(x)
Inside f
Outside g
(3x+1)5
3x+1
u5
ex2
x2
eu
x2+1
x2+1
u
Three functions. Composition is associative: h∘(g∘f)=(h∘g)∘f, so h(g(f(x))) is unambiguous: apply f, then g, then h. The identity I(x)=x satisfies f∘I=I∘f=f.
Note on the source. The lecture notes give the definition, Example 7 and the f(f(x)) question (answer 2). The domain rule, decomposition, associativity and identity are NCERT additions.
4.5Going deeper
Read from the inside out. To evaluate (g∘f)(2), compute f(2) first, then apply g to that number.
Why the range condition matters (extra remark). With f(x)=x−4 and g(x)=x, the output f(1)=−3 is not a valid input of g; that is why g∘f=x−4 loses all x<4.
Decomposing helps later. The chain rule for derivatives works on exactly this inside/outside split.
Exam tips
Substitute the whole inner expression, in brackets, for every x in the outer function.
State the domain: inner allowed, and inner output allowed in the outer.
When an inverse exists, how to find it, its graph, and the inverse of a composite.
Note on the source. Inverse functions are not in the supplied lecture notes; this chapter follows the standard NCERT treatment of invertible functions, and links back to Chapters 2 to 4.
5.1The idea
In simple words
The inverse of a function undoes it. If f turns x into y, then f−1 turns y back into x. f(x)=2x+3 doubles then adds 3; its inverse subtracts 3 then halves.
Definition
If f:A→B is bijective, its inverse is the function f−1:B→A with
f−1(f(x))=x(x∈A),f(f−1(y))=y(y∈B)
Equivalently f(x)=y⟺x=f−1(y). Domain and range swap: domain(f−1) = range(f), range(f−1) = domain(f).
Not the reciprocal!f−1(x) means the inverse function, not f(x)1. For f(x)=2x+3, f−1(x)=2x−3, but f(x)1=2x+31.
5.2When does an inverse exist?
In simple words
To undo f, each output must come from one input only (one-one), and every element of the codomain must be used (onto). So: inverse exists ⇔ f is bijective. Use the horizontal line test of Chapter 2.
5.3How to find the inverse
Write y=f(x).
Solve this equation for x in terms of y.
Swap the letters: replace y by x. The result is f−1(x).
State the domain and range (they swap).
Worked through for f(x)=2x+3: y=2x+3⇒x=2y−3, so f−1(x)=2x−3. Check: f−1(f(x))=2(2x+3)−3=x. For h(x)=x3+5 (range R, Example 2): x3=y−5, so h−1(x)=3x−5; indeed h(2)=13 and 313−5=2.
5.4Graph of the inverse
In simple words
If (a,b) is on the graph of f, then (b,a) is on the graph of f−1. Swapping coordinates reflects the graph in the line y=x.
Figure 8. A function and its inverse are mirror images in y = x
f(x)=2x and f−1(x)=log2x: the point (2, 4) on 2x becomes (4, 2) on log2x, since 22=4⟺log24=2.
5.5Important inverse pairs
Function
Inverse
Condition
ax, R→(0,∞)
logax
a>0,a=1; ex↔lnx
x3
3x
all of R
x2 on [0,∞)
x
domain must be restricted
ax+b (a=0)
ax−b
always
Figure 9. Restricting x² to [0, ∞) makes it invertible
Restricting the domain
x2 on R fails the horizontal line test. Restrict it to [0,∞), where it is bijective onto [0,∞), and the inverse x exists. The same trick works for ∣x∣ or any function that is not one-one.
5.6Inverse of a composite
Rule: reverse the order
If f and g are bijective, then
(g∘f)−1=f−1∘g−1
Like shoes and socks: you put on socks (f) then shoes (g), so you take off shoes (g−1) first, then socks (f−1). Check with f(x)=2x, g(x)=x+3: g∘f=2x+3, whose inverse is 2x−3; and f−1(g−1(x))=2x−3. ✓
5.7Going deeper
Fractions work the same way (extra remark).f(x)=x−32x+1: y(x−3)=2x+1⇒x(y−2)=3y+1, so f−1(x)=x−23x+1, x=2. Check: f(4)=9 and f−1(9)=28/7=4.
The excluded values swap too. f above needs x=3 and never outputs 2; its inverse needs x=2 and never outputs 3.
ex has an inverse only onto (0,∞). As a map R→R it is not onto, so lnx is defined only for x>0.
Exam tips
Check one-one and onto (or the horizontal line test) before finding an inverse.
Verify with one number: f(a) = b, then f−1(b) should give a.
Common mistakes
Writing f−1(x)=1/f(x).
Giving x as the inverse of x2 on all of R.
Reversing a composite without reversing the order.
Everything in Week 5 on one sheet, for a last-minute revision.
Formula sheet at a glance
Functions
GraphΓ(f)={(x,f(x))∣x∈X}
One-onef(x1)=f(x2)⇒x1=x2
Bounded and monotonic
Boundedm≤f(x)≤M
Increasingx≤y⇒f(x)≤f(y)
Exponents
Productaxay=ax+y
Power(ax)y=axy
Negativea−x=ax1
Composite
Definition(g∘f)(x)=g(f(x))
Inverse
Undof−1(f(x))=x
Composite(g∘f)−1=f−1∘g−1
Key definitions
Domain of a formula
Allowed inputsdenominator=0,≥0,log>0
Use whenNo domain is given and you must find the largest one.
List every denominator, even root and log.
Write the condition for each.
Intersect the conditions.
Examplex−3
x−3≥0⇒[3,∞)
One-one and onto
One-onef(x1)=f(x2)⇒x1=x2
Ontorange=codomain
Use whenYou must decide if f is injective, surjective or bijective.
Horizontal line test, or the algebra test.
For "no", give one counterexample.
Compare the range with the codomain.
Examplex2 on R.
(−2)2=22⇒not one-one
Exponential function
Formf(x)=ax,a>0,a=1
Range(0,∞)
Use whenThe variable is in the exponent: growth, decay, compound interest.
a > 1: increasing; 0 < a < 1: decreasing.
Every graph passes through (0, 1).
Same base on both sides ⇒ equal exponents.
ExampleSolve 32x=81.
32x=34⇒x=2
Composite
g of f(g∘f)(x)=g(f(x))
Use whenOne function is applied to the output of another.
Apply the right-hand function first.
Substitute it, in brackets, into the outer one.
Check range(f) ⊂ domain(g).
Examplef = x², g = 3x³ + 2x.
g(x2)=3x6+2x2
Inverse
Undo fy=f(x)⇒x=f−1(y)
Use whenYou must undo a bijective function.
Write y = f(x) and solve for x.
Swap x and y.
Swap domain and range; check with a number.
Examplef(x)=2x+3.
f−1(x)=2x−3
Tests and rules
Idea
Rule
Function
each input has exactly one output; f:A→B
Vertical line test
every vertical line meets the graph at most once
Horizontal line test
at most once ⇒ one-one; at least once ⇒ onto
Bounded
m≤f(x)≤M for all x
Increasing / decreasing
x≤y⇒f(x)≤f(y) / f(x)≥f(y)
Exponential
ax: domain R, range (0,∞), through (0, 1); a > 1 growth, 0 < a < 1 decay
Composite
needs range(f) ⊂ domain(g); not commutative; associative
Inverse
exists iff bijective; graph mirrored in y=x
Values worked in the lectures
Question
Answer
Is {(1, a), (2, b), (3, a), (1, b)} a function?
no
Range of x2; of x3+5
[0,∞); R
1/(x2+1); 1/x on (0,∞)
bounded (0 to 1); unbounded
x2 on [0,∞), 7−4x, ∣x∣
increasing, decreasing, neither
(f−g)(x) for x3+5x+1 and 3x2+2x+5
x3−3x2+3x−4
g∘f for f=x2, g=3x3+2x
3x6+2x2
f(f(x))=3x+4x for f=x+ax
a = 2
Which tool when?
"Is this a function?" → vertical line test.
"Is it one-one? Does it have an inverse?" → horizontal line test.
"Apply one, then the other" → composition, right-hand function first.
"Undo it" → inverse: solve for x, swap.
Source notes
The lecture notes (Calculus of one variable) cover function, domain, range, graph, types, floor/ceiling/modulus, bounded, monotonic, arithmetic of functions and composition.
The line tests, the details of exponential functions and inverse functions are not in the lecture notes; they follow the standard NCERT Class 11 and 12 treatment, and those sections are marked (NCERT).
The lecture notes allow any a>0 for ax; for a=1 it is constant, so these notes say a=1 where it matters.
Increasing and decreasing are defined with ≤ and ≥ (non-strict); NCERT's strict versions are mentioned in Chapter 2.
The source's extra practice questions are not reproduced; a few of their ideas appear as short worked illustrations and extra remarks, each checked by computation.
Revision overview
Functionsone input → one output range ⊂ codomain vertical line test
Propertiesone-one, onto, bijective horizontal line test bounded, monotonic
Exponentialaˣ, a > 0, a ≠ 1 range (0, ∞), through (0, 1) growth or decay
FunctionsMathematics for Data Science 1
Composite(g ∘ f)(x) = g(f(x)) right-hand first g ∘ f ≠ f ∘ g
Inverseexists iff bijective solve for x, swap mirror in y = x
Pairsaˣ ↔ logₐ x x² on [0, ∞) ↔ √x (g ∘ f)⁻¹ = f⁻¹ ∘ g⁻¹