Neural Sync Active
Functions and Their Types
Registry Synced
Functions and Their Types
3079 words
15 min read
Reading compass
Now ยท ๐ฏ Learning Objectives
Functions and Their Types
๐ฏ Learning Objectives
By the end of this topic, you will be able to:
- Distinguish a function from a general relation using the one-input-one-output rule
- Identify the domain, codomain, and range of a function
- Determine whether a function is injective, surjective, or bijective
- Apply the vertical line test to graphs
- Compute function values, including piecewise-defined functions
- Perform arithmetic operations on functions
๐ Prerequisites
- Sets and Set Operations โ sets, elements, set-builder notation
- Relations โ binary relations, domain, range, ordered pairs
๐ Core Content
3.1 Intuition: What Is a Function?
A function is a machine that takes an input and produces exactly one output. You put a number into the "square" machine, and it spits back its square. The machine is deterministic: same input always gives same output.
Think of a vending machine: you press one button (input), and exactly one item comes out (output). If pressing B3 sometimes gives chips and sometimes gives chocolate, it's not a functioning machine!
๐ก Why this matters: Functions are the building blocks of all mathematical modeling. In data science: every ML model is a function (features โ prediction), every transformation (normalize, scale, log-transform) is a function, every database query (SQLSELECT) defines a function. (Diagram)
3.2 Formal Definition
3.2.1 Definition
Let A and B be non-empty sets. A function f from A to B, written f:AโB, is a relation fโAรB such that:
- Total: For every aโA, there exists bโB with (a,b)โf.
- Single-valued: If (a,b1โ)โf and (a,b2โ)โf, then b1โ=b2โ. If (a,b)โf, we write f(a)=b.
- Domain: The set A (all possible inputs)
- Codomain: The set B (all possible outputs, declared)
- Range (Image): {f(a)โฃaโA}โB (actual outputs)
โ ๏ธ Key point: All functions are relations, but not all relations are functions. A relation fails to be a function if some input has no output (not total) or some input has multiple outputs (not single-valued).
3.2.2 Worked Examples
Example 1.1 (Easy): Determine if f(x)=x2 is a function from R to R.
Step 1 โ Total: For every real x, x2 is a real number. โ
Step 2 โ Single-valued: Each x maps to exactly one x2. โ
Domain: R, Codomain: R, Range: {yโRโฃyโฅ0}=[0,โ)
Example 1.2 (Medium): Is y2=x a function y=f(x) from R to R?
Step 1: For x=4, y2=4โนy=2 or y=โ2.
This violates the single-valued condition โ one input gives two outputs.
Example 1.3 (Hard): Define f:ZโZ by f(n)=โn/2โ. Is this a function? Find its range.
Step 1 โ Total: Every integer n divided by 2 has a floor. โ
Step 2 โ Single-valued: Floor gives exactly one integer. โ
Range: For n=0, f(0)=0; n=1, f(1)=0; n=2, f(2)=1; n=3, f(3)=1; negative numbers follow similarly.
Range = Z (all integers appear: f(2k)=k, f(2k+1)=k).
3.3 Domain and Range
3.3.1 Finding Domain and Range
The domain of a function is the set of all valid inputs. The range is the set of all possible outputs.
Recipe for domain:
- Look for "problem" operations: division by zero, square roots of negatives, log of non-positive
- Exclude values that cause these problems Recipe for range:
- Determine the set of outputs the function produces
- Use graphs, inequalities, or algebraic analysis
3.3.2 Worked Examples
Example 2.1: Find the domain of f(x)=xโ31โ.
Step 1: Problem: denominator xโ3=0 โ undefined
Step 2: Exclude x=3
Domain: Rโ{3} or (โโ,3)โช(3,โ)
Example 2.2: Find the domain of g(x)=5โxโ.
Step 1: Problem: square root of negative โ undefined
Step 2: Need 5โxโฅ0โนxโค5
Domain: (โโ,5]
Example 2.3: Find the domain and range of h(x)=x2+11โ.
Step 1 โ Domain: Denominator x2+1โฅ1>0 for all real x. No problems.
Domain: R
Step 2 โ Range: x2+1โฅ1, so x2+11โโค1. Also always positive.
0<h(x)โค1
Range: (0,1]
3.4 Piecewise Functions
A piecewise function uses different rules for different parts of the domain.
x^2 & \text{if } x < 0 \\ 2x + 1 & \text{if } x \geq 0 \end{cases}
\begin{aligned} (f + g)(x) &= f(x) + g(x) \\ (f - g)(x) &= f(x) - g(x) \\ (f \cdot g)(x) &= f(x) \cdot g(x) \\ \left(\frac{f}{g}\right)(x) &= \frac{f(x)}{g(x)},\quad g(x) \neq 0 \end{aligned}
\boxed{\text{No โ not defined for negative inputs}}
\boxed{(-\infty, -2) \cup (-2, 2) \cup (2, \infty)}
\boxed{\text{Bijective}}
\boxed{\text{No โ not injective}}
\boxed{(0, \frac{3}{2}]}
\boxed{f(-1) = 0,\ f(2) = 2,\ f(5) = 11}
\boxed{30}
\boxed{\text{Bijective}}
\boxed{\text{No โ 1 is not in the range}}
\boxed{\text{Bijective}}
\boxed{(-3, 3)}
\boxed{\text{No โ pigeonhole principle}}$$ --- ## ๐ Cross-References - Previous topic: [Relations](sets-relations) โ functions are special relations - Next topic: [Coordinate Geometry](../week02/geom-coordinate-geometry.md) โ plotting functions geometrically - Deep dive: [Exponential Functions](../week05/functions-exponential.md), [Composite & Inverse Functions](../week05/functions-composite-inverse.md) in Week 5 - Across courses: BSMA1002 Stats 1 (probability distributions are functions); BSMA1003 Maths 2 (linear transformations are functions)
Join Discord
Previous1.2 RelationsNext2.1 Coordinate Geometry