10–12 min read Functions & Geometric Graphs Lesson 4 / 32
Part 1 — Mathematical Foundations

Lesson 14.4 — Functions & Graphs

Mapping Inputs to Outputs: Domain and Range, the Cartesian coordinate plane, function taxonomy, the vertical line test, and AI activation functions

What We Will Learn

Deepening our conceptual understanding of functions—the mathematical bedrock connecting inputs, algorithmic transformations, and geometric visualizations:

  • Formal definition of a function and deterministic input-output mappings
  • Function Notation f(x) and its equivalence to equation form y = f(x)
  • Precision boundaries of Domain, Codomain, and Range
  • The Cartesian Coordinate Plane, origin, axes, and 4 Quadrants
  • Converting input-output tables into plotted curves on coordinate planes
  • Linear Functions (lines), Quadratic (parabolas), and Constant functions
  • The Vertical Line Test for geometric function validity verification
  • Software engineering functions: Pure functions vs. side effects
  • AI Activation Functions (ReLU, Sigmoid) enabling deep neural representation
  • 5 common misconceptions when working with functions and graphs

1 Introduction: How Input Translates to Output

Imagine you operate an online e-commerce platform where a product sells for a flat price of $500 per unit. The total amount charged to a customer depends completely on the number of items ordered.

Mathematical Model: y = 500x

x = Input (Units), y = Output (Dollars)
Order Quantity (Input x) Computation (500 × x) Total Payable (Output y) Coordinate Pair (x, y)
1 500 × 1 $500 (1, 500)
2 500 × 2 $1,000 (2, 1000)
3 500 × 3 $1,500 (3, 1500)
4 500 × 4 $2,000 (4, 2000)
5 500 × 5 $2,500 (5, 2500)

Notice that for every valid input, there is exactly one guaranteed output. In mathematics, this deterministic, predictable transformation rule is known as a Function. Whether calculating server network throughput, rendering vector graphics in games, or training artificial neural networks, functions are the universal building blocks of computation.

2 What is a Function?

A Function is a mathematical relationship where each valid element of an input set maps to exactly one distinct element of an output set.

The Function Machine Model
Input (x) x = 2
Function Rule f(x)
f(x) = 2x + 3
Multiply input by 2, then add 3
Output f(2) f(2) = 7
Inviolable Axiom of Functions:

A single input CANNOT produce multiple conflicting outputs. However, multiple distinct inputs CAN map to the exact same output.

✓ Valid Function: f(x) = x² f(2) = 2² = 4
f(−2) = (−2)² = 4
(Different inputs 2 and −2 produce identical output 4 — fully valid!)
✗ NOT a Function: y = ±√x If x = 4, then y = 2 and y = −2
(A single input 4 yields two distinct outputs — violates function definition!)

3 Function Notation

The universal shorthand for functions is f(x) (pronounced "f of x"). Here f designates the name of the function rule and x represents the input argument.

Two Equivalent Representations:

f(x) = 3x + 2   (Functional Notation)
y = 3x + 2       (Coordinate Equation Form)

When plotting curves, y and f(x) denote identical values: y = f(x). Note: f(x) does NOT mean f × x!

Function Evaluation:

For function f(x) = 3x + 2, evaluate f(4):

f(4) = 3(4) + 2
f(4) = 12 + 2
f(4) = 14
Input 4 produces output 14, establishing the geometric coordinate pair (4, 14).

4 Domain, Codomain, and Range

In computational mathematics, defining the allowable scope of inputs and outputs is vital for avoiding runtime exceptions and ensuring model validity:

4.1

Domain

The complete set of all legal input values for which the function is mathematically defined.

f(x) = 1 / x
x ≠ 0 (division by 0 undefined)
Domain = ℝ \ {0}
4.2

Codomain

The target set containing all possible designated values that outputs could potentially take.

f: ℝ → ℝ
Codomain = All Real Numbers (ℝ)
4.3

Range

The exact set of actual output values generated by evaluating the function across its domain.

f(x) = x² (where x ∈ ℝ)
Range = [0, ∞)
(squares are never negative)
Canonical Relationship: The Range is always a subset of the Codomain (Range ⊆ Codomain). In database schema terminology, the Codomain is the declared column type (e.g. `float64`), while the Range represents the actual bounds of stored data.

5 The Cartesian Coordinate Plane

Visualizing continuous functional behavior requires René Descartes' 2D Cartesian Coordinate Plane, constructed by intersecting two perpendicular number lines:

The two perpendicular axes establish an address system:

  • X-axis (Horizontal Abscissa): Represents the independent input values.
  • Y-axis (Vertical Ordinate): Represents the dependent output values.
  • Origin: The central intersection point with coordinates (0, 0).

Every point is an ordered pair (x, y). For instance, (2, 3) denotes 2 units right and 3 units up from the origin.

Quadrant x Sign y Sign Sample Point
Quadrant I + (Right) + (Up) (3, 4)
Quadrant II − (Left) + (Up) (-3, 4)
Quadrant III − (Left) − (Down) (-3, -4)
Quadrant IV + (Right) − (Down) (3, -4)

6 What is a Function's Graph?

The Graph of a function is the geometric locus formed by plotting all input-output ordered pairs (x, f(x)) on the Cartesian plane and joining them into a continuous curve.

Constructing the Graph of y = 2x + 1

Linear Graph

Plotting discrete coordinate points:

x = −2  →  y = 2(−2)+1 = −3  →  (−2, −3)
x = −1  →  y = 2(−1)+1 = −1  →  (−1, −1)
x =  0  →  y = 2(0)+1 = 1      →  (0, 1)
x =  1  →  y = 2(1)+1 = 3      →  (1, 3)
x =  2  →  y = 2(2)+1 = 5      →  (2, 5)
Key Insights from the Line:
  • Connecting these points produces an unbroken straight line.
  • Every 1 unit increase in x causes a constant 2 unit increase in y (Slope = 2).
  • The line intercepts the Y-axis at (0, 1) (Y-intercept = 1).

7 Taxonomy of Functions

Depending on algebraic structure and polynomial degree, functions exhibit distinctive geometric signatures:

7.1 Linear Function

Straight Line
f(x) = mx + c

Constant rate of change. Parameter m is the slope and c is the Y-intercept.

f(x) = 2x + 1

7.2 Quadratic Function

Parabola
f(x) = ax² + bx + c

Degree 2 polynomial generating a smooth U-shaped curve called a Parabola with a distinct vertex.

f(x) = x² − 4

7.3 Constant Function

Horizontal Line
f(x) = c

Output is entirely invariant regardless of input variations. Produces a flat horizontal line with slope 0.

f(x) = 5

8 The Vertical Line Test

The Vertical Line Test is an infallible visual test to determine whether a given geometric curve qualifies as a valid function.

Execution Principle:

Imagine sweeping a vertical straight line across the entire domain of a graph:

Valid Function (Passed) If every conceivable vertical line intersects the curve at at most one single point, the graph represents a valid function.
Examples: y = 2x + 1, y = x², y = x³
Not a Function (Failed) If any vertical line intersects the curve at two or more points, the relation is NOT a function (violates the single-output rule).
Examples: Circles (x² + y² = r²), sideways parabolas

9 Real-World & Computational Applications

Functions power modern software architectures, data science regressions, and machine learning neural models.

9.1 Cloud Infrastructure Cost Curves

Fixed cluster overhead of $2,000 plus $100 per container:

C(x) = 2000 + 100x  (Linear Cost Curve)

9.2 Data Trend Analysis & Regressions

Fitting mathematical curves across empirical scatter plots to identify customer churn and forecast revenue.

9.3 Python Functions: Pure Functions vs. Side Effects

# Pure mathematical function in Python
def calculate_order_total(quantity: int) -> float:
    unit_price = 500
    return quantity * unit_price  # Deterministic mapping without side effects

print(calculate_order_total(4))  # 2000

Like mathematical functions, a software routine that consistently returns identical results for identical arguments without mutating external state is called a Pure Function.

9.4 Activation Functions in AI: Non-Linearity

Without non-linear transformations, deep neural networks would collapse into simple linear regressions. Special non-linear functions called Activation Functions allow models to learn complex visual and linguistic representations:

ReLU (Rectified Linear Unit): f(x) = max(0, x)
Zeroes negative signals; passes positive signals directly.
Sigmoid Function: σ(x) = 1 / (1 + e−x)
Compresses any real number into a probability [0, 1].

10 5 Common Pitfalls in Functions & Graphs

Avoid these classic conceptual misconceptions:

Pitfall 1: Treating f(x) as Multiplication

f(x) ≠ f × x

f is the function name; x is the input argument.

Pitfall 2: Assuming All Relations are Functions

x² + y² = 25

A circle is not a function because single inputs yield two outputs.

Pitfall 3: Conflating Domain with Range

Domain = allowable inputs; Range = actual outputs produced.

They serve entirely different mathematical roles.

Pitfall 4: Inverting Coordinate Order

(2, 3) ≠ (3, 2)

The first value is always X; the second is always Y.

Hands-on Interactive Workbench

Functions & Graphs Laboratory

Simulate the function machine, test relations with the vertical line sweep, and experiment with AI activation curves.

Function Selection & Live Plotting

Select a function family, adjust input x, and watch the point trace along the coordinate curve in real time.

Function:
Blue Line: Function Curve | Red Dot: Current State (x, f(x))
Input Argument (x): 1.0
Evaluation Pipeline:
f(1.0) = 2(1.0) + 1
Output y = 3.0
Coordinates: (1.0, 3.0)

Lesson Summary (Key Takeaways)

  • ✓ Function: A deterministic mathematical rule relating every valid input to exactly one output value.
  • ✓ Domain and Range: The Domain is the complete set of legitimate inputs; the Range is the actual set of generated outputs.
  • ✓ Coordinate Plane & Graph: Plotting ordered pairs (x, y) on the Cartesian plane transforms algebraic expressions into visual geometric curves.
  • ✓ Function Diversity: Linear functions produce straight lines, Quadratic functions yield parabolas, and Constant functions form horizontal lines.
  • ✓ Vertical Line Test: If any vertical line intersects a graph in more than one point, the graph cannot represent a function.
  • ✓ AI Foundation: Deep neural networks are composite chains of functions; activation functions like ReLU and Sigmoid introduce the non-linearity necessary for complex pattern recognition.