1 Introduction: How the Language of Mathematics Works
We interact with numbers constantly in our everyday routines: reading a price tag, checking timestamps, calculating velocity, or measuring server latency. But in Computer Science and Artificial Intelligence, operating solely on fixed static numbers is rarely sufficient. We need systematic tools to represent unknown quantities, define dynamic relationships, and formulate real-world constraints into computable models.
Suppose a stationery shop sells pens at $10 each. Before arriving at the checkout counter, the exact quantity of pens you intend to purchase is unknown.
If you purchase 1 pen, the cost is $10. If you buy 5 pens, the cost is $50. If you buy 20 pens, it is $200. Rather than recalculating from scratch for every possible scenario, we synthesize an invariant mathematical rule:
Here, x represents a Variable. Whenever x is supplied with a specific integer, the exact total cost is evaluated deterministically.
This elementary example encapsulates the three cornerstone pillars of mathematical discourse:
Quantify concrete magnitudes, counts, or physical metrics (e.g., $10).
Hold placeholders for unknown, fluctuating, or parametric quantities (e.g., x pens).
Meaningful combinations of numbers, variables, and operators (e.g., 10x).
2 What Are Numbers? The Classification of Number Systems
A number is a fundamental abstraction used to quantify counts, measure physical properties, identify orders, and specify coordinates. In mathematics, numbers are partitioned into hierarchical sets, which directly mirror primitive data types in computer hardware and programming languages.
ℕ 2.1 Natural Numbers (Counting Numbers)
Discrete CountsThe positive integers used for counting discrete entities: 1, 2, 3, 4, 5, 6, .... When specifying loop iteration counts, thread pools, or page numbers, Natural Numbers are used.
𝕎 2.2 Whole Numbers (Non-Negative Integers)
Natural Numbers + ZeroAugmenting natural numbers with zero (0): 0, 1, 2, 3, 4, .... Array indexing in C, Python, and JavaScript begins at 0, which corresponds to whole numbers.
ℤ 2.3 Integers
Signed Whole NumbersAll whole numbers and their negative counterparts: ..., -3, -2, -1, 0, 1, 2, 3, .... Negative numbers represent direction, deficit, temperature below freezing (-5°C), or financial debt.
ℚ 2.4 Rational Numbers
Quotients of IntegersAny number that can be expressed as a ratio of two integers a / b (where b ≠ 0). Examples: 1/2, 3/4, -5/2, 7 (since 7 = 7/1). Terminating and recurring decimals such as 0.5 (1/2) and 0.333... (1/3) are strictly rational.
𝕀 2.5 Irrational Numbers
Non-Repeating Infinite DecimalsReal numbers that cannot be represented as simple fractions. Their decimal expansions are infinite and never repeat a predictable periodic pattern: √2 (≈ 1.41421...), √3, and π (≈ 3.14159...).
ℝ 2.6 Real Numbers
Union of Rational & IrrationalThe continuum of all values that can be mapped onto the continuous Number Line. Machine learning feature vectors, weights, biases, and continuous probability distributions reside in real number spaces (ℝn).
Set Inclusion Hierarchy
3 Fundamental Arithmetic Operations
Every computational algorithm executed on a CPU's Arithmetic Logic Unit (ALU) or a GPU tensor core fundamentally reduces to a combination of elementary arithmetic operations:
+
Addends → Sum
5 + 3 = 8. The operands are Addends and the resulting outcome is the Sum.
-
Minuend - Subtrahend
10 - 4 = 6. 10 is the Minuend, 4 is the Subtrahend, and 6 is the Difference.
× or *
Iterated Addition
4 × 3 = 12 (4 + 4 + 4 = 12). Used billions of times per second in matrix transformations and neural network inference.
÷ or /
Division by 0 is undefined
12 ÷ 3 = 4. Dividend (12), Divisor (3), and Quotient (4). Division by zero is undefined in mathematics and causes fatal runtime exceptions in code.
ab or **
Repeated Multiplication
23 = 2 × 2 × 2 = 8. 2 is the Base and 3 is the Exponent (Power).
%
Core CS Operator
17 ÷ 5 = 3 (remainder 2). In code: 17 % 5 = 2. Vital for hash indexing, parity checks, and circular buffer algorithms.
4 Variables and Constants
A Variable is an algebraic symbol that represents an unknown or changing quantity. In algebra, variables are conventionally denoted by letters such as x, y, z, a, b, t.
| Books Purchased (Variable x) | Computation ($200 × x) | Total Payable Price |
|---|---|---|
| 1 | 200 × 1 | $200 |
| 2 | 200 × 2 | $400 |
| 5 | 200 × 5 | $1,000 |
| 10 | 200 × 10 | $2,000 |
Variable
Values that vary across scenarios. In the physical equation for distance d = 60t, time t is an independent variable. Changing time changes the resulting distance d.
Constant
Values that remain fixed throughout an analysis. In the linear expression y = 5x + 10, 5 and 10 are constants because their magnitudes never change regardless of the value assigned to x.
5 What Is a Mathematical Expression?
A Mathematical Expression is any well-formed combination of numbers, variables, and operators that represents a computational value.
Coefficient: A numerical factor multiplied by a variable. In 5x, 5 is the coefficient of x. If no number precedes a variable (such as x), the implicit coefficient is 1.
Term: An individual constituent of an expression delineated by addition or subtraction operators. In 5x + 3, 5x is the variable term and 3 is the constant term.
Evaluating an Expression
Consider the expression E = 3x + 5:
- If x = 4: E = 3(4) + 5 = 12 + 5 = 17
- If x = 2: E = 3(2) + 5 = 6 + 5 = 11
- If x = 0: E = 3(0) + 5 = 0 + 5 = 5
6 Order of Operations: The PEMDAS / BODMAS Hierarchy
When an expression contains multiple chained operators, unambiguous evaluation requires universally agreed precedence rules.
2 + 3 × 4
Adding first: (2 + 3) × 4 = 5 × 4 = 20 (Incorrect!)
2 + 3 × 4
Multiplication takes precedence: 2 + (3 × 4) = 2 + 12 = 14 (Correct!)
Operator Precedence Pipeline (PEMDAS / BODMAS)
- 1. P Parentheses / Brackets: Evaluate internal sub-expressions first.
- 2. E Exponents / Powers: Calculate squares, square roots, and powers next.
- 3. MD Multiplication & Division: Equal priority; evaluated from left to right.
- 4. AS Addition & Subtraction: Equal priority; evaluated from left to right.
Because division and multiplication share equal precedence, evaluate left to right:
= (20 ÷ 5) × 2
= 4 × 2 = 8
7 Mathematical Variables vs. Programming Variables
While the term Variable is shared between pure mathematics and computer science, their conceptual models differ fundamentally:
| Criterion | Mathematical Variable | Programming Variable |
|---|---|---|
| Core Nature | An unknown, static, or symbolic value in an equation | A named memory address in physical RAM storing state |
| Meaning of '=' | Propositional equality (both sides are permanently equal) | Assignment statement (assign value of RHS to memory at LHS) |
| Statement 'x = x + 1' | Mathematically false and contradictory (has no solution) | Routine code pattern: increments the stored integer by 1 |
| Domain / Typing | Defined by mathematical sets (e.g., x ∈ ℝ) | Constrained by machine types (int32, float64, string) |
8 Mathematical Expressions in Production Software & AI
Mathematical expressions form the exact computational specifications executed across modern software and machine learning infrastructure:
R = p × q
Unit price p = $500 and volume q = 20 units yields gross revenue R = 500 × 20 = $10,000.
Mean = (x₁ + x₂ + ... + xₙ) / n
Test results of 70, 80, 90 evaluate to Mean = (70 + 80 + 90) / 3 = 240 / 3 = 80.
y = wx + b
Given input feature x = 4, learned weight w = 2, and bias b = 3: the model predicts y = 2(4) + 3 = 11.
🎮 Interactive Numbers, Variables & Expressions Workbench
Switch between the three interactive tabs below to test number classifications, step through PEMDAS operator precedence, and explore the linear regression equation behind AI.
Examine Which Sets Contain a Given Number
Select any preset number below to see which mathematical sets classify it.
Step-by-Step PEMDAS Evaluation
Select an expression to observe how mathematical precedence rules reduce it step by step.
Machine Learning Linear Prediction: y = wx + b
Adjust the weight (w) and bias (b) sliders to visualize how the model predicts output y for a given input x.
Lesson Summary
- ✓ Numbers serve as universal quantifiers; Natural, Whole, Integer, Rational, Irrational, and Real numbers correspond directly to computational data types.
- ✓ Beyond basic arithmetic, Exponentiation and Modulo (%) are core computational primitives essential for hashing, circular buffers, and scaling.
- ✓ A Variable encapsulates changing or unknown parameters, whereas a Constant remains immutable across evaluations.
- ✓ A Mathematical Expression is systematically constructed from Terms, Coefficients, Variables, and Constants.
- ✓ Evaluating multi-operator expressions requires strict adherence to the PEMDAS / BODMAS precedence pipeline (Parentheses → Exponents → Mult/Div → Add/Sub).
- ✓ Mathematical equality (=) denotes invariant propositional balance, distinct from programming variable assignment (=), which modifies physical memory state.