Glossary

Every term you'll encounter, defined clearly. Search, browse, and link back to lessons.

A
Assignmentprogramming foundations

The act of storing a value in a variable using the = operator.

let x = 10;  // assign 10
x = 20;      // reassign to 20

Assignment is the operation of binding a value to a variable name. In most languages, the `=` operator is used for assignment (not to be confused with `==` for equality comparison). Assignment can happen at declaration time or later.

Argumentprogramming foundations

The actual value passed to a function when it is called.

greet("Alice");
//    ^^^^^^^ argument

An argument is the concrete value supplied to a function when it is invoked. Arguments are matched to parameters by position (or by name in some languages). Example: in `add(3, 5)`, the values 3 and 5 are arguments passed to the parameters of the `add` function.

Arrayprogramming foundations

An ordered collection of values, each accessible by a numeric index.

const arr = [10, 20, 30];
arr[0]  // 10
arr.push(40);  // [10,20,30,40]
arr.length  // 4

An array (list in Python) is an ordered, indexed collection of elements. Elements can be of any type. Arrays are 0-indexed — the first element is at index 0. Arrays support operations like push/append, pop, slice, splice, and higher-order methods like map, filter, and reduce. They are the most commonly used data structure in programming.

Array Methodprogramming foundations

A built-in function on arrays like push, pop, map, filter, or reduce.

const a = [3, 1, 2];
a.push(4);     // mutates: [3,1,2,4]
a.sort();      // mutates: [1,2,3,4]
const b = a.map(x => x * 2); // new: [2,4,6,8]

Array methods are functions available on array objects that perform common operations. Mutating methods (push, pop, splice, sort) modify the array in place. Non-mutating methods (map, filter, reduce, slice, concat) return a new array or value without changing the original. Choosing between mutating and non-mutating methods affects code predictability.

Async/Awaitprogramming foundations

Syntax for writing asynchronous code that reads like synchronous code.

async function getData() {
  const res = await fetch("/api/data");
  const json = await res.json();
  return json;
}

async/await is syntactic sugar built on top of promises. An async function always returns a promise. The await keyword pauses execution inside the function until the awaited promise resolves, then returns the result. This lets you write asynchronous code in a top-to-bottom, try/catch style instead of chaining .then() callbacks.

Awaitprogramming foundations

A keyword that pauses an async function until a promise resolves.

async function main() {
  const data = await fetchData(); // pauses here
  console.log(data); // runs after promise resolves
}

The await keyword can only be used inside an async function. It pauses execution of that function until the promise it's waiting on settles. If the promise resolves, await returns the resolved value. If it rejects, await throws the rejection reason, which can be caught with try/catch. await makes async code sequential and readable.

Auxiliary Spacedata structures algorithms

Extra memory used by an algorithm beyond the input data.

// O(n) auxiliary space
const copy = [...arr];

// O(1) auxiliary space
let temp = arr[0];

Auxiliary space is the additional memory an algorithm allocates besides the input itself. Creating a new array of size n uses O(n) auxiliary space. A few variables use O(1). Merge sort uses O(n) auxiliary space; quicksort uses O(log n) for the call stack.

Adjacency Listdata structures algorithms

A graph representation where each vertex stores a list of its neighbors.

// Map<vertex, neighbors[]>
const graph = new Map();
graph.set("A", ["B", "C"]);
graph.set("B", ["A"]);
graph.set("C", ["A"]);

An adjacency list represents a graph as a map from each vertex to its list of neighbors. Space-efficient for sparse graphs: O(V + E). Looking up all neighbors of a vertex is O(degree). Most real-world graphs are sparse, making adjacency lists the preferred representation.

ACID Propertiesdatabases

Atomicity, Consistency, Isolation, Durability — guarantees for reliable transactions.

A — Atomic: transfer is all-or-nothing
C — Consistent: total balance unchanged
I — Isolated: concurrent transfers don't conflict
D — Durable: committed = permanent

ACID ensures transaction reliability. Atomicity: all-or-nothing. Consistency: transactions move the DB from one valid state to another. Isolation: concurrent transactions don't interfere. Durability: committed data survives crashes (written to disk). ACID is the foundation of relational databases.

Attention Mechanismdeep learning llms

A mechanism that lets models focus on relevant parts of the input when producing output.

# Attention(Q, K, V)
scores = Q @ K.T / sqrt(d_k)  # similarity
weights = softmax(scores)      # normalize
output = weights @ V           # weighted sum

Attention computes a weighted combination of all input positions. Each position queries all others to determine relevance. Scaled dot-product attention: Attention(Q,K,V) = softmax(QK^T/√d)V. Multi-head attention runs multiple attention computations in parallel with different learned projections.

Atomicitydatabases

The guarantee that all operations in a transaction succeed or none do.

BEGIN;
UPDATE accounts SET balance = balance - 50 WHERE id = 1;
UPDATE accounts SET balance = balance + 50 WHERE id = 2;
COMMIT;

Atomicity is the 'A' in ACID. It ensures a transaction is treated as a single, indivisible unit — either every operation within it is applied, or none are. If a failure occurs mid-transaction, all changes are rolled back to the previous consistent state.

Asynchronous I/Ooperating systems

I/O operations that let the program continue executing while waiting for completion.

const data = await fs.promises.readFile('data.json');
const [users, orders] = await Promise.all([
  fetch('/api/users'),
  fetch('/api/orders')
]);

Asynchronous I/O initiates an operation and returns immediately, allowing the program to perform other work. When the operation completes, the program is notified via callbacks, promises, or async/await.

At-Least-Once Deliverydistributed systems

A guarantee that a message will be delivered one or more times.

queue.onMessage(async (msg) => {
  if (await alreadyProcessed(msg.id)) return;
  await processOrder(msg.data);
  msg.ack();
});

At-least-once delivery ensures every message is delivered to the consumer, but duplicates may occur. Consumers must be idempotent to handle duplicates safely.

API Authenticationsystem design

Verifying the identity of a client making an API request.

fetch('/api/data', {
  headers: { 'Authorization': 'Bearer eyJhbGciOi...' }
});

API authentication ensures only authorized clients can access your API. Common methods include API keys, OAuth 2.0, and JWT.

API Gatewaysystem design

A single entry point that routes client requests to backend services.

// Without gateway: client calls each service
fetch('/user-service/profile');
// With gateway: single entry point
fetch('/api/profile');

An API gateway sits between clients and backend services, handling routing, authentication, rate limiting, and load balancing in one place.

Accuracymachine learning

The fraction of predictions a model gets correct out of all predictions.

predictions = [1, 0, 1, 1, 0]
actuals     = [1, 0, 0, 1, 0]
accuracy = sum(p == a for p, a in zip(predictions, actuals)) / len(actuals)

Accuracy is the simplest classification metric: correct predictions divided by total predictions. Can be misleading on imbalanced datasets.

Activation Functiondeep learning llms

A nonlinear function applied to a neuron's output to enable learning complex patterns.

import numpy as np
def relu(x): return np.maximum(0, x)
def sigmoid(x): return 1 / (1 + np.exp(-x))

An activation function introduces nonlinearity into a neural network. Common: ReLU (max(0,x)), Sigmoid (0-1), Softmax (probabilities summing to 1). ReLU is the default for hidden layers.

Alertingproduction engineering

Automated notifications triggered when system metrics cross defined thresholds.

if (errorRate > 0.05) {
  sendAlert('HIGH', `Error rate at ${errorRate * 100}%`);
}

Alerting fires notifications when monitored metrics exceed thresholds. Good alerts are actionable, specific, and avoid alert fatigue.

ALUcomputer hardware

The Arithmetic Logic Unit that performs math and logical operations inside the CPU.

// ALU operations map to code operators
const sum = a + b;      // ALU: ADD
const diff = a - b;     // ALU: SUB
const result = a & b;   // ALU: AND
const isEqual = a === b; // ALU: CMP

The ALU (Arithmetic Logic Unit) is the component within the CPU that performs arithmetic (add, subtract, multiply) and logical (AND, OR, NOT, compare) operations. It takes inputs from registers and writes results back.

Absolute Valuearithmetic

The non-negative distance of a number from zero on the number line.

Math.abs(-7);  // 7
Math.abs(7);   // 7

Absolute value measures how far a number is from zero, regardless of direction. It is written as |x| and always returns a non-negative result: |5| = 5 and |-5| = 5. Absolute value is fundamental to concepts like distance, error measurement, and magnitude.

Additionarithmetic

The arithmetic operation of combining two or more numbers to find their total.

let sum = 3 + 5;  // 8
let total = 1.5 + 2.3;  // 3.8

Addition is the fundamental operation of combining quantities. It is commutative (a + b = b + a) and associative ((a + b) + c = a + (b + c)). The result of addition is called the sum, and the identity element is zero (a + 0 = a).

Algebraic Expressionalgebra

A mathematical expression containing variables, constants, and arithmetic operations.

// Evaluate 3x + 2 for x = 5
let x = 5;
let result = 3 * x + 2;  // 17

An algebraic expression combines variables, numbers, and operations like addition, subtraction, multiplication, and division. Unlike an equation, it does not contain an equals sign. Examples include 3x + 2, x² - 5x + 6, and (a + b)/c. Expressions can be simplified by combining like terms and applying the distributive property.

Anglegeometry

A figure formed by two rays sharing a common endpoint called the vertex.

An angle is the measure of rotation between two rays (called sides) that share a common endpoint (called the vertex). Angles are measured in degrees (0 to 360) or radians (0 to 2pi). Common classifications include acute (less than 90 degrees), right (exactly 90 degrees), obtuse (between 90 and 180 degrees), and straight (exactly 180 degrees).

Arc Lengthgeometry

The distance along a curved section of a circle's circumference.

const arcLength = (radius, angleRadians) => radius * angleRadians;
arcLength(5, Math.PI / 3); // ~5.24

Arc length is the measure of the distance along a portion of a circle's circumference. It is calculated by the formula s = r * theta, where r is the radius and theta is the central angle in radians. For degrees, the formula is s = (theta / 360) * 2 * pi * r. Arc length is always positive and proportional to the central angle.

Areageometry

The measure of the two-dimensional space enclosed by a shape.

const rectangleArea = (l, w) => l * w;
const triangleArea = (b, h) => 0.5 * b * h;
const circleArea = (r) => Math.PI * r ** 2;

Area quantifies the amount of two-dimensional space inside a closed figure, measured in square units. Common formulas include: rectangle A = l * w, triangle A = (1/2) * b * h, and circle A = pi * r^2. Area is always non-negative and is additive, meaning the area of a composite shape equals the sum of its non-overlapping parts.

Axiomlogic proofs

A statement accepted as true without proof, serving as a starting point for reasoning.

An axiom (also called a postulate) is a foundational statement assumed to be self-evidently true, requiring no proof. Axioms form the basis upon which theorems are derived through logical deduction. Different axiomatic systems can lead to different mathematical frameworks. For example, Euclidean geometry is built on five axioms, and changing the parallel postulate yields non-Euclidean geometries.

Amplitudetrigonometry

The maximum displacement of a periodic function from its central axis.

// y = 3 * sin(x) has amplitude 3
const amplitude = 3;
const wave = (x) => amplitude * Math.sin(x);
// Oscillates between -3 and 3

Amplitude is the absolute value of the maximum vertical displacement of a trigonometric function from its midline (equilibrium position). For y = A * sin(Bx + C) + D, the amplitude is |A|. It determines the height of the wave: the function oscillates between D - |A| and D + |A|. Amplitude is always non-negative and represents the 'strength' or 'intensity' of the oscillation.

Angle Measuretrigonometry

The quantification of an angle's rotation, expressed in degrees or radians.

// Converting between degrees and radians
const toRadians = (deg) => deg * (Math.PI / 180);
const toDegrees = (rad) => rad * (180 / Math.PI);
toRadians(90);  // ~1.5708 (pi/2)

Angle measure quantifies the amount of rotation between two rays from their common vertex. The two standard units are degrees (a full rotation = 360 degrees) and radians (a full rotation = 2*pi radians). Angles can be positive (counterclockwise rotation) or negative (clockwise rotation). Understanding angle measure is essential for evaluating trigonometric functions and working with the unit circle.

Arcsinetrigonometry

The inverse function of sine, returning the angle whose sine is a given value.

// Math.asin returns radians in [-pi/2, pi/2]
Math.asin(0);   // 0
Math.asin(0.5); // ~0.5236 (pi/6 = 30 degrees)
Math.asin(1);   // ~1.5708 (pi/2 = 90 degrees)

Arcsine (sin^(-1) or asin) is the inverse of the sine function restricted to the domain [-pi/2, pi/2]. Given a value y in [-1, 1], arcsin(y) returns the unique angle theta in [-pi/2, pi/2] such that sin(theta) = y. Since sine is not one-to-one over its full domain, the restricted domain is necessary to make the inverse a proper function.

Arctangenttrigonometry

The inverse function of tangent, returning the angle whose tangent is a given value.

Math.atan(0);  // 0
Math.atan(1);  // ~0.7854 (pi/4 = 45 degrees)
Math.atan2(1, 1); // ~0.7854 (handles quadrant)

Arctangent (tan^(-1) or atan) is the inverse of the tangent function restricted to the domain (-pi/2, pi/2). Given any real number y, arctan(y) returns the unique angle theta in (-pi/2, pi/2) such that tan(theta) = y. Unlike arcsine and arccosine, arctangent accepts all real numbers as input. The two-argument form atan2(y, x) determines the angle in all four quadrants.

Asymptoteprecalculus

A line that a curve approaches but never touches as the input or output grows without bound.

// Rational function f(x) = 1/x has vertical asymptote x=0, horizontal asymptote y=0
function f(x) { return 1 / x; }
console.log(f(1000));   // 0.001 — approaching y=0
console.log(f(0.001));  // 1000  — diverging near x=0

An asymptote is a line that a graph of a function approaches arbitrarily closely but does not intersect or reach in the limiting case. Asymptotes can be vertical (where the function is undefined and diverges to infinity), horizontal (describing end behavior as x approaches positive or negative infinity), or oblique (a slanted line the curve approaches). They are essential for sketching rational functions and understanding limiting behavior.

Antiderivativecalculus

A function whose derivative equals a given function.

// Antiderivative of f(x) = 2x is F(x) = x^2 + C
function F(x, C = 0) {
  return x * x + C;
}

An antiderivative of f(x) is a function F(x) such that F'(x) = f(x). Every continuous function has infinitely many antiderivatives, each differing by an arbitrary constant C. The collection of all antiderivatives is called the indefinite integral.

Area Between Curvescalculus

The region enclosed between two functions, computed by integrating their difference.

// Area between f(x)=x^2 and g(x)=x on [0,1]
const n = 1000;
let area = 0;
const dx = 1 / n;
for (let i = 0; i < n; i++) {
  const x = i * dx;
  area += (x - x * x) * dx;
}
console.log(area); // ~0.1667

The area between curves f(x) and g(x) on [a, b] is the integral of |f(x) - g(x)| over that interval. When f(x) >= g(x) throughout, this simplifies to the integral of (f(x) - g(x)). Finding the bounds typically requires solving for intersection points.

Absolute Convergencecalculus 2

A series converges absolutely if the series of its absolute values also converges.

// Check absolute convergence of sum (-1)^n / n^2
function partialAbsSum(N) {
  let sum = 0;
  for (let n = 1; n <= N; n++) sum += 1 / (n * n);
  return sum;
}
console.log(partialAbsSum(1000)); // converges to pi^2/6

A series sum of a_n converges absolutely if the series sum of |a_n| converges. Absolute convergence implies ordinary (conditional) convergence, but the converse is not true. This distinction is important because absolutely convergent series can be rearranged in any order without changing the sum, a property that conditionally convergent series lack.

Alternating Seriescalculus 2

A series whose terms alternate in sign between positive and negative.

// Alternating harmonic series: sum (-1)^(n+1) / n
function altHarmonic(N) {
  let sum = 0;
  for (let n = 1; n <= N; n++) sum += Math.pow(-1, n + 1) / n;
  return sum;
}
console.log(altHarmonic(10000)); // approaches ln(2)

An alternating series has the form sum of (-1)^n * b_n where b_n > 0. The Alternating Series Test states that if the terms b_n are decreasing and approach zero, then the series converges. The error in approximating the sum by the first N terms is bounded by the absolute value of the (N+1)th term.

Addition Principlediscrete math

If two tasks are mutually exclusive, the total number of outcomes is the sum of the outcomes of each task.

// Shirts: 4 colors, Hats: 3 colors (pick one item)
const shirts = 4;
const hats = 3;
const choices = shirts + hats; // 7 ways to pick one item

The Addition Principle (Rule of Sum) states that if event A can occur in m ways and event B can occur in n ways, and the two events are mutually exclusive, then A or B can occur in m + n ways. This principle generalizes to any finite number of pairwise disjoint sets, forming the basis of combinatorial counting.

Adjacencydiscrete math

Two vertices in a graph are adjacent if they are connected by an edge.

// Adjacency list representation
const graph = {
  A: ['B', 'C'],
  B: ['A', 'D'],
  C: ['A'],
  D: ['B']
};
console.log(graph['A']); // ['B', 'C'] — neighbors of A

Adjacency describes the relationship between two vertices that share a common edge. In an adjacency matrix representation, entry (i, j) is 1 if vertices i and j are adjacent and 0 otherwise. For directed graphs, adjacency is directional: vertex u is adjacent to vertex v if edge (u, v) exists.

Archimedean Propertyreal analysis

For any real number x, there exists a natural number n greater than x.

// Demonstrate: for any x, find n > x
function archimedean(x) {
  return Math.ceil(x) + 1;
}
console.log(archimedean(3.7)); // 5
console.log(archimedean(1000000)); // 1000001

The Archimedean Property states that the natural numbers are unbounded within the real numbers: for every real number x, there exists a natural number n such that n > x. Equivalently, for any positive real numbers a and b, there exists a natural number n such that na > b. This property follows from the Completeness Axiom and rules out the existence of infinitesimal or infinitely large elements in the real number system.

Approaching Valueprecalculus

The value a function gets close to as x nears some point.

// Observe f(x) = (x^2 - 1)/(x - 1) as x approaches 1
for (let x of [0.9, 0.99, 0.999, 1.001, 1.01, 1.1]) {
  console.log(`f(${x}) = ${(x * x - 1) / (x - 1)}`);
}

An approaching value is the output a function tends toward as the input gets arbitrarily close to a specific point. The function itself may or may not actually reach that value at the point. This concept is the intuitive foundation for limits in calculus.

Arithmetic Sequenceprecalculus

A sequence with a constant difference between consecutive terms.

// Generate an arithmetic sequence
const a1 = 2, d = 3, n = 6;
const seq = Array.from({length: n}, (_, i) => a1 + i * d);
console.log(seq); // [2, 5, 8, 11, 14, 17]

An arithmetic sequence is an ordered list of numbers where each term is obtained by adding a fixed value, called the common difference, to the previous term. For example, 2, 5, 8, 11 has a common difference of 3. The nth term is given by a_n = a_1 + (n - 1)d.

Augmented Matrixlinear algebra

A matrix combining the coefficient matrix and constants column of a linear system.

// Represent the system 2x + y = 5, x - y = 1 as an augmented matrix
const augmented = [
  [2, 1, 5],
  [1, -1, 1]
];

An augmented matrix is formed by appending the constants vector as an extra column to the coefficient matrix of a linear system. This compact notation lets you apply row operations to the entire system at once. It is the standard starting point for Gaussian elimination and related solution methods.

B
Booleanprogramming foundations

A data type with only two values: true or false.

let on = true;
3 > 2   // true
1 === 2 // false

A boolean represents a logical value — either `true` or `false`. Booleans are the foundation of conditional logic. Comparison operators (`==`, `>`, `<`, etc.) return booleans. Named after mathematician George Boole.

Block Scopeprogramming foundations

Variables declared with let/const exist only within their enclosing {} block.

if (true) {
  let x = 10; // block-scoped
}
// x is NOT accessible here

Block scope means a variable is only accessible within the pair of curly braces `{}` where it was declared. In JavaScript, `let` and `const` are block-scoped (unlike `var`, which is function-scoped). Python does not have block scope — variables in if/for blocks are accessible in the enclosing function.

Base Caseprogramming foundations

The condition in a recursive function that stops the recursion.

function factorial(n) {
  if (n <= 1) return 1; // base case
  return n * factorial(n - 1);
}

A base case is the simplest instance of a problem that can be answered directly without further recursion. Every recursive function must have at least one base case. Without a base case, the function would call itself infinitely, causing a stack overflow. Common base cases: empty array, n <= 0, single element, null/leaf node.

Big O Notationdata structures algorithms

Mathematical notation describing the upper bound of an algorithm's growth rate.

O(1)     — hash lookup
O(log n) — binary search
O(n)     — linear scan
O(n²)    — nested loops

Big O notation (O) describes the worst-case growth rate of an algorithm. O(n) means the runtime grows linearly with input size. Big O drops constants (O(2n) = O(n)) and lower-order terms (O(n² + n) = O(n²)). It answers: 'How does this scale?' not 'How fast is this?'

Binary Treedata structures algorithms

A tree where each node has at most two children (left and right).

class TreeNode {
  constructor(val) {
    this.val = val;
    this.left = null;
    this.right = null;
  }
}

A binary tree restricts each node to at most two children: left and right. Binary trees are the foundation for binary search trees, heaps, and expression trees. A complete binary tree has all levels filled except possibly the last. A balanced binary tree has roughly equal left and right subtree heights.

Binary Search Treedata structures algorithms

A binary tree where left children are smaller and right children are larger.

      8
     / \
    3   10
   / \    \
  1   6    14
// search(6): 8→left→3→right→6 ✓

A BST maintains the invariant: for every node, all values in the left subtree are less, and all values in the right subtree are greater. This enables O(log n) search, insert, and delete (when balanced). Unbalanced BSTs degrade to O(n). Self-balancing variants (AVL, Red-Black) maintain O(log n).

Bubble Sortdata structures algorithms

A simple O(n²) sort that repeatedly swaps adjacent out-of-order elements.

for (let i = 0; i < n; i++)
  for (let j = 0; j < n-i-1; j++)
    if (arr[j] > arr[j+1])
      [arr[j], arr[j+1]] = [arr[j+1], arr[j]];

Bubble sort iterates through the array, swapping adjacent elements if they're in the wrong order. Largest elements 'bubble up' to the end. O(n²) average and worst case. Simple to understand but impractical for large datasets. Only useful as a teaching tool.

Breadth-First Searchdata structures algorithms

A graph traversal that explores all neighbors at the current depth before going deeper.

function bfs(graph, start) {
  const visited = new Set([start]);
  const queue = [start];
  while (queue.length) {
    const node = queue.shift();
    for (const neighbor of graph[node])
      if (!visited.has(neighbor)) {
        visited.add(neighbor);
        queue.push(neighbor);
      }
  }
}

BFS uses a queue to explore nodes level by level. Starting from a source node, it visits all neighbors first, then neighbors' neighbors, and so on. BFS finds the shortest path in unweighted graphs. Time: O(V + E). Space: O(V) for the queue and visited set.

Backtrackingdata structures algorithms

Exploring all possibilities by trying a choice, then undoing it if it doesn't work.

function permute(arr, path = []) {
  if (path.length === arr.length) return [path];
  const results = [];
  for (const n of arr)
    if (!path.includes(n))
      results.push(...permute(arr, [...path, n]));
  return results;
}

Backtracking is a DFS-based technique that incrementally builds candidates and abandons a candidate ('backtracks') as soon as it determines it can't lead to a valid solution. Used for constraint satisfaction: N-queens, Sudoku, permutations, and subset generation. Prunes invalid branches early.

Blocking I/Ooperating systems

I/O operations that halt the thread until the operation completes.

// Blocking: thread waits
const data = fs.readFileSync('file.txt');
console.log(data); // runs only after file is read

Blocking I/O stops the calling thread until data is available. The thread cannot do any other work while waiting. In a server, this means one thread per connection. Simple to program but wasteful — most time is spent waiting. readFileSync in Node.js is blocking.

B-Tree Indexdatabases

A balanced tree structure used by databases for efficient ordered lookups.

CREATE INDEX idx_orders_date ON orders(created_at);
SELECT * FROM orders WHERE created_at BETWEEN '2024-01-01' AND '2024-12-31';

A B-tree index is the most common index type in relational databases. It stores keys in a balanced, sorted tree where each node can have many children, keeping the tree shallow. This allows lookups, range scans, and ordered retrieval in O(log n) time.

Bufferingoperating systems

Temporarily storing data in memory during transfer between devices or processes.

const stream = fs.createReadStream('large-file.txt');
stream.on('data', (chunk) => {
  process.stdout.write(chunk);
});

Buffering collects data in a memory region before processing or transmitting it. This smooths out speed differences between producers and consumers.

Bulkheaddistributed systems

A pattern that isolates failures by partitioning resources into independent pools.

const paymentPool = createPool({ max: 10 });
const inventoryPool = createPool({ max: 10 });
// Payment outage won't exhaust inventory pool

The bulkhead pattern isolates components so that a failure in one does not cascade to others. Each service or dependency gets its own resource pool. If one pool is exhausted, the others continue operating.

Bully Algorithmdistributed systems

A leader election algorithm where the node with the highest ID wins.

// Node 3 detects leader down
node3.sendElection([node4, node5]);
// Node 5 responds -> takes over
// Node 5 broadcasts: I am the leader

The bully algorithm elects a leader by having each node compare IDs with higher-ranked nodes. When a node detects the leader is down, it sends election messages to all higher-ID nodes. If none respond, it becomes the new leader.

Bandwidthnetworking

The maximum amount of data that can be transferred over a connection per second.

// Fiber: 1 Gbps bandwidth, 5ms latency
// Satellite: 100 Mbps bandwidth, 600ms latency

Bandwidth is the capacity of a network link, measured in bits per second. More bandwidth means more data can flow simultaneously. Different from throughput (actual) and latency (delay).

Byte Pair Encoding (BPE)deep learning llms

A tokenization algorithm that iteratively merges the most frequent character pairs.

# BPE tokenization
# 'lower' -> ['low', 'er']
# 'lowest' -> ['low', 'est']

BPE starts with individual characters and repeatedly merges the most frequent adjacent pair. Common words become single tokens; rare words are broken into subword pieces.

Bayes' Theoremmathematics

A formula that updates the probability of an event based on new evidence.

const prior = 0.01;
const likelihood = 0.95;
const evidence = 0.05;
const posterior = (likelihood * prior) / evidence;

Bayes' Theorem calculates posterior probability: P(A|B) = P(B|A) * P(A) / P(B). Combines prior probability with likelihood of new evidence.

Blameless Postmortemproduction engineering

A structured review of an incident focused on learning, not assigning blame.

const postmortem = {
  title: 'DB connection pool exhaustion',
  impact: '2h downtime, 5000 users affected',
  rootCause: 'Missing connection timeout config',
  actionItems: ['Add pool timeout', 'Add monitoring']
};

A blameless postmortem covers timeline, root cause analysis, impact assessment, and action items without blaming individuals. Encourages honesty and surfaces systemic issues.

Branchgit version control

An independent line of development that diverges from the main codebase.

// git checkout -b feature-login
// make changes, commit
// git checkout main && git merge feature-login

A branch is a lightweight pointer to a commit that lets you work in isolation. The default branch is usually main. Branches are merged back when work is complete.

Binarycomputer hardware

A number system using only two digits, 0 and 1, that computers use internally.

// Decimal to binary
(13).toString(2); // "1101"
// Binary to decimal
parseInt("1101", 2); // 13

Binary (base-2) represents all data using only 0s and 1s. Each digit is a bit. Computers use binary because transistors have two states. The number 13 in binary is 1101 (8+4+0+1).

Bit & Bytecomputer hardware

A bit is a single 0 or 1; a byte is 8 bits that can represent values 0-255.

// 1 byte = 8 bits = values 0-255
const maxByte = 0xFF; // 255
const letter_A = 0x41; // 65
// 1 KB = 1024 bytes

A bit is the smallest unit of data. A byte (8 bits) can represent 256 different values (0-255). A kilobyte is 1024 bytes, a megabyte is 1024 KB, and so on. Characters, colors, and instructions are all stored as bytes.

BIOS / UEFIcomputer hardware

Firmware interfaces that initialize hardware and start the boot process.

// BIOS: legacy, 16-bit, MBR partitions, 2TB max
// UEFI: modern, 64-bit, GPT partitions, 9ZB max
// UEFI adds: Secure Boot, network boot, GUI setup

BIOS (Basic Input/Output System) is the legacy firmware standard. UEFI (Unified Extensible Firmware Interface) is its modern replacement. UEFI supports larger disks (GPT), faster boot, Secure Boot verification, and a graphical setup interface. Most modern PCs use UEFI.

Bootloadercomputer hardware

A small program that loads the operating system kernel into memory.

// Boot sequence
// Firmware -> finds bootloader on disk
// Bootloader -> loads kernel into RAM
// Kernel -> starts init system
// Init -> launches services and desktop

The bootloader (e.g., GRUB, Windows Boot Manager) is loaded by firmware and is responsible for finding and loading the OS kernel into RAM. It can present a menu for dual-boot systems and pass configuration parameters to the kernel.

Bare Metalcomputer hardware

Computing directly on hardware without an operating system or abstraction layer.

// At the bare metal level, everything is binary
// 10110001 00000101 = MOV AL, 5
// The CPU reads these bits directly

Bare metal refers to the raw physical hardware of a computer — transistors, logic gates, and circuits — before any software runs on it. Understanding bare metal helps you appreciate what operating systems and programming languages abstract away.

Basislinear algebra

A minimal set of linearly independent vectors that spans an entire vector space.

// A basis for R2
const e1 = [1, 0];
const e2 = [0, 1];
// Any 2D vector is a linear combination of e1, e2
const v = [3, 5]; // 3*e1 + 5*e2

A basis for a vector space V is a set of vectors {v1, v2, ..., vn} that are linearly independent and span V. Every vector in V can be written as a unique linear combination of the basis vectors. The number of vectors in any basis for V is always the same and defines the dimension of the space.

Bayesian Inferenceprobability stats

A method of updating probability estimates as new evidence becomes available using Bayes' theorem.

// Bayesian update: prior P(disease) = 0.01, test sensitivity = 0.95, specificity = 0.90
const prior = 0.01;
const sensitivity = 0.95;
const specificity = 0.90;
const pPositive = sensitivity * prior + (1 - specificity) * (1 - prior);
const posterior = (sensitivity * prior) / pPositive;
console.log(`Posterior probability: ${posterior.toFixed(4)}`);

Bayesian inference is a statistical framework that revises the probability of a hypothesis by combining prior beliefs with observed data through Bayes' theorem: P(H|D) = P(D|H)P(H)/P(D). Unlike frequentist methods, it treats parameters as random variables with distributions. The result is a posterior distribution that quantifies updated uncertainty after observing evidence.

Binomial Distributionprobability stats

A discrete probability distribution describing the number of successes in a fixed number of independent Bernoulli trials.

// P(exactly 3 heads in 5 fair coin flips)
function binomialPMF(n, k, p) {
  const comb = factorial(n) / (factorial(k) * factorial(n - k));
  return comb * Math.pow(p, k) * Math.pow(1 - p, n - k);
}
function factorial(x) { return x <= 1 ? 1 : x * factorial(x - 1); }
console.log(binomialPMF(5, 3, 0.5)); // 0.3125

The binomial distribution models the number of successes k in n independent trials, each with success probability p. Its probability mass function is P(X=k) = C(n,k) * p^k * (1-p)^(n-k). The mean is np and the variance is np(1-p), making it foundational for modeling binary outcomes like coin flips, defect rates, and A/B tests.

Bijectiondiscrete math

A function that is both injective (one-to-one) and surjective (onto), establishing a perfect pairing between two sets.

// Bijection between {0,1,2} and {'a','b','c'}
const f = { 0: 'a', 1: 'b', 2: 'c' };
const fInverse = { 'a': 0, 'b': 1, 'c': 2 };
console.log(f[1]); // 'b'
console.log(fInverse['b']); // 1

A bijection is a function f: A → B where every element of A maps to a unique element of B and every element of B is mapped to by exactly one element of A. Bijections prove that two sets have the same cardinality, which is the core technique behind combinatorial proofs: to show two counting expressions are equal, construct a bijection between the sets they count.

Bounded Sequencecalculus 2

A sequence with terms that stay between a lower and upper bound.

// The sequence a_n = 1/n is bounded: 0 < a_n <= 1
const a = (n) => 1 / n;
console.log([1,2,3,4,5].map(a)); // [1, 0.5, 0.333, 0.25, 0.2]

A sequence is bounded if there exist real numbers m and M such that m <= a_n <= M for all n. A sequence bounded above has an upper limit, and one bounded below has a lower limit. Boundedness is a key condition in convergence theorems, including the Monotone Convergence Theorem.

C
Constantprogramming foundations

A variable whose value cannot be reassigned after declaration.

const PI = 3.14159;
PI = 3; // TypeError!

A constant is a binding that, once assigned, cannot be reassigned to a different value. In JavaScript, `const` creates a constant binding (though object properties can still be mutated). In Python, constants are a convention (ALL_CAPS naming) rather than enforced by the language.

Conditionalprogramming foundations

A statement that executes different code based on whether a condition is true or false.

if (age >= 18) {
  "adult";
} else {
  "minor";
}

A conditional (if/else statement) allows a program to make decisions. It evaluates a boolean expression and executes one block of code if the condition is true, and optionally a different block if false. Conditionals are a fundamental control flow mechanism.

Control Flowprogramming foundations

The order in which statements are executed in a program.

// sequential → conditional → loop
if (ready) {
  for (let i = 0; i < 3; i++) { }
}

Control flow determines the order of execution of statements in a program. By default, code runs top-to-bottom (sequential). Control flow structures — conditionals (if/else), loops (for/while), and function calls — alter this order, allowing programs to make decisions, repeat actions, and organize code into reusable units.

Comparison Operatorprogramming foundations

An operator that compares two values and returns a boolean.

5 > 3    // true
5 === "5" // false (strict)
5 == "5"  // true (loose)

Comparison operators compare two values and produce a boolean result. Common operators: `==` (equal), `!=` (not equal), `>` (greater than), `<` (less than), `>=` (greater or equal), `<=` (less or equal). JavaScript also has `===` (strict equality, checks type and value).

Call Stackprogramming foundations

A data structure that tracks which functions are currently executing.

function a() { b(); }
function b() { c(); }
// stack: [a] → [a, b] → [a, b, c]

The call stack is a stack data structure that the runtime uses to track function calls. When a function is called, a new frame is pushed onto the stack. When the function returns, its frame is popped off. The stack tracks the chain of execution so the program knows where to return to. Stack overflow occurs when the stack grows too large (often from infinite recursion).

Closureprogramming foundations

A function that remembers variables from its outer scope even after the outer function returns.

function makeCounter() {
  let count = 0;
  return () => {
    count++;
    return count;
  };
}
const c = makeCounter();
c(); // 1
c(); // 2

A closure is created when a function is defined inside another function and references variables from the outer function's scope. The inner function 'closes over' those variables, retaining access even after the outer function has finished executing. Closures are the mechanism behind private state, factory functions, and React hooks.

Callbackprogramming foundations

A function passed as an argument to another function, to be called later.

[1, 2, 3].forEach(function(n) {
  console.log(n);  // callback invoked 3 times
});

setTimeout(() => console.log("done"), 1000);

A callback is a function passed into another function as an argument, which is then invoked inside the outer function. Callbacks are used extensively in array methods (`arr.map(callback)`), event handlers (`button.onClick(callback)`), and asynchronous operations. The term 'callback' emphasizes that you're passing code to be 'called back' at the appropriate time.

Concatenationprogramming foundations

Joining two or more strings together into one string.

"hello" + " " + "world" // "hello world"
`${first} ${last}`       // template literal

Concatenation is the operation of joining strings end-to-end. In JavaScript, use the + operator or template literals. In Python, use + or f-strings. Repeated concatenation in loops is inefficient — use array.join() (JS) or str.join() (Python) instead for building strings from many parts.

Concurrencyprogramming foundations

Managing multiple operations that overlap in time.

// Concurrent: both start immediately
const [a, b] = await Promise.all([
  fetchUsers(),
  fetchPosts()
]); // total time = max of the two

Concurrency means multiple tasks make progress within overlapping time periods. In JavaScript, concurrency is achieved through the event loop (single-threaded but non-blocking). Promise.all() runs multiple async operations concurrently. Concurrency is NOT the same as parallelism (which requires multiple threads/cores). JavaScript is concurrent but not parallel (in the main thread).

Classprogramming foundations

A blueprint for creating objects with shared properties and methods.

class User {
  constructor(name) {
    this.name = name;
  }
  greet() {
    return `Hi, ${this.name}`;
  }
}
const u = new User("Alice");

A class defines the structure (properties) and behavior (methods) shared by all objects of a certain type. Classes support encapsulation (bundling data with methods), inheritance (child classes extend parent classes), and polymorphism (overriding methods). In JavaScript and Python, classes are syntactic sugar over prototypal/object-based inheritance.

Constructorprogramming foundations

A special method that initializes a new instance when the class is instantiated.

class Dog {
  constructor(name, breed) {
    this.name = name;
    this.breed = breed;
  }
}
const d = new Dog("Rex", "Lab");

A constructor is the method called automatically when a new instance of a class is created. In JavaScript, it's the `constructor()` method. In Python, it's `__init__()`. The constructor typically assigns initial property values using the arguments passed to `new ClassName(args)`. Every class can have at most one constructor.

Constant Timedata structures algorithms

An operation that takes the same time regardless of input size — O(1).

arr[5]        // O(1)
map.get(key)  // O(1) average

A constant-time operation completes in a fixed number of steps no matter how large the input. Array access by index, hash map lookup, pushing to a stack — all O(1). Constant time is the best possible time complexity.

Cycle Detectiondata structures algorithms

Determining whether a graph contains a cycle (a path that loops back to itself).

// Directed graph cycle detection
// Visit states: unvisited, in-progress, done
// If we visit an in-progress node → cycle!

A cycle exists when you can follow edges from a node and return to it. In undirected graphs, DFS detects cycles when visiting an already-visited node that isn't the parent. In directed graphs, a cycle exists if DFS finds a back edge (to a node in the current recursion stack). Used to detect deadlocks and circular dependencies.

Concurrency (OS)operating systems

Managing multiple tasks whose execution overlaps in time.

// Concurrent (single thread, interleaved)
await Promise.all([taskA(), taskB()]);

// Parallel (multi-core, simultaneous)
// Using worker threads

Concurrency means multiple tasks make progress in overlapping time periods. On a single core, this is achieved by rapid switching (time-slicing). Concurrency is not parallelism — concurrent tasks may not run simultaneously. JavaScript achieves concurrency through the event loop without parallelism.

Context Switchoperating systems

Saving one process's state and loading another's so the CPU can switch tasks.

// Context switch overhead
Process A running → save A's state → load B's state → Process B running
// Takes ~1-10 μs per switch

A context switch saves the current process's CPU registers, program counter, and memory mappings, then loads another process's state. Context switches enable multitasking but have overhead (typically 1-10 microseconds). Too many switches waste CPU time. Threads within the same process have lighter context switches than processes.

CAP Theoremdistributed systems

A distributed system can guarantee at most two of: Consistency, Availability, Partition tolerance.

CP systems: Zookeeper, etcd, Spanner
AP systems: Cassandra, DynamoDB, CouchDB

// During partition:
CP → reject writes to stay consistent
AP → accept writes, resolve conflicts later

The CAP theorem states that during a network partition, a distributed system must choose between consistency (all nodes see the same data) and availability (every request gets a response). Since partitions are inevitable, the real choice is CP (consistent but may reject requests) vs AP (available but may serve stale data).

Circuit Breakerdistributed systems

A pattern that stops calling a failing service to prevent cascade failures.

// State machine
Closed → [failures > threshold] → Open
Open → [timeout expires] → Half-Open
Half-Open → [success] → Closed
Half-Open → [failure] → Open

A circuit breaker monitors calls to a service. States: Closed (normal), Open (failing — reject immediately), Half-Open (test if recovered). After too many failures, the circuit opens and requests fail fast instead of waiting for timeouts. This prevents one failing service from taking down the entire system.

CI/CDproduction engineering

Continuous Integration and Continuous Deployment — automating build, test, and release.

# .github/workflows/ci.yml
on: push
jobs:
  build:
    steps:
      - run: npm install
      - run: npm test
      - run: npm run build

CI (Continuous Integration) automatically builds and tests code on every push. CD (Continuous Deployment) automatically deploys passing builds to production. Together, they enable fast, reliable releases. Tools: GitHub Actions, Jenkins, CircleCI. A CI/CD pipeline typically: lint → test → build → deploy.

Containerproduction engineering

A lightweight, isolated environment for running applications with all their dependencies.

# Dockerfile
FROM node:20-alpine
COPY . /app
WORKDIR /app
RUN npm install
CMD ["node", "server.js"]

A container packages an application with its dependencies, libraries, and configuration into a portable unit. Containers share the host OS kernel (lighter than VMs). Docker is the standard container runtime. Containers solve 'works on my machine' by ensuring identical environments from development to production.

Cache-Asidedatabases

A caching pattern where the application manages reading from and writing to the cache.

let user = cache.get(`user:${id}`);
if (!user) {
  user = await db.query('SELECT * FROM users WHERE id = $1', [id]);
  cache.set(`user:${id}`, user, { ttl: 300 });
}

In the cache-aside pattern, the application checks the cache first. On a cache miss, it reads from the database, stores the result in the cache, and returns it. On writes, the application updates the database and invalidates or updates the cache entry.

Cache Invalidationdatabases

The process of removing or updating stale data in a cache.

await db.query('UPDATE users SET name = $1 WHERE id = $2', [name, id]);
cache.del(`user:${id}`);

Cache invalidation ensures cached data stays consistent with the source of truth. Strategies include TTL expiration, event-driven invalidation (delete cache on write), and versioning.

Consensus Algorithmdistributed systems

A protocol that enables distributed nodes to agree on a single value.

leader.propose({ value: 'commit txn-42' });
if (votes >= majority) {
  leader.broadcast('COMMIT txn-42');
}

A consensus algorithm ensures that multiple nodes agree on a shared decision despite failures. Key properties: agreement, validity, and termination. Paxos and Raft are the most well-known examples.

Consistency Modelsdistributed systems

Rules defining what values a read can return after a write in a distributed system.

// Strong: read always sees latest write
await db.write('x', 10);
await db.read('x'); // always 10
// Eventual: may see stale value briefly

Consistency models specify the contract between a distributed data store and its clients regarding the visibility of writes. Models range from strong consistency to eventual consistency.

Consistency vs Availabilitydistributed systems

The fundamental trade-off forced by network partitions in distributed systems.

// CP: reject write during partition
if (!canReachMajority()) throw new Error('Unavailable');
// AP: accept write, reconcile later
await localReplica.write(data);

During a network partition, a distributed system must choose between consistency (reject requests) and availability (serve requests even if stale). This is the core trade-off described by the CAP theorem.

Cache Hit / Misssystem design

A cache hit finds the data in cache; a miss requires fetching from the source.

const cached = cache.get('user:123');
if (cached) return cached;  // HIT
const user = await db.query('SELECT...');  // MISS
cache.set('user:123', user);

A cache hit returns data instantly from cache. A cache miss means fetching from the slower origin. The hit rate is the key metric for cache effectiveness.

Caching Strategysystem design

A pattern that determines when and how data is stored in and read from a cache.

async function getUser(id) {
  let user = await cache.get(`user:${id}`);
  if (!user) {
    user = await db.findUser(id);
    await cache.set(`user:${id}`, user, { ttl: 300 });
  }
  return user;
}

Caching strategies define how data flows between cache and origin. Cache-aside: app checks cache first. Write-through: writes go to cache and DB simultaneously. Write-behind: writes go to cache, DB updated asynchronously.

CDNsystem design

A network of servers that delivers cached content from locations close to users.

// Without CDN: Tokyo -> origin in New York (~200ms)
// With CDN: Tokyo -> edge in Tokyo (~20ms)

A CDN caches static assets at edge servers worldwide. When a user requests a file, the nearest edge server responds instead of the origin, reducing latency.

Client-Serversystem design

An architecture where clients request services and servers provide them.

// Client
const res = await fetch('https://api.example.com/users');
// Server
app.get('/users', (req, res) => res.json(allUsers));

The client-server model splits computing into two roles: the client makes requests, and the server processes them and returns responses. Most web applications follow this model.

Cloud Pricingsystem design

The cost model used by cloud providers based on resource consumption.

const compute = hours * 0.10;
const storage = gbStored * 0.023;
const transfer = gbOut * 0.09;
const total = compute + storage + transfer;

Cloud pricing charges based on usage: compute (per hour), storage (per GB), network transfer (per GB out), and API calls (per request).

Cost Modelingsystem design

Estimating infrastructure expenses based on expected usage and architecture choices.

const lambdaCost = 1_000_000 * 0.0000002;
const apiGateway = 1_000_000 * 0.000001;
const total = lambdaCost + apiGateway;

Cost modeling projects how much your system will cost at various scales. You estimate compute, storage, network, and managed service costs, then model how they grow with traffic.

Cost Optimizationsystem design

Techniques for reducing cloud infrastructure costs without sacrificing performance.

const config = {
  minInstances: 2, maxInstances: 20,
  targetCPU: 70, cooldown: 300
};

Cost optimization minimizes cloud spending through right-sizing instances, using reserved capacity, caching, auto-scaling, and choosing the right storage tier.

Certificatenetworking

A digital document that proves a server's identity and enables encrypted connections.

const tls = require('tls');
const socket = tls.connect(443, 'example.com', () => {
  console.log(socket.getPeerCertificate().subject.CN);
});

A TLS/SSL certificate is issued by a Certificate Authority and binds a domain name to a public key. Browsers verify certificates to confirm server identity.

CRUD Operationsnetworking

The four basic data operations: Create, Read, Update, and Delete.

POST   /api/posts       // Create
GET    /api/posts/:id   // Read
PUT    /api/posts/:id   // Update
DELETE /api/posts/:id   // Delete

CRUD maps to HTTP methods: POST (create), GET (read), PUT/PATCH (update), DELETE (delete). In SQL: INSERT, SELECT, UPDATE, DELETE.

Classificationmachine learning

A supervised learning task that predicts which category an input belongs to.

model.fit(emails, labels)  # labels: 0=ham, 1=spam
prediction = model.predict(new_email)

Classification assigns discrete labels to inputs. Binary has two classes; multi-class has three or more. Evaluated with accuracy, precision, recall, and F1 score.

Clusteringmachine learning

Grouping data points by similarity without predefined labels.

from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=3)
kmeans.fit(data)
labels = kmeans.labels_

Clustering discovers natural groupings in data. K-means assigns each point to the nearest of K centroids. DBSCAN finds dense regions of arbitrary shape.

Confusion Matrixmachine learning

A table showing correct and incorrect predictions broken down by class.

#              Predicted
#            Pos    Neg
# Actual Pos [ TP=40, FN=10 ]
# Actual Neg [ FP=5,  TN=45 ]

A confusion matrix is a grid where rows represent actual classes and columns represent predicted classes. The four cells: TP, FP, TN, FN.

Cross-Entropy Lossmachine learning

A loss function measuring the gap between predicted probabilities and true class labels.

import numpy as np
y_true, y_pred = 1, 0.9
loss = -(y_true * np.log(y_pred) + (1 - y_true) * np.log(1 - y_pred))

Cross-entropy loss penalizes confident wrong predictions heavily. Formula: L = -[y*log(p) + (1-y)*log(1-p)]. Standard loss function for classification tasks.

Cross-Validationmachine learning

A technique that trains and evaluates a model on multiple data splits for reliable estimates.

from sklearn.model_selection import cross_val_score
scores = cross_val_score(model, X, y, cv=5)
print(f'Mean accuracy: {scores.mean():.3f}')

Cross-validation splits data into K folds, trains on K-1 folds, tests on the remaining, rotating K times. Gives a more reliable performance estimate than a single split.

Chain-of-Thoughtdeep learning llms

A prompting technique that asks the model to reason step-by-step before answering.

// Without CoT: 'What is 17 * 24?' -> often wrong
// With CoT: 'Think step by step.'
// 17*20=340, 17*4=68, 340+68=408

Chain-of-thought prompting instructs an LLM to show its reasoning process. This dramatically improves performance on math, logic, and multi-step reasoning tasks.

Context Windowdeep learning llms

The maximum number of tokens an LLM can process in a single input-output sequence.

// 128K token context window
system_prompt   =  500 tokens
conversation    = 3000 tokens
retrieved_docs  = 8000 tokens
// Remaining: ~116,500 tokens

The context window is the total token budget for both prompt and response. Modern models support 128K-1M+ tokens. Everything outside the window is invisible to the model.

Conditional Probabilitymathematics

The probability of an event occurring given that another event has already occurred.

const pBoth = 0.3;
const pCloudy = 0.5;
const pRainGivenCloudy = pBoth / pCloudy; // 0.6

Conditional probability P(A|B) = P(A and B) / P(B). Foundation of Bayes' Theorem and many real-world reasoning tasks.

Cosine Similaritymathematics

A measure of similarity between two vectors based on the angle between them.

const dot = 1*2 + 2*4;
const magA = Math.sqrt(1+4);
const magB = Math.sqrt(4+16);
const sim = dot / (magA * magB); // 1.0

Cosine similarity computes the cosine of the angle between two vectors, producing a value from -1 to 1. Widely used in text analysis and recommendations.

Cold Startproduction engineering

The initial delay when a serverless function is invoked after being idle.

// Cold: ~500ms+, Warm: ~5ms
export async function handler(event) {
  return { statusCode: 200, body: 'Hello' };
}

A cold start occurs when a serverless platform must provision a new container to handle a request, adding latency. Mitigate with warm pings, small bundles, or provisioned concurrency.

Continuous Deploymentproduction engineering

Automatically releasing every code change that passes tests to production.

const pipeline = {
  steps: ['lint', 'test', 'build', 'deploy'],
  deploy: { target: 'production', auto: true }
};

CD automatically deploys every change that passes the automated test suite directly to production. Requires high test confidence, feature flags, and robust rollback.

Continuous Integrationproduction engineering

Automatically building and testing code each time a developer pushes changes.

const ci = {
  on: 'push',
  jobs: ['install', 'lint', 'test', 'build'],
  failFast: true
};

CI automatically builds and tests on every merge to catch integration bugs early and ensure the codebase stays in a working state.

Commitgit version control

A snapshot of your project's staged changes saved to the Git history.

// git add index.js
// git commit -m 'Add login page'
// git log --oneline

A commit is a permanent snapshot with a unique SHA hash, author, timestamp, and message. Commits form a linked chain creating a navigable history.

Clonegit version control

Creating a local copy of a remote repository on your machine.

// git clone https://github.com/user/repo.git
// cd repo

Cloning creates a full local copy including all files, branches, and commit history. Automatically sets the remote as origin.

Code Reviewgit version control

The practice of having teammates examine your code changes before merging.

// Common review feedback:
// 'Consider extracting this into a helper'
// 'This could cause a null reference'

Code review inspects proposed changes for correctness, readability, security, and team standards. Catches bugs, shares knowledge, and improves code quality.

CI Checkgit version control

Automated tests and validations that run on every pull request.

// on: pull_request
// jobs: test, lint, build

CI checks are automated jobs (linting, testing, building) triggered by PR events. Teams often require all checks to pass before merging.

Cherry-Pickgit version control

Applying a single commit from one branch onto another.

// git cherry-pick a1b2c3d

Cherry-picking copies a specific commit and applies it to your current branch as a new commit with a different SHA but the same changes.

CPUcomputer hardware

The central processing unit that executes program instructions.

// Every line of code becomes CPU instructions
// a = b + c becomes:
// LOAD R1, [b]   <- fetch b into register
// LOAD R2, [c]   <- fetch c into register
// ADD R3, R1, R2 <- add them
// STORE [a], R3  <- save result

The CPU (Central Processing Unit) is the brain of a computer. It fetches instructions from memory, decodes them, and executes them in a cycle billions of times per second. Modern CPUs have multiple cores for parallel execution.

Clock Speedcomputer hardware

The rate at which a CPU executes instruction cycles, measured in GHz.

// 3 GHz = 3 billion cycles per second
// Each cycle: ~0.33 nanoseconds
// A simple ADD might take 1 cycle
// A memory access might take 100+ cycles

Clock speed (measured in GHz) determines how many cycles a CPU completes per second. A 3 GHz CPU performs 3 billion cycles per second. Higher clock speed means faster execution, but architecture and cache also matter greatly.

Cache Memorycomputer hardware

Small, fast memory between the CPU and RAM that stores recently accessed data.

// Cache-friendly: sequential access
for (let i = 0; i < arr.length; i++) {
  sum += arr[i]; // adjacent memory = cache hits
}
// Cache-unfriendly: random access
for (let i = 0; i < n; i++) {
  sum += arr[Math.floor(Math.random() * n)];
}

Cache memory (L1, L2, L3) sits between the CPU and RAM, storing copies of frequently accessed data. When the CPU needs data, it checks cache first (cache hit = fast). On a miss, it fetches from slower RAM. Modern CPUs have 3 levels of cache.

CPU Architecturecomputer hardware

The design and organization of a processor including its instruction set and components.

// x86: complex instructions (CISC)
// ARM: simple instructions (RISC)
// Both execute: fetch -> decode -> execute

CPU architecture defines how a processor is structured internally (ALU, registers, cache) and what instructions it can execute. x86 (Intel/AMD) and ARM (Apple/Qualcomm) are the two dominant architectures with different design philosophies.

Concurrency vs Parallelismoperating systems

Concurrency manages multiple tasks at once; parallelism runs multiple tasks simultaneously.

// Concurrency: one cook, switching between dishes
// Parallelism: multiple cooks, one dish each
await Promise.all([taskA(), taskB()]); // concurrent
// On multi-core: may run in parallel

Concurrency is about dealing with multiple things at once (structuring code to handle overlapping tasks). Parallelism is about doing multiple things at once (using multiple CPU cores simultaneously). Concurrency is a design pattern; parallelism is an execution model.

Common Denominatorarithmetic

A shared multiple of the denominators of two or more fractions.

// Adding 1/3 + 1/4 using LCD of 12
let result = (4/12) + (3/12);  // 7/12

A common denominator is a number that is a multiple of all denominators in a set of fractions, allowing them to be added or compared directly. The least common denominator (LCD) is the smallest such number. For example, to add 1/3 and 1/4, the LCD is 12.

Commutative Propertyarithmetic

The rule that the order of operands does not change the result of addition or multiplication.

3 + 5 === 5 + 3;  // true
4 * 7 === 7 * 4;  // true
9 - 3 === 3 - 9;  // false (not commutative)

The commutative property states that a + b = b + a for addition, and a * b = b * a for multiplication. This property does not hold for subtraction or division. It is one of the fundamental properties of arithmetic that simplifies computation and algebraic manipulation.

Coefficientalgebra

The numerical factor multiplied by a variable in an algebraic term.

// In the expression 3x² + 7x - 2:
// Coefficient of x² is 3
// Coefficient of x is 7
// -2 is the constant term

A coefficient is the number that multiplies a variable in a term. In the expression 5x, the coefficient is 5. If no number is written, the coefficient is implicitly 1 (as in x = 1x). Coefficients can be positive, negative, or fractional. Identifying coefficients is essential for combining like terms and solving equations.

Common Factoralgebra

A factor shared by two or more terms in an expression.

// Factor out the common factor from 6x + 9
// 6x + 9 = 3(2x + 3)
let x = 4;
let original = 6 * x + 9;    // 33
let factored = 3 * (2 * x + 3);  // 33

A common factor is a number, variable, or expression that divides evenly into each term of an algebraic expression. Factoring out a common factor is often the first step in simplifying expressions: for example, 6x + 9 = 3(2x + 3), where 3 is the common factor. This technique is fundamental to factoring polynomials.

Coordinate Planealgebra

A two-dimensional surface defined by a horizontal x-axis and a vertical y-axis intersecting at the origin.

// Represent a point on the coordinate plane
let point = { x: 3, y: -2 };
// Distance from origin
let dist = Math.sqrt(point.x ** 2 + point.y ** 2);

The coordinate plane (or Cartesian plane) is a flat surface formed by two perpendicular number lines: the x-axis (horizontal) and y-axis (vertical). Their intersection is the origin (0, 0). Every point is identified by an ordered pair (x, y). The plane is divided into four quadrants and is used to graph equations, functions, and geometric shapes.

Circlegeometry

The set of all points in a plane that are equidistant from a fixed center point.

const circle = { center: { x: 0, y: 0 }, radius: 5 };
const area = Math.PI * circle.radius ** 2; // ~78.54

A circle is a closed curve where every point is exactly the same distance (the radius) from a fixed center point. Key properties include the radius r, diameter d = 2r, circumference C = 2 * pi * r, and area A = pi * r^2. The equation of a circle centered at (h, k) with radius r is (x - h)^2 + (y - k)^2 = r^2.

Circumferencegeometry

The total distance around a circle.

const circumference = (radius) => 2 * Math.PI * radius;
circumference(7); // ~43.98

Circumference is the perimeter of a circle, calculated as C = 2 * pi * r or equivalently C = pi * d, where r is the radius and d is the diameter. The ratio of any circle's circumference to its diameter is the constant pi (approximately 3.14159). Circumference is a linear measure, unlike area which is quadratic in the radius.

Coordinate Planegeometry

A two-dimensional surface defined by a horizontal x-axis and a vertical y-axis intersecting at the origin.

const origin = { x: 0, y: 0 };
const pointA = { x: 3, y: 4 };

The coordinate plane (Cartesian plane) is a flat surface formed by two perpendicular number lines: the horizontal x-axis and the vertical y-axis, intersecting at the origin (0, 0). Every point is identified by an ordered pair (x, y). The plane is divided into four quadrants, numbered I through IV counterclockwise from the upper right.

Conjunctionlogic proofs

A compound proposition that is true only when both of its operands are true (logical AND).

const conjunction = (p, q) => p && q;
conjunction(true, true);   // true
conjunction(true, false);  // false

Conjunction is the logical operation denoted by the symbol AND (wedge, &&). The conjunction P AND Q is true only when both P and Q are true, and false in all other cases. In a truth table with two variables, conjunction yields true in exactly one of the four rows. Conjunction is commutative (P AND Q = Q AND P) and associative.

Contradictionlogic proofs

A compound proposition that is false under every possible truth assignment.

// P AND (NOT P) is always false
const contradiction = (p) => p && !p;
contradiction(true);  // false
contradiction(false); // false

A contradiction is a logical statement that is always false regardless of the truth values of its component propositions. The simplest example is P AND NOT P, which cannot be true for any value of P. Contradictions are the logical opposite of tautologies. In proof by contradiction, one assumes the negation of the desired conclusion and derives a contradiction, thereby proving the original statement.

Contrapositivelogic proofs

The logically equivalent statement formed by negating and swapping the hypothesis and conclusion of a conditional.

// Original: if P then Q
// Contrapositive: if NOT Q then NOT P
const implies = (p, q) => !p || q;
const contrapositive = (p, q) => implies(!q, !p);

The contrapositive of the conditional statement 'if P then Q' is 'if NOT Q then NOT P.' A conditional and its contrapositive are logically equivalent, meaning they always have the same truth value. This is distinct from the converse ('if Q then P') and the inverse ('if NOT P then NOT Q'), neither of which is logically equivalent to the original. Proof by contrapositive is a valid proof technique that leverages this equivalence.

Counterexamplelogic proofs

A specific case that disproves a universal statement.

// "All prime numbers are odd" — counterexample: 2
const isPrime = (n) => {
  if (n < 2) return false;
  for (let i = 2; i <= Math.sqrt(n); i++)
    if (n % i === 0) return false;
  return true;
};
isPrime(2) && (2 % 2 === 0); // true: 2 is even and prime

A counterexample is a concrete instance that demonstrates a universally quantified statement is false. To disprove 'for all x, P(x),' one only needs to find a single x for which P(x) is false. Counterexamples are a powerful tool in mathematics: they cannot prove a statement true, but a single valid counterexample is sufficient to prove it false.

Cosinetrigonometry

A trigonometric function that returns the x-coordinate of a point on the unit circle at a given angle.

Math.cos(0);            // 1
Math.cos(Math.PI / 3);  // 0.5
Math.cos(Math.PI);      // -1

Cosine is a fundamental trigonometric function. For an angle theta, cos(theta) equals the x-coordinate of the point where the terminal side of the angle intersects the unit circle. In a right triangle, it is the ratio of the adjacent side to the hypotenuse. Cosine is periodic with period 2*pi, is an even function (cos(-theta) = cos(theta)), and satisfies the Pythagorean identity sin^2(theta) + cos^2(theta) = 1.

Composition of Functionsprecalculus

The operation of applying one function to the result of another, written (f ∘ g)(x) = f(g(x)).

const f = x => 2 * x + 1;
const g = x => x * x;
const compose = (f, g) => x => f(g(x));
const fg = compose(f, g);
console.log(fg(3)); // f(g(3)) = f(9) = 19

Function composition combines two functions by using the output of one as the input of the other. Given functions f and g, the composite (f ∘ g)(x) = f(g(x)) first evaluates g at x, then passes that result into f. The domain of the composite is restricted to values of x in the domain of g whose outputs lie in the domain of f. Composition is not commutative — f(g(x)) and g(f(x)) generally produce different results.

Conic Sectionprecalculus

A curve obtained by intersecting a plane with a double-napped cone, producing a circle, ellipse, parabola, or hyperbola.

// General second-degree equation: Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0
// Discriminant determines conic type
function conicType(A, B, C) {
  const disc = B * B - 4 * A * C;
  if (disc < 0) return A === C && B === 0 ? 'circle' : 'ellipse';
  if (disc === 0) return 'parabola';
  return 'hyperbola';
}
console.log(conicType(1, 0, 1)); // 'circle'

Conic sections are the family of curves formed when a plane intersects a right circular double cone at various angles. Depending on the angle and position of the plane, the resulting cross-section is a circle, ellipse, parabola, or hyperbola. Each conic can be described algebraically by a second-degree equation Ax² + Bxy + Cy² + Dx + Ey + F = 0, and the discriminant B² − 4AC determines which type of conic the equation represents.

Chain Rulecalculus

A rule for differentiating the composition of two or more functions.

// Chain rule: d/dx [sin(x^2)] = cos(x^2) * 2x
function chainDerivative(x) {
  const inner = x * x;
  const outerDeriv = Math.cos(inner);
  const innerDeriv = 2 * x;
  return outerDeriv * innerDeriv;
}

The chain rule states that if y = f(g(x)), then dy/dx = f'(g(x)) * g'(x). It decomposes the derivative of a composite function into the derivative of the outer function evaluated at the inner function, multiplied by the derivative of the inner function. This is one of the most frequently used differentiation rules.

Composite Derivativecalculus

The derivative of a function formed by composing two or more functions.

// Derivative of (3x+1)^4 using chain rule
// = 4*(3x+1)^3 * 3 = 12*(3x+1)^3
function compositeDerivative(x) {
  return 12 * Math.pow(3 * x + 1, 3);
}

A composite derivative is computed using the chain rule. For f(g(x)), you differentiate the outer function f at g(x), then multiply by the derivative of the inner function g'(x). For deeper compositions like f(g(h(x))), the chain rule applies repeatedly, producing f'(g(h(x))) * g'(h(x)) * h'(x).

Concavitycalculus

The direction a curve bends, determined by the sign of the second derivative.

// Check concavity via second derivative
function secondDerivative(f, x, h = 0.0001) {
  return (f(x + h) - 2 * f(x) + f(x - h)) / (h * h);
}
const f = x => x * x * x;
console.log(secondDerivative(f, 1));  // > 0, concave up
console.log(secondDerivative(f, -1)); // < 0, concave down

A function is concave up on an interval if its second derivative is positive there, meaning the curve bends upward like a cup. It is concave down if the second derivative is negative, bending downward like a frown. Concavity helps classify critical points and understand the shape of graphs.

Continuitycalculus

A function is continuous at a point if it has no breaks, jumps, or holes there.

// Check approximate continuity at a point
function isContinuous(f, a, epsilon = 0.001) {
  const left = f(a - epsilon);
  const right = f(a + epsilon);
  const center = f(a);
  return Math.abs(left - center) < 0.01 &&
         Math.abs(right - center) < 0.01;
}

A function f is continuous at x = a if three conditions hold: f(a) is defined, the limit of f(x) as x approaches a exists, and that limit equals f(a). Intuitively, you can draw the graph through that point without lifting your pen. Continuity on an interval means continuity at every point in that interval.

Critical Pointcalculus

A point where a function's derivative is zero or undefined.

// Find critical points numerically
function findCriticalPoints(f, a, b, steps = 1000) {
  const h = 0.0001;
  const dx = (b - a) / steps;
  const points = [];
  for (let i = 0; i <= steps; i++) {
    const x = a + i * dx;
    const deriv = (f(x + h) - f(x - h)) / (2 * h);
    if (Math.abs(deriv) < 0.001) points.push(x);
  }
  return points;
}

A critical point of f(x) occurs at x = c where f'(c) = 0 or f'(c) does not exist, provided f(c) is defined. Critical points are candidates for local maxima, local minima, or neither. The first or second derivative test is used to classify them.

Change of Variablecalculus

Replacing one variable with a function of another to simplify an integral or equation.

// Change of variable in definite integral
// Integral of 2x*sqrt(x^2+1) from 0 to 2
// Let u = x^2+1, du = 2x dx
// Bounds: x=0 -> u=1, x=2 -> u=5
// Becomes integral of sqrt(u) du from 1 to 5
const n = 10000, du = (5 - 1) / n;
let result = 0;
for (let i = 0; i < n; i++) {
  const u = 1 + (i + 0.5) * du;
  result += Math.sqrt(u) * du;
}
console.log(result.toFixed(4)); // ~6.7869

A change of variable (substitution) transforms an integral by replacing the original variable with a new one chosen to simplify the integrand. In u-substitution, setting u = g(x) and du = g'(x) dx restructures the integral into a simpler form. For definite integrals, the bounds must also be converted to the new variable.

Comparison Testcalculus 2

A convergence test that determines whether a series converges by comparing it to a known convergent or divergent series.

// Compare 1/(n^2+1) with 1/n^2 (known convergent p-series)
function partialSum(f, N) {
  let sum = 0;
  for (let n = 1; n <= N; n++) sum += f(n);
  return sum;
}
console.log(partialSum(n => 1/(n*n+1), 1000));
console.log(partialSum(n => 1/(n*n), 1000));

The Direct Comparison Test states that if 0 <= a_n <= b_n for all n and sum of b_n converges, then sum of a_n also converges. Conversely, if sum of a_n diverges, then sum of b_n diverges. The Limit Comparison Test refines this: if lim(a_n / b_n) = L where 0 < L < infinity, then both series converge or both diverge.

Convergence Testcalculus 2

A method for determining whether an infinite series converges or diverges.

// Divergence test: if terms don't approach 0, series diverges
function divergenceTest(termFn, N) {
  const term = termFn(N);
  return Math.abs(term) > 1e-10 ? 'Diverges' : 'Inconclusive';
}
console.log(divergenceTest(n => n / (n + 1), 100000)); // 'Diverges'

Convergence tests are systematic procedures for deciding if an infinite series has a finite sum. Common tests include the Divergence Test, Comparison Test, Limit Comparison Test, Ratio Test, Root Test, Integral Test, and Alternating Series Test. Each test has specific conditions under which it is applicable, and no single test works for all series.

Cross Sectioncalculus 2

A two-dimensional slice of a three-dimensional solid, taken perpendicular to an axis.

// Volume of a solid with square cross sections, side = sqrt(x), from 0 to 4
function volumeByCrossSection(areaFn, a, b, n) {
  const dx = (b - a) / n;
  let vol = 0;
  for (let i = 0; i < n; i++) {
    const x = a + (i + 0.5) * dx;
    vol += areaFn(x) * dx;
  }
  return vol;
}
console.log(volumeByCrossSection(x => x, 0, 4, 10000)); // 8

In the context of computing volumes, a cross section is the planar region obtained by cutting a solid with a plane perpendicular to a given axis. The volume of a solid can be found by integrating the area of its cross sections along that axis: V = integral of A(x) dx. Cross-sectional shapes commonly include disks, washers, squares, and triangles depending on the solid's geometry.

Change of Basislinear algebra

The process of converting a vector's coordinates from one basis to another.

// Change of basis matrix from standard to new basis
const P = [[1, 1], [0, 1]]; // new basis columns
// To convert coords: multiply by P^{-1}
const PInv = [[1, -1], [0, 1]];
const vStandard = [3, 2];
const vNew = [PInv[0][0]*vStandard[0] + PInv[0][1]*vStandard[1], PInv[1][0]*vStandard[0] + PInv[1][1]*vStandard[1]]; // [1, 2]

A change of basis transforms the coordinate representation of a vector from one basis to another using a transition matrix. If B and B' are two bases for a vector space, the change-of-basis matrix P converts coordinates [v]_B to [v]_B' via the relation [v]_B' = P^{-1}[v]_B. This operation is fundamental for simplifying linear transformations by choosing a convenient basis.

Column Spacelinear algebra

The set of all possible linear combinations of a matrix's column vectors.

// Matrix with 2 columns in R3
const A = [[1, 2], [3, 4], [5, 6]];
// Column space is spanned by [1,3,5] and [2,4,6]
// Since columns are independent, column space has dimension 2

The column space (or range) of a matrix A is the subspace of R^m spanned by the columns of A. It represents all possible output vectors b for which the system Ax = b has a solution. The dimension of the column space equals the rank of the matrix and determines how many independent directions the transformation can reach.

Curlmultivariable calc

A vector operator that measures the infinitesimal rotation of a vector field at a given point.

// Approximate curl z-component of F=(P,Q) at (x,y)
const curlZ = (dQ_dx - dP_dy);

The curl of a vector field F = (P, Q, R) is the vector (∂R/∂y − ∂Q/∂z, ∂P/∂z − ∂R/∂x, ∂Q/∂x − ∂P/∂y), often written as ∇ × F. It quantifies how much and in what direction the field tends to circulate around each point. A field with zero curl everywhere is called irrotational.

Cylindrical and Spherical Coordinatesmultivariable calc

Alternative coordinate systems that use radial distance and angles instead of Cartesian axes to describe points in three-dimensional space.

// Cartesian to cylindrical
const r = Math.sqrt(x*x + y*y);
const theta = Math.atan2(y, x);
// z stays the same

Cylindrical coordinates (r, θ, z) extend polar coordinates into three dimensions by adding a height axis. Spherical coordinates (ρ, θ, φ) describe a point by its distance from the origin, polar angle, and azimuthal angle. Both systems simplify integration over regions with radial or angular symmetry by aligning coordinate surfaces with the geometry of the problem.

Central Limit Theoremprobability stats

The theorem stating that the distribution of sample means approaches a normal distribution as sample size increases, regardless of the population's shape.

// Demonstrate CLT: means of uniform samples approach normal
const sampleMeans = [];
for (let i = 0; i < 1000; i++) {
  let sum = 0;
  for (let j = 0; j < 30; j++) sum += Math.random();
  sampleMeans.push(sum / 30);
}
const mean = sampleMeans.reduce((a, b) => a + b) / sampleMeans.length;
console.log(`Mean of sample means: ${mean.toFixed(4)}`); // ≈ 0.5

The Central Limit Theorem (CLT) states that for a population with mean μ and finite variance σ², the distribution of the sample mean X̄ from samples of size n converges to N(μ, σ²/n) as n grows large. This holds regardless of the original distribution's shape. The CLT is the theoretical foundation for confidence intervals and hypothesis tests, as it justifies using normal-distribution-based methods on sample statistics.

Combinationprobability stats

A selection of items from a set where the order does not matter.

// Calculate C(n, k) — number of ways to choose k from n
function combination(n, k) {
  if (k > n) return 0;
  let result = 1;
  for (let i = 0; i < k; i++) {
    result = result * (n - i) / (i + 1);
  }
  return Math.round(result);
}
console.log(combination(52, 5)); // 2598960 poker hands

A combination is a way of choosing k items from n distinct items without regard to order. The number of combinations is given by the binomial coefficient C(n,k) = n! / (k!(n-k)!). Unlike permutations, combinations treat {A,B} and {B,A} as the same selection. Combinations are fundamental in probability for counting favorable outcomes in events like card hands and lottery draws.

Combinatoricsprobability stats

The branch of mathematics concerned with counting, arranging, and selecting objects from finite sets.

// Count arrangements: permutations and combinations
const factorial = n => n <= 1 ? 1 : n * factorial(n - 1);
const P = (n, k) => factorial(n) / factorial(n - k);
const C = (n, k) => factorial(n) / (factorial(k) * factorial(n - k));
console.log(`P(5,3) = ${P(5,3)}`); // 60 ordered
console.log(`C(5,3) = ${C(5,3)}`); // 10 unordered

Combinatorics is the study of finite discrete structures and the methods for counting arrangements and selections. It encompasses permutations (ordered arrangements), combinations (unordered selections), and more advanced techniques like the inclusion-exclusion principle and generating functions. In probability, combinatorics provides the tools to count sample spaces and favorable outcomes, enabling the calculation of exact probabilities for discrete events.

Confidence Intervalprobability stats

A range of values, computed from sample data, that is likely to contain the true population parameter at a given confidence level.

// 95% confidence interval for a sample mean
const data = [4.2, 3.8, 4.5, 4.1, 3.9, 4.3, 4.0, 4.4];
const n = data.length;
const mean = data.reduce((a, b) => a + b) / n;
const std = Math.sqrt(data.reduce((s, x) => s + (x - mean) ** 2, 0) / (n - 1));
const z = 1.96; // 95% confidence
const margin = z * std / Math.sqrt(n);
console.log(`${mean.toFixed(2)} ± ${margin.toFixed(2)}`);

A confidence interval is an interval estimate [L, U] constructed from sample data such that, over many repeated samples, a specified proportion (the confidence level) of such intervals would contain the true population parameter. For a sample mean with known variance, the interval is X̄ ± z*(σ/√n). The width of the interval reflects both the desired confidence level and the precision of the estimate, narrowing as sample size increases.

Confidence Levelprobability stats

The probability that a confidence interval procedure will produce an interval containing the true parameter, typically expressed as 90%, 95%, or 99%.

// Z-scores for common confidence levels
const levels = { '90%': 1.645, '95%': 1.96, '99%': 2.576 };
const std = 10, n = 25;
for (const [level, z] of Object.entries(levels)) {
  const margin = z * std / Math.sqrt(n);
  console.log(`${level}: margin = ±${margin.toFixed(2)}`);
}

The confidence level (1 - α) represents the long-run proportion of confidence intervals that would capture the true population parameter if the sampling procedure were repeated many times. A 95% confidence level means that 95 out of 100 such intervals are expected to contain the true value. Higher confidence levels produce wider intervals, reflecting a trade-off between certainty and precision. It does not mean there is a 95% probability the parameter lies in any single computed interval.

Conjugate Priorprobability stats

A prior distribution that, when combined with a particular likelihood function, produces a posterior distribution in the same family.

// Beta-Binomial conjugate: Beta(a,b) prior + k successes in n trials
const a = 2, b = 2; // Beta prior parameters
const k = 7, n = 10; // observed data
const postA = a + k;     // posterior alpha
const postB = b + (n - k); // posterior beta
const postMean = postA / (postA + postB);
console.log(`Posterior Beta(${postA}, ${postB}), mean = ${postMean.toFixed(3)}`);

A conjugate prior is a prior distribution chosen so that the resulting posterior distribution belongs to the same probability distribution family as the prior. For example, a Beta prior is conjugate to the Binomial likelihood, yielding a Beta posterior. Conjugate priors simplify Bayesian computation because the posterior can be derived analytically without numerical integration. They are widely used in practice for their mathematical convenience and interpretability.

Characteristic Equationdifferential equations

An algebraic equation derived from a linear ODE by substituting an exponential trial solution.

// Solve characteristic equation r^2 + 5r + 6 = 0
const a = 1, b = 5, c = 6;
const discriminant = b * b - 4 * a * c;
const r1 = (-b + Math.sqrt(discriminant)) / (2 * a);
const r2 = (-b - Math.sqrt(discriminant)) / (2 * a);
console.log(`Roots: r1 = ${r1}, r2 = ${r2}`);

The characteristic equation is obtained by replacing y with e^(rt) in a linear constant-coefficient ODE, yielding a polynomial in r. The roots of this polynomial determine the form of the general solution: real distinct roots produce exponential terms, repeated roots introduce polynomial factors, and complex roots yield oscillatory sine-cosine combinations.

Coupled Equationsdifferential equations

A set of differential equations where the unknown functions appear in more than one equation.

// Coupled system: dx/dt = -x + 2y, dy/dt = x - y
function coupled(t, x, y) {
  const dxdt = -x + 2 * y;
  const dydt = x - y;
  return [dxdt, dydt];
}

Coupled equations are systems where the derivative of each unknown depends on one or more of the other unknowns, creating interdependence that prevents solving each equation in isolation. They arise naturally in multi-component models such as predator-prey dynamics or chemical reaction networks. Solution techniques include matrix methods, eigenvalue decomposition, and numerical integration schemes like Runge-Kutta.

Closed Formdiscrete math

An explicit formula that computes the nth term of a sequence directly without referencing previous terms.

// Closed form for arithmetic sequence: a(n) = a0 + n * d
const a0 = 3, d = 5;
const closedForm = (n) => a0 + n * d;
console.log(closedForm(10)); // 53

A closed-form expression evaluates the nth term of a sequence using a fixed number of standard operations, without recursion or iteration over prior terms. For example, the closed form of the Fibonacci sequence is Binet's formula: F(n) = (phi^n - psi^n) / sqrt(5). Finding a closed form for a recurrence relation is a central goal in discrete mathematics, often achieved via techniques like the characteristic equation method or generating functions.

Combinatorial Proofdiscrete math

A proof that establishes an identity by showing both sides count the same set in different ways.

A combinatorial proof demonstrates that two expressions are equal by interpreting each side as counting the elements of the same finite set using different methods. There are two main types: bijective proofs, which construct a one-to-one correspondence between two sets, and double-counting proofs, which count the same set in two different ways. Combinatorial proofs are often more intuitive and illuminating than algebraic manipulation.

Congruencediscrete math

Two integers are congruent modulo n if they have the same remainder when divided by n.

// Check congruence: 17 ≡ 2 (mod 5)
const a = 17, b = 2, n = 5;
const isCongruent = (a - b) % n === 0;
console.log(isCongruent); // true

Integers a and b are congruent modulo n, written a ≡ b (mod n), if n divides (a - b). Congruence is an equivalence relation that partitions the integers into n residue classes. It preserves addition and multiplication: if a ≡ b (mod n) and c ≡ d (mod n), then a + c ≡ b + d (mod n) and a * c ≡ b * d (mod n).

Counting Principlediscrete math

A fundamental rule for determining the number of outcomes of a combinatorial process.

// Count total lunch combos: 3 mains × 4 sides + 2 specials
const mains = 3, sides = 4, specials = 2;
const totalMeals = (mains * sides) + specials; // 14

Counting principles are foundational rules in combinatorics for determining the size of a set without enumerating every element. The two most fundamental are the Addition Principle (for mutually exclusive choices) and the Multiplication Principle (for sequential independent choices). Together they form the basis for deriving formulas for permutations, combinations, and more complex counting arguments.

Cauchy Sequencereal analysis

A sequence whose terms become arbitrarily close to each other as the sequence progresses.

// Check if partial sums of 1/2^n form a Cauchy sequence
function cauchyCheck(terms, epsilon) {
  for (let i = terms - 5; i < terms; i++)
    for (let j = i; j < terms; j++) {
      const diff = Math.abs(1/Math.pow(2,i) - 1/Math.pow(2,j));
      if (diff >= epsilon) return false;
    }
  return true;
}
console.log(cauchyCheck(20, 0.001)); // true

A sequence (a_n) is called a Cauchy sequence if for every epsilon > 0, there exists a natural number N such that for all m, n >= N, |a_m - a_n| < epsilon. In the real numbers, a sequence is Cauchy if and only if it converges, which is a consequence of the Completeness Axiom. Cauchy sequences provide a way to characterize convergence without knowing the limit in advance.

Closed Setreal analysis

A set that contains all of its limit points.

// [0, 1] is closed: limit points 0 and 1 are included
const closedInterval = { contains: (x) => x >= 0 && x <= 1 };
console.log(closedInterval.contains(0));   // true
console.log(closedInterval.contains(1));   // true
console.log(closedInterval.contains(0.5)); // true

A subset F of a metric space (X, d) is closed if it contains all of its limit points, meaning every convergent sequence of points in F has its limit also in F. Equivalently, a set is closed if and only if its complement is open. Closed sets are fundamental to topology and analysis, providing the setting for many convergence and continuity theorems.

Completeness Axiomreal analysis

Every non-empty set of real numbers bounded above has a least upper bound.

// The rationals have gaps; the reals don't
// Set: { x in Q : x^2 < 2 } has no rational supremum
// but has real supremum sqrt(2)
const sup = Math.sqrt(2);
console.log(sup);            // 1.4142135...
console.log(sup * sup === 2); // false (floating point)
console.log(Math.abs(sup * sup - 2) < 1e-15); // true

The Completeness Axiom (also called the Least Upper Bound Property) states that every non-empty subset of the real numbers that is bounded above has a supremum (least upper bound) in the real numbers. This axiom distinguishes the reals from the rationals and is the foundation for most major theorems in real analysis. It guarantees that there are no 'gaps' in the real number line.

Continuity (Rigorous)real analysis

A function is continuous at a point if its limit at that point equals the function value.

// Verify continuity of f(x) = x^2 at c = 3
function checkContinuity(f, c, epsilon) {
  const delta = Math.sqrt(epsilon); // works for x^2 near 3
  const x = c + delta * 0.99;
  return Math.abs(f(x) - f(c)) < epsilon;
}
console.log(checkContinuity(x => x*x, 3, 0.01)); // true

A function f is continuous at a point c if for every epsilon > 0, there exists a delta > 0 such that whenever |x - c| < delta, it follows that |f(x) - f(c)| < epsilon. This epsilon-delta formulation makes the intuitive notion of 'no jumps or breaks' mathematically precise. A function is continuous on a set if it is continuous at every point of that set.

Convergence (Rigorous)real analysis

A sequence converges to a limit L if its terms eventually stay arbitrarily close to L.

// Show 1/n -> 0: find N for given epsilon
function findN(epsilon) {
  return Math.ceil(1 / epsilon);
}
const eps = 0.001;
const N = findN(eps);
console.log(`N = ${N}, 1/N = ${1/N} < ${eps}: ${1/N < eps}`);

A sequence (a_n) converges to a limit L if for every epsilon > 0, there exists a natural number N such that for all n >= N, |a_n - L| < epsilon. This definition makes precise the idea that the terms of the sequence get and stay as close to L as desired. Convergence in the reals is equivalent to being a Cauchy sequence, thanks to the Completeness Axiom.

Cosetabstract algebra

A subset formed by combining a fixed element with every element of a subgroup under the group operation.

Given a group G, a subgroup H, and an element g in G, the left coset gH is the set {gh : h in H} and the right coset Hg is the set {hg : h in H}. Cosets partition the group into disjoint subsets of equal size, which is the foundation of Lagrange's theorem. Two cosets are either identical or completely disjoint, and the number of distinct cosets is called the index of H in G.

Change of Base Formulaprecalculus

Converts between logarithm bases: log_b(x) = ln(x)/ln(b).

// Change of base: log_b(x) = ln(x) / ln(b)
function logBase(b, x) {
  return Math.log(x) / Math.log(b);
}
console.log(logBase(2, 8));  // 3
console.log(logBase(5, 25)); // 2

The change of base formula lets you evaluate a logarithm in any base using a different base, typically natural log or log base 10. The formula is log_b(x) = ln(x) / ln(b). This is essential because most calculators and programming languages only provide ln and log10.

Complex Conjugateprecalculus

For z = a + bi, the conjugate is a - bi.

// Complex conjugate
const z = { re: 3, im: 4 };
const conj = { re: z.re, im: -z.im };
const product = z.re * conj.re - z.im * conj.im;
console.log(`z * conj(z) = ${product}`); // 25

The complex conjugate of a complex number a + bi is a - bi, obtained by negating the imaginary part. Multiplying a complex number by its conjugate always produces a real number: (a + bi)(a - bi) = a^2 + b^2. Conjugates are used to simplify division of complex numbers and to find moduli.

Complex Numberprecalculus

A number of the form a + bi where i^2 = -1.

// Complex number addition
const z1 = { re: 2, im: 3 };
const z2 = { re: 1, im: -1 };
const sum = { re: z1.re + z2.re, im: z1.im + z2.im };
console.log(`(${z1.re}+${z1.im}i) + (${z2.re}+${z2.im}i) = ${sum.re}+${sum.im}i`);

A complex number combines a real part (a) and an imaginary part (bi) into the form a + bi. Complex numbers extend the real number system so that every polynomial equation has a solution. They can be visualized as points on the complex plane, with the real part on the x-axis and the imaginary part on the y-axis.

Constant of Integrationcalculus

The arbitrary constant C added when finding an antiderivative.

// Antiderivative of 2x is x^2 + C
const C = 5;
const F = (x) => x * x + C;

When computing an antiderivative, infinitely many functions differ only by a constant and all share the same derivative. The constant of integration C accounts for this family of solutions. It is determined when an initial condition or boundary value is provided.

Convergent Integralcalculus 2

An improper integral whose limit exists and is finite.

// Integral of 1/x^2 from 1 to infinity converges to 1
// lim (b->inf) [-1/x] from 1 to b = 0 - (-1) = 1

An improper integral converges when the limit used to define it exists and equals a finite number. This can occur with infinite limits of integration or with integrands that have discontinuities. Convergence tests such as comparison and limit comparison help determine whether an improper integral converges without evaluating it directly.

Characteristic Polynomiallinear algebra

The polynomial det(A - lambda*I), whose roots are the eigenvalues of A.

// For a 2x2 matrix [[a,b],[c,d]], characteristic polynomial is lambda^2 - (a+d)*lambda + (ad - bc)
const a = 3, b = 1, c = 0, d = 2;
const trace = a + d;
const det = a * d - b * c;
console.log(`lambda^2 - ${trace}*lambda + ${det}`);

The characteristic polynomial of a square matrix A is defined as det(A - lambda*I), where lambda is a scalar variable and I is the identity matrix. The roots of this polynomial are the eigenvalues of A. The degree of the polynomial equals the size of the matrix, so an n×n matrix has a characteristic polynomial of degree n.

Cofactor Expansionlinear algebra

Computing a determinant by expanding along a row or column using minors and signs.

// Cofactor expansion along the first row of a 2x2 matrix
const matrix = [[4, 3], [2, 1]];
const det = matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0];
console.log('Determinant:', det); // -2

Cofactor expansion (also called Laplace expansion) calculates the determinant of a matrix by summing the products of each entry in a chosen row or column with its corresponding cofactor. Each cofactor is a signed minor, where the sign follows a checkerboard pattern of plus and minus. This recursive method reduces an n×n determinant to a combination of (n-1)×(n-1) determinants.

D
Data Typeprogramming foundations

A classification that defines what kind of value a variable holds.

typeof 42       // "number"
typeof "hello" // "string"
typeof true    // "boolean"

A data type specifies the kind of value a variable can hold and what operations can be performed on it. Common types include numbers (integers, floats), strings (text), booleans (true/false), arrays/lists, and objects/dictionaries. Languages are either statically typed (types checked at compile time) or dynamically typed (types checked at runtime).

Declarationprogramming foundations

The act of creating a new variable and giving it a name.

let x;        // declared
let y = 5;    // declared + assigned

Declaration is the statement that introduces a new variable into the program's scope. In JavaScript, `let x;` declares a variable named `x`. In Python, declaration and assignment happen together: `x = 5` both declares and assigns.

Destructuringprogramming foundations

A syntax for extracting values from arrays or properties from objects into variables.

const { name, age } = { name: "Alice", age: 28 };
// name = "Alice", age = 28

const [a, b] = [10, 20];
// a = 10, b = 20

Destructuring assignment lets you unpack values from arrays or properties from objects into distinct variables. In JavaScript: `const { name, age } = user;` or `const [first, second] = arr;`. Destructuring makes code more readable by eliminating repetitive property access. It's heavily used in React (destructuring props) and modern JavaScript.

Dependencyprogramming foundations

A module or package that your code requires to function.

// package.json
"dependencies": {
  "react": "^18.2.0",
  "next": "^14.0.0"
}

A dependency is any external code that your project relies on. Direct dependencies are packages you import explicitly. Transitive dependencies are packages that your dependencies depend on. Dependencies are listed in package.json (JS) or requirements.txt (Python). Managing dependencies — versions, updates, security — is a core part of software engineering.

Dynamic Arraydata structures algorithms

An array that automatically resizes when it runs out of space.

const arr = [];
arr.push(1); // may trigger resize
arr.push(2); // amortized O(1)

A dynamic array (ArrayList in Java, list in Python, Array in JavaScript) automatically grows when elements are added beyond its capacity. It allocates a larger block of memory (usually 2x) and copies elements over. Amortized O(1) for push, but individual resizes are O(n).

Doubly Linked Listdata structures algorithms

A linked list where each node points to both the next and previous nodes.

null ← [A] ⇄ [B] ⇄ [C] → null
// Can go forward AND backward

In a doubly linked list, each node has references to both its next and previous nodes. This allows traversal in both directions and O(1) deletion when you have a reference to the node. Used internally by browsers (forward/back) and LRU caches.

Directed vs Undirected Graphdata structures algorithms

Directed graphs have one-way edges; undirected graphs have two-way edges.

// Directed: Twitter follows (A follows B)
// Undirected: Facebook friends (mutual)
// DAG: dependency graph (no cycles)

In a directed graph (digraph), edges have direction: A→B doesn't imply B→A. Examples: web links, dependencies. In an undirected graph, edges are bidirectional: A-B means both can reach each other. Examples: social friendships, road networks. Directed graphs can have cycles (A→B→C→A).

Depth-First Searchdata structures algorithms

A graph traversal that goes as deep as possible before backtracking.

function dfs(graph, node, visited = new Set()) {
  visited.add(node);
  for (const neighbor of graph[node])
    if (!visited.has(neighbor))
      dfs(graph, neighbor, visited);
  return visited;
}

DFS uses a stack (or recursion) to explore as far as possible along each branch before backtracking. It visits a node, then recursively visits each unvisited neighbor. Time: O(V + E). Used for cycle detection, topological sort, connected components, and path finding. Does NOT guarantee shortest path.

DNSnetworking

The system that translates domain names (google.com) into IP addresses.

$ nslookup google.com
Address: 142.250.80.46

// DNS resolution chain:
browser → resolver → root → .com → google.com → IP

DNS (Domain Name System) is the internet's phone book. When you type a URL, DNS resolves the domain name to an IP address through a chain: browser cache → OS cache → recursive resolver → root server → TLD server → authoritative server. DNS records include A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail).

Database Indexdatabases

A data structure that speeds up queries by providing fast lookups on specific columns.

-- Without index: O(n) full table scan
-- With index: O(log n) B-tree lookup
CREATE INDEX idx_users_email ON users(email);

SELECT * FROM users WHERE email = 'alice@ex.com';
-- Now uses the index → fast!

An index is a B-tree (or hash) structure that allows the database to find rows without scanning the entire table. Like a book's index — look up the topic, get the page number. Indexes speed up SELECT/WHERE but slow down INSERT/UPDATE (the index must be maintained). Over-indexing wastes space and write performance.

Dot Productmathematics

The sum of element-wise products of two vectors — measures similarity.

a = [1, 2, 3]
b = [4, 5, 6]
dot = 1*4 + 2*5 + 3*6 = 32

# Cosine similarity = dot / (|a| * |b|)

The dot product of vectors a and b is Σ(aᵢ × bᵢ). Geometrically, it equals |a| × |b| × cos(θ) where θ is the angle between them. Large dot product = similar direction. Used in attention mechanisms, similarity search, and recommendation systems.

Database Cachingdatabases

Storing frequently queried data in fast memory to reduce database load.

const cached = await redis.get('top_products');
if (cached) return JSON.parse(cached);
const rows = await db.query('SELECT ... complex aggregation ...');
await redis.setex('top_products', 60, JSON.stringify(rows));

Database caching places query results or computed data in a fast store (like Redis or Memcached) to avoid repeated expensive database queries. Caching dramatically reduces latency and database load for read-heavy workloads.

Database Replicationdatabases

Copying data from one database server to one or more replicas for redundancy.

INSERT INTO orders (user_id, total) VALUES (1, 99.99);
-- Reads can go to replica
-- SELECT * FROM orders WHERE user_id = 1;

Replication maintains copies of a database on multiple servers. The primary handles writes and propagates changes to replicas. Replicas can serve read queries, distributing load and improving availability.

Denormalizationdatabases

Intentionally adding redundant data to tables to improve read performance.

-- Normalized: requires JOIN
SELECT o.id, u.name FROM orders o JOIN users u ON o.user_id = u.id;
-- Denormalized: name stored directly
SELECT id, user_name FROM orders;

Denormalization is the deliberate introduction of data redundancy to avoid expensive joins. For example, storing a user's name directly in the orders table instead of joining to the users table on every query.

Distributed Rate Limitingdistributed systems

Enforcing request rate limits across multiple server instances using shared state.

const key = `rate:${userId}:${window}`;
const count = await redis.incr(key);
await redis.expire(key, 60);
if (count > MAX_REQUESTS) return res.status(429).json({ error: 'Too many requests' });

Distributed rate limiting coordinates request quotas across multiple servers so that the global limit is respected regardless of which instance handles a request.

Distributed Replicationdistributed systems

Copying data across multiple nodes to improve availability and fault tolerance.

leader.write({ id: 1, name: 'Alice' });
follower1.applyLog(leader.getLog());
follower2.applyLog(leader.getLog());

Distributed replication maintains copies of data on multiple machines so that the system can survive node failures. Common strategies: leader-follower, multi-leader, and leaderless.

DNS Recordnetworking

An entry in a DNS zone file that maps a domain to a specific value.

A      example.com      -> 93.184.216.34
CNAME  www.example.com  -> example.com
MX     example.com      -> mail.example.com

DNS records are instructions stored in authoritative DNS servers. Key types: A (IPv4), AAAA (IPv6), CNAME (alias), MX (email), TXT (text).

DNS Resolutionnetworking

The process of translating a domain name into an IP address.

// 1. Browser cache
// 2. OS cache
// 3. Recursive resolver -> Root -> .com TLD
// 4. Authoritative -> IP returned

DNS resolution is the multi-step lookup that converts a domain name into an IP address: browser cache, OS cache, recursive resolver, root, TLD, authoritative nameserver.

Dimensionality Reductionmachine learning

Reducing the number of features while preserving meaningful structure in the data.

from sklearn.decomposition import PCA
pca = PCA(n_components=10)
X_reduced = pca.fit_transform(X_100d)

Dimensionality reduction transforms high-dimensional data into fewer dimensions. PCA finds axes of maximum variance. t-SNE and UMAP create 2D/3D visualizations.

Derivativemathematics

The rate at which a function's output changes with respect to its input.

const f = x => x * x;
const h = 0.0001;
const slope = (f(3 + h) - f(3)) / h; // ~6.0

A derivative measures instantaneous rate of change — the slope of the tangent line. Essential in ML for computing how to adjust model parameters.

Dockerproduction engineering

A platform for packaging applications into lightweight, portable containers.

// docker build -t my-app .
// docker run -p 3000:3000 my-app

Docker packages an application and all dependencies into a container that runs consistently across any environment. Uses a Dockerfile to define build steps.

Dockerfileproduction engineering

A text file with instructions for building a Docker container image.

// FROM node:20-alpine
// COPY package.json .
// RUN npm install
// COPY . .
// CMD ['node', 'server.js']

A Dockerfile contains instructions: FROM (base image), COPY (add files), RUN (execute commands), CMD (default command). Each instruction creates a cached layer.

Decimalarithmetic

A number expressed in the base-ten system using a decimal point to represent fractional parts.

let price = 19.99;
let pi = 3.14159;
parseFloat("3.75");  // 3.75

A decimal is a way of writing fractions using powers of ten, with a decimal point separating the whole-number part from the fractional part. For example, 3.75 means 3 + 7/10 + 5/100. Decimals provide an alternative to fractions and are the standard representation for numbers in most programming languages.

Divisionarithmetic

The arithmetic operation of splitting a quantity into equal parts or determining how many times one number fits into another.

let quotient = 20 / 4;      // 5
let withDecimal = 7 / 2;    // 3.5
let intDiv = Math.floor(7 / 2);  // 3

Division is the inverse of multiplication. It splits a dividend into groups of a divisor size, producing a quotient. Division by zero is undefined. In programming, integer division truncates the decimal part, while floating-point division preserves it.

Degree of a Polynomialalgebra

The highest exponent of the variable in a polynomial.

// x³ + 2x - 1 has degree 3
// 5x² - x + 7 has degree 2
// 42 has degree 0

The degree of a polynomial is the largest exponent that appears on its variable. For example, x³ + 2x - 1 has degree 3. The degree determines the polynomial's behavior: degree 1 is linear, degree 2 is quadratic, degree 3 is cubic. A nonzero constant has degree 0, and the zero polynomial has no defined degree.

Difference of Squaresalgebra

A factoring pattern where a² - b² equals (a + b)(a - b).

// x² - 9 = (x + 3)(x - 3)
let x = 5;
let original = x ** 2 - 9;        // 16
let factored = (x + 3) * (x - 3);  // 16

The difference of squares is an algebraic identity: a² - b² = (a + b)(a - b). It applies whenever an expression can be written as the subtraction of two perfect squares. For example, x² - 9 = (x + 3)(x - 3). Recognizing this pattern is a key factoring technique used in simplifying expressions and solving equations.

Discriminantalgebra

The expression b² - 4ac that determines the number and type of solutions to a quadratic equation.

function discriminant(a, b, c) {
  return b ** 2 - 4 * a * c;
}
discriminant(1, -5, 6);  // 1 (two real roots)
discriminant(1, 2, 1);   // 0 (one repeated root)
discriminant(1, 0, 1);   // -4 (no real roots)

The discriminant is the value b² - 4ac from the quadratic formula, where ax² + bx + c = 0. If the discriminant is positive, there are two distinct real solutions. If it is zero, there is exactly one real solution (a repeated root). If it is negative, there are no real solutions (but two complex conjugate solutions).

Domain and Rangealgebra

The set of all possible inputs (domain) and outputs (range) of a function.

// f(x) = 1/x
// Domain: all x except 0
// Range: all y except 0
function f(x) {
  if (x === 0) throw new Error("undefined");
  return 1 / x;
}

The domain of a function is the set of all values for which the function is defined (valid inputs). The range is the set of all possible output values. For example, f(x) = √x has domain x ≥ 0 and range y ≥ 0. Identifying domain and range is essential for understanding a function's behavior and graphing it correctly.

Distance Formulageometry

A formula to calculate the straight-line distance between two points in the coordinate plane.

const distance = (x1, y1, x2, y2) =>
  Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2);
distance(1, 2, 4, 6); // 5

The distance formula d = sqrt((x2 - x1)^2 + (y2 - y1)^2) computes the Euclidean distance between two points (x1, y1) and (x2, y2). It is derived directly from the Pythagorean theorem by treating the horizontal and vertical differences as legs of a right triangle. The distance is always non-negative and equals zero only when the two points coincide.

Direct Prooflogic proofs

A proof that proceeds by a chain of logical deductions from premises to conclusion.

A direct proof establishes the truth of a statement by starting from known axioms, definitions, or previously proven theorems and applying valid logical steps to arrive at the desired conclusion. For a conditional 'if P then Q,' a direct proof assumes P is true and deduces Q through a sequence of justified implications. It is the most straightforward proof technique and is preferred when a clear logical path exists.

Disjunctionlogic proofs

A compound proposition that is true when at least one of its operands is true (logical OR).

const disjunction = (p, q) => p || q;
disjunction(false, false); // false
disjunction(true, false);  // true

Disjunction is the logical operation denoted by the symbol OR (vee, ||). The disjunction P OR Q is true when at least one of P or Q is true, and false only when both are false. This is inclusive or; exclusive or (XOR) is true only when exactly one operand is true. Disjunction is commutative and associative.

Degree-Radian Conversiontrigonometry

The formula for converting between degrees and radians: radians = degrees * (pi / 180).

const degToRad = (deg) => deg * (Math.PI / 180);
const radToDeg = (rad) => rad * (180 / Math.PI);
degToRad(45);  // ~0.7854 (pi/4)
radToDeg(Math.PI); // 180

Degree-radian conversion uses the relationship that 360 degrees = 2*pi radians, or equivalently 180 degrees = pi radians. To convert from degrees to radians, multiply by pi/180. To convert from radians to degrees, multiply by 180/pi. Key equivalences include: 30 degrees = pi/6, 45 degrees = pi/4, 60 degrees = pi/3, 90 degrees = pi/2, and 180 degrees = pi.

Double Angle Formulatrigonometry

Identities expressing trigonometric functions of 2*theta in terms of functions of theta.

const sin2x = (x) => 2 * Math.sin(x) * Math.cos(x);
const cos2x = (x) => Math.cos(x)**2 - Math.sin(x)**2;
// Verify: sin2x(pi/4) === sin(pi/2) = 1
sin2x(Math.PI / 4); // ~1

The double angle formulas express sin(2*theta) and cos(2*theta) in terms of sin(theta) and cos(theta). The key formulas are: sin(2*theta) = 2*sin(theta)*cos(theta), and cos(2*theta) = cos^2(theta) - sin^2(theta), which can also be written as 2*cos^2(theta) - 1 or 1 - 2*sin^2(theta). These are special cases of the angle addition formulas and are widely used in simplifying expressions and solving equations.

Definite Integralcalculus

The net signed area under a curve between two bounds.

// Approximate definite integral using midpoint rule
function integrate(f, a, b, n = 10000) {
  const dx = (b - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) {
    sum += f(a + (i + 0.5) * dx) * dx;
  }
  return sum;
}
console.log(integrate(x => x * x, 0, 1)); // ~0.3333

The definite integral of f(x) from a to b is the limit of Riemann sums as the partition gets infinitely fine. It yields a number representing the net signed area between the curve and the x-axis. By the Fundamental Theorem of Calculus, it equals F(b) - F(a) where F is any antiderivative of f.

Derivativecalculus

The instantaneous rate of change of a function at a point.

// Numerical derivative approximation
function derivative(f, x, h = 0.0001) {
  return (f(x + h) - f(x - h)) / (2 * h);
}
const f = x => x * x;
console.log(derivative(f, 3)); // ~6

The derivative of f at x is defined as the limit of [f(x+h) - f(x)] / h as h approaches 0. Geometrically, it gives the slope of the tangent line to the curve at that point. The derivative function f'(x) maps each input to its instantaneous rate of change.

Differential Relationshipcalculus

An equation linking the rates of change of two or more related quantities.

// If x^2 + y^2 = 25 and dx/dt = 3,
// then 2x(dx/dt) + 2y(dy/dt) = 0
function dydt(x, y, dxdt) {
  return -(x * dxdt) / y;
}
console.log(dydt(3, 4, 3)); // -2.25

A differential relationship expresses how the derivatives of interdependent variables are connected through an underlying equation. In related rates problems, you differentiate both sides of an equation with respect to time, producing a relationship between dx/dt, dy/dt, and other rate terms. This lets you find one unknown rate from known rates.

Disk/Washer Methodcalculus 2

A technique for finding volumes of solids of revolution by integrating circular cross-sectional areas perpendicular to the axis of rotation.

// Volume of y = sqrt(x) revolved about x-axis from 0 to 4
function diskVolume(rFn, a, b, n) {
  const dx = (b - a) / n;
  let vol = 0;
  for (let i = 0; i < n; i++) {
    const x = a + (i + 0.5) * dx;
    vol += Math.PI * rFn(x) ** 2 * dx;
  }
  return vol;
}
console.log(diskVolume(x => Math.sqrt(x), 0, 4, 10000)); // 8*pi

The disk method computes the volume of a solid of revolution by integrating pi * (R(x))^2 dx, where R(x) is the distance from the axis of rotation to the curve. When the solid has a hollow core, the washer method subtracts the inner radius: V = pi * integral of (R_outer^2 - R_inner^2) dx. This method is most natural when the cross sections perpendicular to the axis of rotation are circular.

Determinantlinear algebra

A scalar value computed from a square matrix that encodes scaling, orientation, and invertibility information.

// Determinant of a 2x2 matrix
function det2x2(m) {
  return m[0][0] * m[1][1] - m[0][1] * m[1][0];
}
const A = [[3, 1], [2, 4]];
console.log(det2x2(A)); // 10 (invertible, area scales by 10)

The determinant of a square matrix A, denoted det(A) or |A|, is a scalar that represents the signed volume scaling factor of the linear transformation defined by A. A matrix is invertible if and only if its determinant is nonzero. For a 2x2 matrix [[a,b],[c,d]], the determinant is ad - bc, and the sign indicates whether the transformation preserves or reverses orientation.

Diagonalizationlinear algebra

Expressing a matrix as a product PDP^{-1} where D is a diagonal matrix of eigenvalues.

// If A = PDP^{-1}, then A^k = PD^kP^{-1}
// For diagonal D, raising to power k is trivial:
function diagPower(D, k) {
  return D.map((row, i) => row.map((val, j) => i === j ? Math.pow(val, k) : 0));
}

Diagonalization is the process of decomposing a square matrix A into the form A = PDP^{-1}, where D is a diagonal matrix containing the eigenvalues of A and P is a matrix whose columns are the corresponding eigenvectors. A matrix is diagonalizable if and only if it has n linearly independent eigenvectors. Diagonalization simplifies computing matrix powers since A^k = PD^kP^{-1}.

Dimensionlinear algebra

The number of vectors in any basis for a vector space.

// R3 has dimension 3: any basis has exactly 3 vectors
const basisR3 = [[1,0,0], [0,1,0], [0,0,1]];
console.log('Dimension:', basisR3.length); // 3

The dimension of a vector space V is the number of vectors in any basis for V. This count is invariant across all possible bases. For example, R^3 has dimension 3 because any basis requires exactly three linearly independent vectors. The dimension constrains the maximum number of independent directions available in the space.

Directional Derivativemultivariable calc

The rate at which a function changes at a point in a specified direction.

// Directional derivative of f in direction u = (ux, uy)
const D_u_f = grad_f_x * ux + grad_f_y * uy;

The directional derivative of f at point P in the direction of unit vector u is D_u f = ∇f · u, the dot product of the gradient with the direction vector. It generalizes partial derivatives, which measure change only along coordinate axes. The maximum directional derivative equals the magnitude of the gradient and occurs in the gradient's direction.

Divergencemultivariable calc

A scalar measure of the net outward flux of a vector field per unit volume at a given point.

// Divergence of F = (P, Q) in 2D
const div_F = dP_dx + dQ_dy;

The divergence of a vector field F = (P, Q, R) is the scalar ∂P/∂x + ∂Q/∂y + ∂R/∂z, often written as ∇ · F. Positive divergence indicates a source where the field spreads outward; negative divergence indicates a sink. A field with zero divergence everywhere is called incompressible or solenoidal.

Divergence Theoremmultivariable calc

A theorem relating the flux of a vector field through a closed surface to the volume integral of the divergence inside.

The Divergence Theorem (Gauss's Theorem) states that the total outward flux of F through a closed surface S equals the triple integral of ∇ · F over the enclosed volume V. Formally, ∬_S F · dS = ∭_V ∇ · F dV. It generalizes Green's Theorem to three dimensions and converts difficult surface integrals into often simpler volume integrals.

Double Integralmultivariable calc

An integral that computes the accumulated value of a function over a two-dimensional region.

// Approximate double integral via Riemann sum
let sum = 0;
for (let i = 0; i < nx; i++)
  for (let j = 0; j < ny; j++)
    sum += f(x[i], y[j]) * dx * dy;

The double integral ∬_R f(x, y) dA sums the values of f over a planar region R, generalizing single-variable integration to two dimensions. It can represent area, volume under a surface, mass, or probability depending on the integrand. Evaluation typically proceeds by converting to an iterated integral with appropriate bounds.

Divisibilitydiscrete math

An integer a is divisible by integer b if there exists an integer k such that a = b * k.

// Check if 42 is divisible by 7
const isDivisible = (a, b) => a % b === 0;
console.log(isDivisible(42, 7)); // true
console.log(isDivisible(42, 5)); // false

Divisibility is a fundamental relation in number theory: we say b divides a (written b | a) if there exists an integer k such that a = b * k, with b ≠ 0. Divisibility is transitive (if a | b and b | c, then a | c) and forms the basis for concepts like prime numbers, greatest common divisors, and the Fundamental Theorem of Arithmetic.

Double Countingdiscrete math

A proof technique that counts the same quantity in two different ways to establish an identity.

// Handshaking Lemma: sum of degrees = 2 * |edges|
const graph = { A: ['B','C'], B: ['A','C'], C: ['A','B'] };
const degreeSum = Object.values(graph).reduce((s, e) => s + e.length, 0);
const edges = 3;
console.log(degreeSum === 2 * edges); // true

Double counting (also called counting in two ways) is a combinatorial proof technique where a single set or quantity is counted using two different methods, yielding two expressions that must be equal. For example, counting the number of edges in a graph by summing vertex degrees gives twice the edge count, proving the Handshaking Lemma. This technique is powerful for deriving and proving combinatorial identities.

Derivative (Rigorous)real analysis

The limit of the difference quotient, measuring the instantaneous rate of change of a function.

// Approximate derivative of f(x) = x^3 at x = 2
function derivative(f, x, h = 1e-10) {
  return (f(x + h) - f(x)) / h;
}
const f = x => x * x * x;
console.log(derivative(f, 2));  // ~12 (exact: 3*2^2 = 12)
console.log(3 * 2 * 2);         // 12

The derivative of a function f at a point c is defined as the limit f'(c) = lim_{h->0} (f(c+h) - f(c)) / h, provided this limit exists. When the derivative exists at c, the function is said to be differentiable at c. Differentiability at a point implies continuity at that point, but the converse is not true, as demonstrated by functions like |x| at x = 0.

Divergent Integralcalculus 2

An improper integral whose limit does not exist or is infinite.

// Integral of 1/x from 1 to infinity diverges
// lim (b->inf) [ln(x)] from 1 to b = ln(b) -> infinity

An improper integral diverges when the limit defining it fails to exist or tends to infinity. A classic example is the integral of 1/x from 1 to infinity, which grows without bound. Identifying divergence is important because it signals that the quantity being measured is unbounded or undefined.

E
Errorprogramming foundations

An object representing something that went wrong during program execution.

try {
  JSON.parse("bad");
} catch (e) {
  console.log(e.message);
}

An error (or exception) is an object that signals something unexpected happened during execution — invalid input, missing data, network failure, type mismatch. Errors have a message, a name/type, and a stack trace showing where they occurred. Unhandled errors crash the program; handled errors (via try/catch) allow graceful recovery.

Exceptionprogramming foundations

An error that disrupts the normal flow of execution.

// TypeError exception:
null.toString();
// ReferenceError exception:
console.log(undefined_var);

An exception is a runtime error that interrupts the normal flow of a program. When an exception is thrown, the runtime looks for a catch block to handle it. If none is found, the program crashes. Common exception types: TypeError, RangeError, ReferenceError (JS); ValueError, KeyError, IndexError (Python). The terms 'error' and 'exception' are often used interchangeably.

Error Typeprogramming foundations

A specific category of error like TypeError, RangeError, or ValueError.

try {
  null.method();
} catch (e) {
  console.log(e.constructor.name); // TypeError
}

Error types classify errors by their cause. JavaScript built-in types: TypeError (wrong type), RangeError (value out of range), ReferenceError (undefined variable), SyntaxError (invalid syntax). Python: ValueError, TypeError, KeyError, IndexError, FileNotFoundError. You can catch specific error types to handle different problems differently.

Event Loopprogramming foundations

The mechanism that handles async operations by processing a queue of callbacks.

console.log("1");
setTimeout(() => console.log("2"), 0);
console.log("3");
// Output: 1, 3, 2 (event loop!)

The event loop is the runtime mechanism that enables non-blocking async I/O in JavaScript and Python. It continuously checks: is the call stack empty? If yes, take the next callback from the task queue and execute it. This is why setTimeout, fetch callbacks, and event handlers run after the current synchronous code finishes. Understanding the event loop explains why async code behaves the way it does.

Encapsulationprogramming foundations

Bundling data and methods together while restricting direct access to internals.

class Account {
  #balance = 0; // private field
  deposit(amt) { this.#balance += amt; }
  getBalance() { return this.#balance; }
}
// account.#balance → SyntaxError

Encapsulation is the OOP principle of bundling data (properties) with the methods that operate on that data, and restricting direct access to some components. In JavaScript, private fields use the # prefix. In Python, the convention is a _ prefix. Encapsulation hides implementation details and exposes a clean interface, preventing outside code from putting the object in an invalid state.

Exportprogramming foundations

A statement that makes values from a module available to other files.

// Named exports
export const PI = 3.14;
export function add(a, b) { return a + b; }

// Default export
export default class App { }

The export statement marks values (functions, variables, classes) as available for import by other modules. JavaScript has named exports (multiple per file: `export function add()`) and default exports (one per file: `export default class App`). Python implicitly exports all top-level names. Exporting defines a module's public API.

Enqueue/Dequeuedata structures algorithms

The two fundamental queue operations — add to back and remove from front.

queue.enqueue("task1"); // add to back
queue.dequeue();       // remove from front

Enqueue adds an element to the back of the queue. Dequeue removes and returns the element at the front. Both should be O(1) in an efficient implementation. In JavaScript, push/shift simulate a queue but shift is O(n); a linked list or circular buffer is more efficient.

Event-Driven Architectureoperating systems

A programming model where the flow is determined by events (I/O completion, user actions).

// Event-driven: respond to events
server.on('request', handleRequest);
button.addEventListener('click', handleClick);
// Event loop runs continuously

Event-driven programs wait for and respond to events rather than executing linearly. An event loop checks for events and dispatches handlers. Node.js, browser JavaScript, and GUI frameworks are event-driven. This model excels at I/O-heavy workloads with many concurrent connections.

Eventual Consistencydistributed systems

A model where all replicas will converge to the same state given enough time.

// Write to primary: name = "Bob"
// Replica 1: name = "Bob" (updated)
// Replica 2: name = "Alice" (stale)
// Eventually: both = "Bob"

Eventual consistency guarantees that if no new updates are made, all replicas will eventually hold the same data. Reads may return stale data temporarily. DNS, CDN caches, and social media feeds are eventually consistent. Stronger models (read-your-writes, monotonic reads) add guarantees on top.

Embeddingdeep learning llms

A dense vector representation of discrete data (words, items, users).

# Word embeddings
"king"  → [0.2, 0.8, -0.3, ...]
"queen" → [0.1, 0.9, -0.2, ...]
# Similar words = close vectors
cosine_similarity(king, queen) ≈ 0.85

An embedding maps discrete items to continuous vectors in a learned space. Similar items have similar vectors. Word embeddings (Word2Vec, GloVe) capture semantic meaning: king - man + woman ≈ queen. Embeddings are the input to transformers and recommendation systems. Dimensions typically 64-1536.

Execution Plandatabases

The step-by-step strategy a database uses to execute a query.

EXPLAIN ANALYZE
SELECT * FROM users WHERE email = 'alice@example.com';
-- Index Scan using idx_users_email on users

An execution plan shows exactly how the database will retrieve data: which indexes it uses, the join order, whether it does sequential scans or index lookups, and estimated costs. Use EXPLAIN or EXPLAIN ANALYZE to view the plan.

Exponential Backoffdistributed systems

A retry strategy where the delay between attempts doubles each time.

async function retry(fn, maxRetries = 5) {
  for (let i = 0; i < maxRetries; i++) {
    try { return await fn(); }
    catch (e) { await sleep(Math.pow(2, i) * 1000); }
  }
}

Exponential backoff increases the wait time between retries exponentially (e.g., 1s, 2s, 4s, 8s) to reduce load on a struggling service. Combined with jitter to prevent synchronized retry storms.

Encryptionnetworking

Transforming readable data into unreadable ciphertext to protect it from unauthorized access.

const encrypted = encrypt('hello', secretKey);
const decrypted = decrypt(encrypted, secretKey);

Encryption converts plaintext into ciphertext using an algorithm and a key. Symmetric (AES) uses one shared key. Asymmetric (RSA) uses public/private key pairs. TLS uses both.

Endpointnetworking

A specific URL path that an API exposes for clients to interact with.

GET    /api/users         // list all
POST   /api/users         // create
GET    /api/users/:id     // get one
DELETE /api/users/:id     // delete

An endpoint is a specific URL combined with an HTTP method that an API makes available. Well-designed endpoints use nouns for resources and HTTP methods for actions.

Expected Valuemathematics

The average outcome of a random event over many repetitions.

const outcomes = [1, 2, 3, 4, 5, 6];
const probs = [0.1, 0.1, 0.1, 0.1, 0.1, 0.5];
const ev = outcomes.reduce((s, x, i) => s + x * probs[i], 0);

Expected value is the weighted average of all possible outcomes: E(X) = sum of x * P(x). Represents the long-run average.

Exponential Growthmathematics

Growth where a quantity multiplies by a constant factor in each time period.

const initial = 100;
const years = 10;
const pop = initial * Math.pow(2, years); // 102400

Exponential growth follows f(t) = a * b^t. Starts slowly but accelerates dramatically. Critical for understanding algorithm complexity and compound interest.

Error Handlingprogramming foundations

The practice of anticipating, detecting, and responding to errors in code.

try {
  const data = JSON.parse(input);
} catch (error) {
  console.error("Invalid JSON:", error.message);
}

Error handling uses try/catch blocks, error types, and recovery strategies to gracefully handle problems. Good error handling prevents crashes, provides useful error messages, and maintains system stability.

Exponentarithmetic

A number indicating how many times a base is multiplied by itself.

Math.pow(2, 3);  // 8 (2 * 2 * 2)
2 ** 3;          // 8 (ES6 syntax)
10 ** 0;         // 1

An exponent (or power) tells you how many times to use a base number as a factor. In the expression b^n, b is the base and n is the exponent, meaning b multiplied by itself n times. Special cases include x^0 = 1 for any nonzero x, and x^1 = x.

Expressionarithmetic

A combination of numbers, operators, and grouping symbols that represents a value.

let result = 3 + 5 * 2;    // 13
let grouped = (3 + 5) * 2;  // 16

An expression is a mathematical phrase that combines numbers, variables, and operations to produce a value. Unlike an equation, an expression does not contain an equals sign. Examples include 3 + 5, 2 * (4 + 1), and x + 7. Evaluating an expression means computing its result.

Elimination Methodalgebra

A technique for solving systems of equations by adding or subtracting equations to eliminate a variable.

// 2x + 3y = 12
//  x - 3y = -3
// Add equations: 3x = 9, so x = 3
// Substitute: 2(3) + 3y = 12 => y = 2
let x = 3, y = 2;

The elimination method solves a system of equations by combining equations so that one variable cancels out. You may need to multiply one or both equations by a constant first so that the coefficients of one variable are opposites. The remaining single-variable equation is then solved, and the result is substituted back to find the other variable.

Existential Quantifierlogic proofs

A logical symbol asserting that there exists at least one element satisfying a given predicate.

const numbers = [1, 4, 7, 10];
// "There exists an even number"
numbers.some(n => n % 2 === 0); // true (witness: 4)

The existential quantifier (denoted by the symbol 'there exists') asserts that at least one element in the domain of discourse makes the predicate true. The statement 'there exists x such that P(x)' is true if P(x) holds for at least one value of x. To prove an existential statement, it suffices to exhibit one witness. To disprove it, one must show P(x) is false for every x in the domain.

Ellipseprecalculus

A conic section defined as the set of all points whose distances to two fixed foci sum to a constant.

// Points on an ellipse with semi-major a=5, semi-minor b=3
const a = 5, b = 3;
for (let t = 0; t < 2 * Math.PI; t += Math.PI / 4) {
  const x = a * Math.cos(t);
  const y = b * Math.sin(t);
  console.log(`(${x.toFixed(2)}, ${y.toFixed(2)})`);
}

An ellipse is the locus of points in a plane such that the sum of the distances from any point on the curve to two fixed points (foci) is constant. Its standard form centered at the origin is x²/a² + y²/b² = 1, where a is the semi-major axis and b is the semi-minor axis. The eccentricity e = c/a (where c² = a² − b²) measures how elongated the ellipse is, with e = 0 producing a circle.

End Behaviorprecalculus

The trend of a function's output values as the input approaches positive or negative infinity.

// End behavior of f(x) = -2x^3 + x
const f = x => -2 * x ** 3 + x;
console.log(f(1000));  // -2e9  — falls to -∞ as x → +∞
console.log(f(-1000)); // 2e9   — rises to +∞ as x → -∞

End behavior describes what happens to f(x) as x → +∞ and x → −∞. For polynomial functions, end behavior is determined by the leading term aₙxⁿ: if n is even and aₙ > 0, both ends rise; if n is odd and aₙ > 0, the left end falls and the right end rises. Understanding end behavior is crucial for sketching graphs and classifying polynomial and rational functions without plotting every point.

Exponential Functionprecalculus

A function of the form f(x) = a·bˣ where the variable appears in the exponent and b > 0, b ≠ 1.

// Exponential growth and decay
const growth = x => 2 ** x;       // base 2 growth
const decay = x => (0.5) ** x;    // base 0.5 decay
console.log(growth(10)); // 1024
console.log(decay(10));  // ~0.000977
console.log(Math.E);     // 2.718281828...

An exponential function has the form f(x) = a·bˣ, where a is a nonzero constant, b is a positive base not equal to 1, and x is the exponent. When b > 1 the function models exponential growth; when 0 < b < 1 it models exponential decay. The natural exponential function f(x) = eˣ, where e ≈ 2.71828, is especially important because its derivative equals itself, making it foundational in calculus and continuous growth models.

Epsilon-Delta (Intuition)calculus

The rigorous framework for defining limits using arbitrarily small error bounds.

// Demonstrate epsilon-delta: limit of 2x as x->3 is 6
function verifyLimit(f, a, L, epsilon) {
  const delta = epsilon / 2; // for f(x)=2x
  const x = a + delta * 0.5; // pick x within delta
  return Math.abs(f(x) - L) < epsilon;
}
console.log(verifyLimit(x => 2*x, 3, 6, 0.01)); // true

The epsilon-delta definition states that the limit of f(x) as x approaches a equals L if for every epsilon > 0 there exists a delta > 0 such that whenever 0 < |x - a| < delta, then |f(x) - L| < epsilon. Intuitively, you can make f(x) as close to L as desired by making x sufficiently close to a.

Eigenvaluelinear algebra

A scalar lambda such that a matrix A maps some nonzero vector to lambda times that vector.

// For a 2x2 matrix, eigenvalues solve: lambda^2 - trace*lambda + det = 0
function eigenvalues2x2(m) {
  const trace = m[0][0] + m[1][1];
  const det = m[0][0]*m[1][1] - m[0][1]*m[1][0];
  const disc = Math.sqrt(trace*trace - 4*det);
  return [(trace + disc)/2, (trace - disc)/2];
}
console.log(eigenvalues2x2([[2, 1], [1, 2]])); // [3, 1]

An eigenvalue of a square matrix A is a scalar lambda for which there exists a nonzero vector v satisfying Av = lambda*v. Eigenvalues are found by solving the characteristic equation det(A - lambda*I) = 0. They reveal how a linear transformation stretches or compresses along specific directions and are essential in stability analysis, principal component analysis, and differential equations.

Eigenvectorlinear algebra

A nonzero vector whose direction is unchanged when a matrix is applied to it.

// Verify that v is an eigenvector of A
function matVecMul(A, v) {
  return A.map(row => row.reduce((s, a, i) => s + a * v[i], 0));
}
const A = [[2, 1], [1, 2]];
const v = [1, 1]; // eigenvector
console.log(matVecMul(A, v)); // [3, 3] = 3 * [1, 1]

An eigenvector of a square matrix A is a nonzero vector v such that Av = lambda*v for some scalar lambda (the corresponding eigenvalue). The eigenvector's direction is preserved under the transformation; only its magnitude is scaled by lambda. The set of all eigenvectors for a given eigenvalue, together with the zero vector, forms the eigenspace for that eigenvalue.

Eventprobability stats

A subset of a sample space representing one or more outcomes to which a probability is assigned.

// Events in a dice roll
const sampleSpace = [1, 2, 3, 4, 5, 6];
const even = sampleSpace.filter(x => x % 2 === 0); // {2, 4, 6}
const greaterThan4 = sampleSpace.filter(x => x > 4); // {5, 6}
const union = [...new Set([...even, ...greaterThan4])];
console.log(`P(even) = ${even.length}/${sampleSpace.length}`);
console.log(`P(even ∪ >4) = ${union.length}/${sampleSpace.length}`);

In probability theory, an event is any subset of the sample space S. Simple events contain a single outcome, while compound events contain multiple outcomes. Events can be combined using set operations: union (A ∪ B, 'A or B'), intersection (A ∩ B, 'A and B'), and complement (Aᶜ, 'not A'). The probability of an event is a number between 0 and 1 satisfying the probability axioms.

Expected Valueprobability stats

The long-run average value of a random variable over many independent repetitions of an experiment.

// Expected value of a loaded die
const probs = { 1: 0.1, 2: 0.1, 3: 0.1, 4: 0.1, 5: 0.1, 6: 0.5 };
let ev = 0;
for (const [val, p] of Object.entries(probs)) {
  ev += Number(val) * p;
}
console.log(`E[X] = ${ev}`); // 4.5

The expected value E[X] of a discrete random variable X is the sum Σ x·P(X=x) over all possible values x. For continuous variables, it is the integral ∫ x·f(x)dx. Expected value is a measure of central tendency that represents the theoretical mean of the distribution. It is linear—E[aX+b] = aE[X]+b—and additive for any random variables: E[X+Y] = E[X]+E[Y], regardless of dependence.

Euclidean Algorithmdiscrete math

An efficient method for computing the greatest common divisor of two integers using repeated division.

// Euclidean Algorithm for GCD
function gcd(a, b) {
  while (b !== 0) {
    [a, b] = [b, a % b];
  }
  return a;
}
console.log(gcd(48, 18)); // 6

The Euclidean Algorithm computes gcd(a, b) by repeatedly applying the relation gcd(a, b) = gcd(b, a mod b) until the remainder is zero; the last nonzero remainder is the GCD. It runs in O(log(min(a, b))) steps. The Extended Euclidean Algorithm additionally finds integers x and y such that ax + by = gcd(a, b), which is essential for computing modular inverses.

Edge (Graph Theory)discrete math

A connection between two vertices in a graph.

// Representing edges as an array of pairs
const edges = [
  ['A', 'B'],
  ['B', 'C'],
  ['A', 'C']
];
console.log(`Graph has ${edges.length} edges`); // 3

An edge is a pair of vertices representing a connection or relationship in a graph. In an undirected graph, an edge {u, v} connects vertices u and v symmetrically. In a directed graph, an edge (u, v) is an ordered pair indicating direction from u to v. Edges may carry weights or labels. The number of edges in a graph is commonly denoted |E|.

Epsilon-Delta Definitionreal analysis

The formal framework using two positive quantities to define limits and continuity.

// Find delta for f(x)=2x+1 at c=3, given epsilon
function findDelta(epsilon) {
  // |f(x)-f(c)| = |2x+1-(2*3+1)| = 2|x-3|
  // Need 2*delta < epsilon, so delta = epsilon/2
  return epsilon / 2;
}
console.log(findDelta(0.1));  // 0.05
console.log(findDelta(0.01)); // 0.005

The epsilon-delta definition provides the rigorous foundation for limits in analysis. For continuity, it states: f is continuous at c if for every epsilon > 0 there exists delta > 0 such that |x - c| < delta implies |f(x) - f(c)| < epsilon. Epsilon represents the desired closeness in the output, and delta represents the required closeness in the input. This framework eliminates vague notions like 'approaching' in favor of precise quantified statements.

Exponential Decayprecalculus

A function that decreases by a constant factor over equal intervals: f(t) = a*b^t where 0 < b < 1.

// Exponential decay: half-life example
const a = 100, b = 0.5; // halves each period
for (let t = 0; t <= 5; t++) {
  console.log(`t=${t}: ${a * Math.pow(b, t)}`);
}

Exponential decay describes a quantity that shrinks by the same proportion in each equal time period, modeled by f(t) = a * b^t where 0 < b < 1. The value a is the initial amount and b is the decay factor. Real-world examples include radioactive decay, cooling objects, and depreciation of assets.

Exponential Growthprecalculus

A function that increases by a constant factor over equal intervals: f(t) = a*b^t where b > 1.

// Exponential growth: doubling each period
const a = 1, b = 2;
for (let t = 0; t <= 8; t++) {
  console.log(`t=${t}: ${a * Math.pow(b, t)}`);
}

Exponential growth describes a quantity that multiplies by the same factor in each equal time period, modeled by f(t) = a * b^t where b > 1. The value a is the initial amount and b is the growth factor. This pattern appears in population growth, compound interest, and viral spreading.

F
For Loopprogramming foundations

A loop that iterates over a sequence or a fixed number of times.

for (const x of [1, 2, 3]) {
  console.log(x);
}

A for loop iterates over a sequence (array, range, string) or executes a specified number of times. In JavaScript: `for (let i = 0; i < n; i++)` or `for (const item of array)`. In Python: `for item in sequence:`. For loops are preferred when you know the number of iterations in advance.

Functionprogramming foundations

A reusable block of code that performs a specific task.

function add(a, b) {
  return a + b;
}
add(2, 3); // 5

A function is a named, reusable block of code that takes input (parameters), performs a computation, and optionally returns output. Functions are the primary tool for organizing and reusing code. They enable abstraction — you can use a function without knowing its implementation details.

Function Scopeprogramming foundations

Variables declared inside a function are accessible only within that function.

function foo() {
  var x = 1; // function-scoped
  if (true) {
    var y = 2; // ALSO function-scoped!
  }
  console.log(y); // 2 (accessible!)
}

Function scope means a variable exists from the point of declaration until the function returns. In JavaScript, `var` is function-scoped (visible throughout the entire function, even before declaration due to hoisting). In Python, all local variables are function-scoped.

Filterprogramming foundations

Creates a new array with only the elements that pass a boolean test.

[1, 2, 3, 4, 5].filter(x => x > 3)
// [4, 5]

The filter method creates a new array containing only the elements for which the provided test function returns true. The original array is unchanged. The result may have fewer elements than the original. In Python, the equivalent is `[x for x in arr if condition(x)]`.

For...of Loopprogramming foundations

A loop that iterates over the values of any iterable (array, string, map, etc.).

for (const item of ["a", "b", "c"]) {
  console.log(item); // "a", "b", "c"
}
for (const ch of "hello") {
  console.log(ch); // "h","e","l","l","o"
}

The `for...of` loop (JavaScript) or `for...in` loop (Python) iterates over the values produced by an iterable object. Unlike a traditional `for (let i = 0; ...)` loop, it doesn't require index management. It works with arrays, strings, maps, sets, generators, and any object that implements the iterator protocol.

Finallyprogramming foundations

A block that always executes after try/catch, regardless of whether an error occurred.

try {
  openFile();
  processData();
} catch (e) {
  logError(e);
} finally {
  closeFile(); // always runs
}

The finally block runs after the try block completes, whether an error was thrown or not. It's used for cleanup operations that must happen regardless — closing files, releasing resources, resetting state. Even if the try or catch block contains a return statement, the finally block still executes.

FIFOdata structures algorithms

First In, First Out — the earliest added item is removed first.

enqueue A, enqueue B, enqueue C
dequeue → A (first in, first out)
dequeue → B
dequeue → C

FIFO (First In, First Out) is the ordering principle of a queue. The first element enqueued is the first dequeued. Print jobs, web server request queues, and message queues all follow FIFO ordering.

File Systemoperating systems

The OS component that organizes and stores files on disk in a hierarchy.

import fs from 'fs';
fs.readFileSync('/path/to/file', 'utf-8');
fs.writeFileSync('/path/to/file', 'data');

A file system manages how data is stored and retrieved on disk. Files are organized in a tree of directories. Common file systems: ext4 (Linux), APFS (macOS), NTFS (Windows). Operations: create, read, write, delete, rename. File metadata includes permissions, timestamps, and size.

File Descriptoroperating systems

An integer that the OS uses to track an open file or I/O stream.

// 0 = stdin, 1 = stdout, 2 = stderr
process.stdout.write('hello'); // fd 1
process.stderr.write('error'); // fd 2

When a program opens a file, the OS returns a file descriptor (small integer). FD 0 = stdin, FD 1 = stdout, FD 2 = stderr. All I/O operations reference file descriptors. Too many open file descriptors = resource leak. Closing files releases their descriptors.

Foreign Keydatabases

A column that references the primary key of another table, creating a relationship.

CREATE TABLE orders (
  id SERIAL PRIMARY KEY,
  user_id INT REFERENCES users(id),
  total DECIMAL NOT NULL
);

A foreign key creates a link between two tables. It references the primary key of another table, enforcing referential integrity — you can't insert a foreign key value that doesn't exist in the referenced table. Deleting a referenced row can CASCADE (delete dependents), SET NULL, or RESTRICT.

Failure Cascadedistributed systems

A chain reaction where one service failure causes dependent services to fail.

// C is slow -> B threads exhaust -> A threads exhaust
const breaker = new CircuitBreaker(callServiceC);
try { await breaker.fire(); }
catch (e) { return fallbackResponse(); }

A failure cascade occurs when a failing service causes its callers to time out or exhaust resources, propagating through the system like falling dominoes. Circuit breakers and bulkheads are the primary defenses.

Forward Proxynetworking

A server that makes requests on behalf of clients, hiding their identity.

// Without: Client (1.2.3.4) -> Server
// With: Client -> Proxy (5.6.7.8) -> Server
// Server sees proxy IP only

A forward proxy sits between clients and the internet, forwarding client requests to destination servers. The destination sees the proxy's IP, not the client's.

Full-Duplexnetworking

A communication mode where both sides can send and receive data simultaneously.

const ws = new WebSocket('wss://chat.example.com');
ws.send('Hello from client');
ws.onmessage = (e) => console.log(e.data);

Full-duplex means data flows in both directions at the same time. WebSockets provide full-duplex communication. HTTP is half-duplex: request, then response.

Feature Engineeringmachine learning

Creating, transforming, or selecting input variables to improve model performance.

df['age_squared'] = df['age'] ** 2
df['price_per_sqft'] = df['price'] / df['sqft']
df['is_weekend'] = df['day'].isin([5, 6])

Feature engineering uses domain knowledge to craft input features. Techniques: normalization, one-hot encoding, creating interaction features, extracting date parts.

Feed-Forward Networkdeep learning llms

A neural network where data flows in one direction through fully connected layers.

# FFN in a transformer
# Input: 768-dim -> expand to 3072 -> back to 768
ffn_output = linear2(gelu(linear1(x)))

A feed-forward network passes data through layers sequentially with no loops. In a transformer block, the FFN has two linear layers with a GELU activation in between.

Few-Shot Learningdeep learning llms

Providing a few input-output examples in the prompt to teach the model a task.

// Few-shot classification
// 'Loved it!' -> positive
// 'Total waste' -> negative
// 'Best purchase ever!' -> ?

Few-shot learning gives an LLM a handful of examples (2-5) within the prompt. The model generalizes from these examples without any weight updates.

Fine-Tuningdeep learning llms

Further training a pretrained model on a specific dataset to specialize its behavior.

from transformers import Trainer, TrainingArguments
trainer = Trainer(
    model=pretrained_model,
    train_dataset=my_dataset,
    args=TrainingArguments(num_train_epochs=3)
)
trainer.train()

Fine-tuning continues training a pretrained model on a smaller, task-specific dataset. Full fine-tuning updates all weights. LoRA updates only a small subset.

Function as a Service (FaaS)production engineering

A cloud model where you deploy individual functions that run on demand.

export async function handler(event) {
  const name = event.queryStringParameters.name;
  return { statusCode: 200, body: `Hello ${name}` };
}

FaaS executes individual functions in response to events. The provider handles all infrastructure. You pay only for actual execution time. AWS Lambda, Cloud Functions, Cloudflare Workers.

Fast-Forward Mergegit version control

A merge where the branch pointer simply moves forward because there is no divergence.

// main: A -> B
// feature: A -> B -> C -> D
// git merge feature -> main moves to D

A fast-forward merge happens when the target branch has no new commits since the source diverged. Git moves the pointer forward — no merge commit needed.

Fetchgit version control

Downloading remote changes without merging them into your local branch.

// git fetch origin
// git log HEAD..origin/main
// git merge origin/main

Fetching downloads new commits but does not modify your working directory. Lets you review incoming changes before integrating.

Firmwarecomputer hardware

Low-level software permanently stored on hardware that initializes and controls devices.

// Firmware runs before any OS code
// 1. Power on -> firmware starts
// 2. Initialize CPU, RAM, GPU
// 3. Run POST diagnostics
// 4. Find bootloader on disk
// 5. Hand off control

Firmware is software embedded in hardware chips (ROM/flash) that runs before the OS loads. It initializes hardware components, runs POST diagnostics, and hands off control to the bootloader. BIOS and UEFI are the most common firmware on PCs.

Filesystemsoperating systems

The system that organizes and manages how data is stored and retrieved on disk.

// Filesystem operations
fs.writeFileSync("/data/file.txt", "hello");
fs.readFileSync("/data/file.txt"); // "hello"
fs.readdirSync("/data/"); // ["file.txt"]

A filesystem defines how files are named, stored, organized into directories, and accessed on a storage device. Common filesystems: ext4 (Linux), APFS (macOS), NTFS (Windows). The filesystem maps logical file paths to physical disk locations.

Factorarithmetic

A whole number that divides evenly into another number with no remainder.

// Find all factors of 12
for (let i = 1; i <= 12; i++) {
  if (12 % i === 0) console.log(i);
}
// 1, 2, 3, 4, 6, 12

A factor of a number n is any integer that divides n exactly, leaving no remainder. For example, the factors of 12 are 1, 2, 3, 4, 6, and 12. Every number greater than 1 has at least two factors: 1 and itself. Factoring is essential in simplifying fractions and finding common denominators.

Fractionarithmetic

A number representing a part of a whole, written as one integer over another.

// 3/4 as a decimal
let threeQuarters = 3 / 4;  // 0.75
// Simplify 6/8 by dividing by GCD (2)
let num = 6 / 2;   // 3
let den = 8 / 2;   // 4

A fraction consists of a numerator (top number) and a denominator (bottom number), separated by a division bar. It represents the numerator divided by the denominator. Fractions can be proper (numerator < denominator), improper (numerator >= denominator), or mixed numbers. They are equivalent to decimals and can be simplified by dividing by common factors.

Factoringalgebra

The process of rewriting an expression as a product of simpler expressions.

// Factor x² + 5x + 6 = (x + 2)(x + 3)
let x = 4;
let original = x ** 2 + 5 * x + 6;     // 42
let factored = (x + 2) * (x + 3);       // 42

Factoring is the reverse of expanding: it breaks an expression into a product of factors. Common techniques include pulling out a common factor, using the difference of squares pattern, and factoring trinomials. For example, x² + 5x + 6 = (x + 2)(x + 3). Factoring is a primary method for solving quadratic equations.

Function (Mathematics)algebra

A rule that assigns exactly one output to each input from its domain.

// f(x) = 2x + 1
function f(x) {
  return 2 * x + 1;
}
f(3);  // 7
f(0);  // 1

A mathematical function is a relation that maps each element in a set of inputs (the domain) to exactly one element in a set of outputs (the range). Functions can be expressed as formulas (f(x) = 2x + 1), tables, graphs, or verbal descriptions. The vertical line test determines whether a graph represents a function.

Function Notationalgebra

The notation f(x) used to name a function and indicate its input variable.

// f(x) = x² + 1
const f = (x) => x ** 2 + 1;
// g(x) = 2x - 3
const g = (x) => 2 * x - 3;
f(4);  // 17
g(4);  // 5

Function notation uses the form f(x) to define a function named f with input variable x. The notation f(3) means "evaluate f at x = 3" by substituting 3 wherever x appears. Different letters can name different functions (f, g, h), and the input variable can be any letter. This notation clearly distinguishes between the function itself and its value at a specific point.

Fundamental Theorem of Calculuscalculus

The theorem linking differentiation and integration as inverse operations.

// FTC Part 2: integral of 2x from 0 to 3
// Antiderivative F(x) = x^2
const F = x => x * x;
const result = F(3) - F(0);
console.log(result); // 9

The Fundamental Theorem of Calculus has two parts. Part 1 states that if F(x) is the integral of f from a to x, then F'(x) = f(x). Part 2 states that the definite integral of f from a to b equals F(b) - F(a) for any antiderivative F. Together they establish that differentiation and integration undo each other.

First-Order ODEdifferential equations

A differential equation involving only the first derivative of the unknown function.

// Euler's method for dy/dx = -2y, y(0) = 1
let y = 1, x = 0;
const h = 0.1;
for (let i = 0; i < 10; i++) {
  y = y + h * (-2 * y);
  x += h;
  console.log(`x=${x.toFixed(1)}, y=${y.toFixed(4)}`);
}

A first-order ODE has the general form dy/dx = f(x, y), where the highest derivative present is the first derivative. These equations model rates of change such as population growth, radioactive decay, and cooling processes. Common solution methods include separation of variables, integrating factors, and exact equation techniques.

Fibonacci Sequencediscrete math

A sequence where each term is the sum of the two preceding terms, starting from 0 and 1.

// Iterative Fibonacci
function fibonacci(n) {
  let [a, b] = [0, 1];
  for (let i = 0; i < n; i++) {
    [a, b] = [b, a + b];
  }
  return a;
}
console.log(fibonacci(10)); // 55

The Fibonacci sequence is defined by the recurrence relation F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n ≥ 2, producing the sequence 0, 1, 1, 2, 3, 5, 8, 13, ... It is the canonical example of a second-order linear recurrence relation. The ratio of consecutive terms converges to the golden ratio phi ≈ 1.618, and the sequence has a closed-form solution known as Binet's formula.

Fieldabstract algebra

A ring in which every nonzero element has a multiplicative inverse.

A field is a set F equipped with two binary operations, addition and multiplication, satisfying the ring axioms plus the requirement that every nonzero element has a multiplicative inverse. Equivalently, a field is a commutative ring in which the nonzero elements form a group under multiplication. The rational numbers, real numbers, and complex numbers are all fields, whereas the integers are not because most elements lack multiplicative inverses.

Function Compositionprecalculus

Applying one function to the output of another: (f o g)(x) = f(g(x)).

// Function composition
const f = x => x * x;
const g = x => x + 1;
const compose = (f, g) => x => f(g(x));
const h = compose(f, g);
console.log(h(3)); // f(g(3)) = f(4) = 16

Function composition chains two functions together by using the output of one as the input of another. Written as (f o g)(x) = f(g(x)), the inner function g is evaluated first and its result is passed to the outer function f. The domain of the composition is restricted to inputs where g(x) lies within the domain of f.

FTC Part 1calculus

If F(x) = integral from a to x of f(t) dt, then F'(x) = f(x).

The first part of the Fundamental Theorem of Calculus states that if f is continuous on [a, b] and F(x) is defined as the integral from a to x of f(t) dt, then F is differentiable and F'(x) = f(x). This establishes that differentiation and integration are inverse operations. It guarantees every continuous function has an antiderivative.

FTC Part 2calculus

The integral from a to b of f(x) dx equals F(b) - F(a) where F' = f.

The second part of the Fundamental Theorem of Calculus provides a practical method for evaluating definite integrals. If F is any antiderivative of a continuous function f on [a, b], then the integral from a to b of f(x) dx = F(b) - F(a). This transforms the problem of computing areas into finding antiderivatives.

Fundamental Theorem of Calculuscalculus

The two-part theorem linking differentiation and integration.

The Fundamental Theorem of Calculus is the central result connecting the two main branches of calculus. Part 1 shows that the derivative of an accumulation function recovers the original integrand. Part 2 shows that definite integrals can be evaluated using any antiderivative, bridging the concepts of rate of change and accumulated quantity.

G
Global Scopeprogramming foundations

Variables declared outside all functions and blocks, accessible everywhere.

let apiUrl = "https://..."; // global

function fetch() {
  console.log(apiUrl); // accessible
}

The global scope is the outermost scope in a program. Variables declared in global scope are accessible from any function or block. Overusing global variables is considered bad practice because any part of the program can modify them, making bugs hard to track. In Node.js, each module has its own scope (not truly global).

Generatorprogramming foundations

A function that can pause and resume, yielding values one at a time.

function* count() {
  let i = 0;
  while (true) {
    yield i++;
  }
}
const gen = count();
gen.next().value; // 0
gen.next().value; // 1

A generator is a special function that produces a sequence of values lazily — one at a time, on demand. In JavaScript, generators use `function*` and `yield`. In Python, any function with `yield` is a generator. Generators are memory-efficient because they compute values as needed rather than storing the entire sequence in memory.

Graphdata structures algorithms

A data structure of vertices (nodes) connected by edges.

// Adjacency list
const graph = {
  A: ["B", "C"],
  B: ["A", "D"],
  C: ["A"],
  D: ["B"]
};

A graph G = (V, E) consists of vertices (nodes) and edges (connections). Graphs model relationships: social networks, maps, dependencies, web links. Graphs can be directed (one-way edges) or undirected, weighted or unweighted. Represented as adjacency lists or matrices.

Garbage Collectionoperating systems

Automatic reclamation of memory occupied by objects no longer in use.

let obj = { big: new Array(1000000) };
obj = null; // old object becomes unreachable
// GC will eventually reclaim the memory

Garbage collection (GC) automatically frees heap memory that's no longer reachable from the program's root references. Mark-and-sweep: mark all reachable objects, sweep unreachable ones. GC pauses can cause latency spikes. JavaScript's V8 uses generational GC. Python uses reference counting + cycle detection.

Gradient Descentmathematics

An optimization algorithm that iteratively moves toward a function's minimum.

# Gradient descent update rule
weights = weights - learning_rate * gradient

# For 1000 steps:
for step in range(1000):
    grad = compute_gradient(weights, data)
    weights -= 0.01 * grad

Gradient descent minimizes a function by repeatedly stepping in the direction opposite to the gradient (steepest ascent). The learning rate controls step size. Too large = overshoot, too small = slow convergence. Stochastic GD (SGD) uses random subsets of data for efficiency. Adam optimizer adapts learning rates per parameter.

Gradientmathematics

A vector of partial derivatives pointing in the direction of steepest increase.

// Gradient of f(x,y) = x^2 + y^2 at (3,4)
const grad = [2 * 3, 2 * 4]; // [6, 8]

The gradient contains the partial derivative of a function with respect to each input variable. In ML, gradient descent moves opposite to the gradient to minimize loss.

Gitgit version control

A distributed version control system for tracking changes in source code.

// git init
// git add .
// git commit -m 'Initial commit'

Git records every change to your files in a complete history. Every developer has a full copy of the repository. Enables branching, merging, and collaboration.

GitHub Flowgit version control

A lightweight branching workflow: branch, commit, PR, review, merge.

// 1. git checkout -b feature-x
// 2. commit changes
// 3. git push, open PR
// 4. review, merge, delete branch

GitHub Flow: all work on short-lived branches off main, open PR for review, merge after approval. Main is always deployable.

Git Resetgit version control

A command that moves the branch pointer backward, undoing commits.

// git reset --soft HEAD~1  (keep staged)
// git reset HEAD~1         (keep unstaged)
// git reset --hard HEAD~1  (discard all)

git reset moves the branch pointer to a specified commit. --soft keeps changes staged, --mixed keeps changes unstaged (default), --hard discards everything.

Greatest Common Divisorarithmetic

The largest positive integer that divides two or more numbers without a remainder.

function gcd(a, b) {
  while (b !== 0) {
    [a, b] = [b, a % b];
  }
  return a;
}
gcd(12, 18);  // 6

The greatest common divisor (GCD), also called the greatest common factor, is the largest number that evenly divides all given numbers. For example, the GCD of 12 and 18 is 6. The Euclidean algorithm efficiently computes the GCD by repeatedly applying division with remainder. The GCD is used to simplify fractions to lowest terms.

Geometric Seriescalculus 2

An infinite series where each term is a constant ratio times the previous term.

// Geometric series: sum of (1/2)^n from n=0
function geometricSum(a, r, N) {
  let sum = 0;
  let term = a;
  for (let n = 0; n <= N; n++) {
    sum += term;
    term *= r;
  }
  return sum;
}
console.log(geometricSum(1, 0.5, 50)); // approaches 2

A geometric series has the form sum of a * r^n for n = 0 to infinity, where a is the first term and r is the common ratio. It converges if and only if |r| < 1, in which case the sum equals a / (1 - r). Geometric series are fundamental building blocks in the study of series convergence and serve as comparison benchmarks for other series.

Gaussian Eliminationlinear algebra

A systematic algorithm for solving systems of linear equations by reducing a matrix to row echelon form.

// Forward elimination step for a 2x2 system
function eliminate(A) {
  const factor = A[1][0] / A[0][0];
  A[1] = A[1].map((val, j) => val - factor * A[0][j]);
  return A; // now A[1][0] === 0
}
const aug = [[2, 1, 5], [4, -1, 3]];
console.log(eliminate(aug)); // [[2,1,5],[0,-3,-7]]

Gaussian elimination transforms an augmented matrix [A|b] into row echelon form through a sequence of elementary row operations: swapping rows, scaling a row by a nonzero constant, and adding a multiple of one row to another. Once in row echelon form, back-substitution yields the solution. Continuing to reduced row echelon form (Gauss-Jordan elimination) produces solutions directly without back-substitution.

Gradient Vectormultivariable calc

A vector of all partial derivatives of a scalar function, pointing in the direction of steepest increase.

// Numerical gradient in 2D
const grad_x = (f(x+h, y) - f(x-h, y)) / (2*h);
const grad_y = (f(x, y+h) - f(x, y-h)) / (2*h);

The gradient of f(x, y, z) is the vector ∇f = (∂f/∂x, ∂f/∂y, ∂f/∂z). Its direction indicates the direction of greatest rate of increase of f, and its magnitude equals that maximum rate. The gradient is perpendicular to level curves (2D) or level surfaces (3D) of f at every point.

Green's Theoremmultivariable calc

A theorem relating a line integral around a simple closed curve to a double integral over the region it encloses.

Green's Theorem states that for a positively oriented, simple closed curve C bounding region D, ∮_C (P dx + Q dy) = ∬_D (∂Q/∂x − ∂P/∂y) dA. It connects circulation along the boundary to the curl-like quantity inside. Green's Theorem is a special two-dimensional case of the more general Stokes' Theorem.

General Solutiondifferential equations

The family of all solutions to a differential equation, expressed with arbitrary constants.

// General solution of dy/dx = 3x^2 is y = x^3 + C
function generalSolution(x, C) {
  return Math.pow(x, 3) + C;
}
console.log('C=0:', generalSolution(2, 0));
console.log('C=5:', generalSolution(2, 5));

The general solution of an nth-order ODE contains n arbitrary constants that parameterize every possible solution curve. It represents the complete solution space before any initial or boundary conditions are applied. Specifying values for the arbitrary constants through additional constraints yields a particular solution that satisfies a unique trajectory.

Groupabstract algebra

A set equipped with a binary operation that satisfies closure, associativity, identity, and invertibility.

// Check if (Z_4, +mod4) satisfies group axioms
const Z4 = [0, 1, 2, 3];
const op = (a, b) => (a + b) % 4;
const identity = 0;
const hasInverses = Z4.every(a => Z4.some(b => op(a, b) === identity));
console.log('Has inverses:', hasInverses); // true

A group (G, *) is a set G together with a binary operation * that satisfies four axioms: closure, associativity, existence of an identity element, and existence of inverses for every element. Groups capture the abstract essence of symmetry and are the most fundamental algebraic structure studied in abstract algebra. Examples include the integers under addition, nonzero rationals under multiplication, and permutation groups.

Group Axiomsabstract algebra

The four properties—closure, associativity, identity, and invertibility—that a set and operation must satisfy to form a group.

The group axioms are: (1) Closure: for all a, b in G, a * b is in G; (2) Associativity: for all a, b, c in G, (a * b) * c = a * (b * c); (3) Identity: there exists an element e in G such that e * a = a * e = a for all a; (4) Invertibility: for every a in G, there exists b in G such that a * b = b * a = e. These axioms are the minimal requirements that define a group, and removing or weakening any of them yields different algebraic structures such as monoids or semigroups.

Group Operationabstract algebra

The binary operation that combines two elements of a group to produce a third element within the same group.

// Modular addition as a group operation on Z_5
const groupOp = (a, b, n = 5) => ((a + b) % n + n) % n;
console.log(groupOp(3, 4)); // 2
console.log(groupOp(2, 3)); // 0

A group operation is a function * : G x G -> G that takes two elements of the set G and returns an element of G. The operation must satisfy the group axioms: it must be associative, there must be an identity element, and every element must have an inverse under this operation. The operation need not be commutative; when it is, the group is called abelian. Common examples include addition on integers and composition of permutations.

Geometric Sequenceprecalculus

A sequence with a constant ratio between consecutive terms.

// Generate a geometric sequence
const a1 = 3, r = 2, n = 6;
const seq = Array.from({length: n}, (_, i) => a1 * Math.pow(r, i));
console.log(seq); // [3, 6, 12, 24, 48, 96]

A geometric sequence is an ordered list of numbers where each term is obtained by multiplying the previous term by a fixed value, called the common ratio. For example, 3, 6, 12, 24 has a common ratio of 2. The nth term is given by a_n = a_1 * r^(n-1).

Geometric Series Sumcalculus 2

The sum a/(1 - r) for |r| < 1.

// Sum of 1 + 1/2 + 1/4 + 1/8 + ...
const a = 1, r = 0.5;
const sum = a / (1 - r);
console.log(sum); // 2

A geometric series with first term a and common ratio r converges to a/(1 - r) when the absolute value of r is less than 1. When |r| >= 1, the series diverges. This formula is one of the few closed-form sums for infinite series and serves as a benchmark for comparison tests.

Gram-Schmidt Processlinear algebra

An algorithm that converts a set of linearly independent vectors into an orthonormal set.

// Gram-Schmidt on two 2D vectors
const v1 = [3, 0];
const v2 = [1, 1];
const norm = v => Math.sqrt(v.reduce((s, x) => s + x * x, 0));
const u1 = v1.map(x => x / norm(v1));
const proj = v2.reduce((s, x, i) => s + x * u1[i], 0);
const w2 = v2.map((x, i) => x - proj * u1[i]);
const u2 = w2.map(x => x / norm(w2));
console.log('u1:', u1, 'u2:', u2);

The Gram-Schmidt process takes a set of linearly independent vectors and produces an orthonormal basis for the same subspace. It works iteratively: each new vector is made orthogonal to all previously processed vectors by subtracting projections, then normalized to unit length. This procedure is fundamental to QR factorization and many numerical algorithms.

H
Higher-Order Functionprogramming foundations

A function that takes another function as an argument or returns one.

// map takes a function as argument
[1, 2, 3].map(x => x * 2);

// makeMultiplier returns a function
function makeMultiplier(n) {
  return x => x * n;
}

A higher-order function is a function that either accepts a function as a parameter, returns a function, or both. Examples: `map(fn)`, `filter(fn)`, `reduce(fn)`, `setTimeout(fn, ms)`. Higher-order functions enable abstraction over behavior — you separate what to do (the callback) from how to iterate (the method).

Hash Mapdata structures algorithms

A data structure that maps keys to values using a hash function for O(1) average lookup.

const map = new Map();
map.set("name", "Alice"); // O(1)
map.get("name");          // "Alice" O(1)
map.has("name");          // true O(1)

A hash map (hash table, dictionary) stores key-value pairs. A hash function converts each key to an array index. Average-case O(1) for get, set, and delete. JavaScript objects and Maps, Python dicts, and Java HashMaps are all hash maps. Collisions are handled via chaining or open addressing.

Hash Functiondata structures algorithms

A function that converts a key into a numeric index for array storage.

// Simple hash: sum char codes mod table size
function hash(key, size) {
  let h = 0;
  for (const c of key) h += c.charCodeAt(0);
  return h % size;
}

A hash function takes input of any size and produces a fixed-size output (hash). For hash maps, it converts keys to array indices. A good hash function distributes keys uniformly, minimizing collisions. It must be deterministic — the same input always produces the same output.

Hash Collisiondata structures algorithms

When two different keys produce the same hash index.

hash("abc") → 5
hash("cab") → 5  // collision!
// Chaining: index 5 → [abc→1] → [cab→2]

A collision occurs when a hash function maps two different keys to the same index. Collisions are inevitable (pigeonhole principle). Resolution strategies: chaining (linked list at each index) or open addressing (probe for next empty slot). Good hash functions and proper table sizing minimize collisions.

Heap Memoryoperating systems

Flexible memory for dynamically allocated objects managed by garbage collection.

// Heap-allocated (lives beyond function)
function create() {
  return { data: [1,2,3] }; // on heap
}
const obj = create(); // reference on stack, data on heap

The heap is a large memory pool for objects that outlive the function that created them. Objects, arrays, and closures are stored on the heap. Allocation is slower than stack. Deallocation is handled by garbage collection (JS, Python) or manually (C/C++). Memory leaks occur when heap objects are no longer needed but never freed.

HTTPnetworking

The protocol that powers the web — request/response between clients and servers.

GET /api/users HTTP/1.1
Host: example.com

HTTP/1.1 200 OK
Content-Type: application/json
[{"name":"Alice"}]

HTTP (HyperText Transfer Protocol) is a stateless, text-based protocol for web communication. Clients send requests (method + URL + headers + body) and servers return responses (status code + headers + body). HTTP/1.1 uses persistent connections. HTTP/2 adds multiplexing and server push. HTTP/3 uses QUIC (UDP-based).

HTTP Methodnetworking

The verb in an HTTP request indicating the intended action (GET, POST, PUT, DELETE).

GET    /users      — list users
POST   /users      — create user
GET    /users/123  — get user 123
PUT    /users/123  — replace user 123
DELETE /users/123  — delete user 123

HTTP methods indicate the desired action: GET (retrieve data), POST (create resource), PUT (replace resource), PATCH (update partial), DELETE (remove resource). GET and HEAD are safe (no side effects). GET, PUT, and DELETE are idempotent (same result if repeated).

HTTP Status Codenetworking

A 3-digit number indicating the result of an HTTP request.

200 — OK (success)
404 — Not Found
500 — Internal Server Error
401 — Unauthorized
429 — Too Many Requests

Status codes are grouped: 2xx (success), 3xx (redirect), 4xx (client error), 5xx (server error). Key codes: 200 OK, 201 Created, 301 Moved Permanently, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Internal Server Error, 503 Service Unavailable.

Horizontal Scalingsystem design

Adding more machines to handle increased load.

// Vertical: 1 big server (16 CPU, 64GB RAM)
// Horizontal: 4 small servers (4 CPU, 16GB each)

// Load balancer distributes requests
LB → Server 1, Server 2, Server 3, Server 4

Horizontal scaling (scaling out) adds more servers behind a load balancer. Each server handles a portion of traffic. Benefits: nearly unlimited capacity, fault tolerance. Requires: stateless application design, shared database or distributed state. Cloud auto-scaling groups adjust capacity automatically.

Health Checknetworking

A periodic request sent to a server to verify it is running and responsive.

app.get('/health', async (req, res) => {
  const dbOk = await db.ping();
  if (dbOk) res.status(200).json({ status: 'ok' });
  else res.status(503).json({ status: 'unhealthy' });
});

A health check is an automated probe that verifies a server is alive and ready. Load balancers use health checks to route traffic only to healthy servers.

HTTP Headernetworking

Key-value metadata sent with HTTP requests and responses.

fetch('/api/data', {
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer token123'
  }
});

HTTP headers carry metadata about the request or response. Request headers include Authorization, Accept, Content-Type. Response headers include Cache-Control, Set-Cookie.

HTTPSnetworking

HTTP secured with TLS encryption to protect data in transit.

// HTTPS — encrypted
https://example.com/api/login
// HTTP — NOT encrypted (avoid!)
http://example.com/api/login

HTTPS is HTTP wrapped in TLS encryption, ensuring confidentiality, integrity, and authentication. Browsers show a padlock icon for HTTPS sites.

Hyperbolaprecalculus

A conic section defined as the set of all points whose absolute difference of distances to two foci is constant.

// Hyperbola x^2/16 - y^2/9 = 1 with a=4, b=3
const a = 4, b = 3;
// Asymptotes: y = ±(3/4)x
console.log('Asymptote slopes:', b/a, -b/a);
// Vertices at (±a, 0)
console.log('Vertices:', [a, 0], [-a, 0]);

A hyperbola is the locus of points in a plane such that the absolute difference of the distances from any point on the curve to two fixed foci is a positive constant. Its standard form centered at the origin is x²/a² − y²/b² = 1 (opening left-right) or y²/a² − x²/b² = 1 (opening up-down). A hyperbola has two separate branches and two asymptotes given by y = ±(b/a)x that guide the shape of the curve at large distances from the center.

Hole Discontinuitycalculus

A point where a function's limit exists but does not equal the function's value or the function is undefined.

// f(x) = (x^2 - 1)/(x - 1) has a hole at x = 1
function f(x) {
  if (x === 1) return undefined;
  return (x * x - 1) / (x - 1); // simplifies to x+1
}
console.log(f(0.999)); // ~2

A hole discontinuity (also called a removable discontinuity) occurs at x = a when the limit of f(x) as x approaches a exists and is finite, but f(a) is either undefined or differs from that limit. The graph has a literal hole at that point. It can be 'repaired' by redefining f(a) to equal the limit.

Hypothesis Testprobability stats

A statistical procedure that uses sample data to evaluate a claim about a population parameter by measuring evidence against a null hypothesis.

// One-sample z-test: is the population mean different from 100?
const sample = [102, 98, 104, 97, 103, 101, 99, 105, 100, 103];
const n = sample.length;
const xBar = sample.reduce((a, b) => a + b) / n;
const sigma = 3; // known population std dev
const mu0 = 100;
const z = (xBar - mu0) / (sigma / Math.sqrt(n));
const pValue = 2 * (1 - 0.5 * (1 + Math.tanh(z * 0.7071)));
console.log(`z = ${z.toFixed(3)}, approx p ≈ ${pValue.toFixed(3)}`);

A hypothesis test is a formal procedure for deciding whether sample data provides sufficient evidence to reject a null hypothesis H₀ in favor of an alternative H₁. The process involves computing a test statistic from the data, determining its p-value under H₀, and comparing this p-value to a significance level α. If p ≤ α, the null hypothesis is rejected. Common tests include z-tests, t-tests, and chi-squared tests, each suited to different data types and assumptions.

Homogeneous Equationdifferential equations

A differential equation in which every term involves the unknown function or its derivatives.

// Check if y'' + 4y = 0 is homogeneous (RHS is zero)
const coefficients = [1, 0, 4]; // y'', y', y
const forcingFunction = 0;
console.log('Homogeneous:', forcingFunction === 0);

A homogeneous linear ODE has the form a_n y^(n) + a_(n-1) y^(n-1) + ... + a_1 y' + a_0 y = 0, with no standalone forcing function on the right-hand side. The superposition principle applies, meaning any linear combination of solutions is also a solution. The complementary solution of a non-homogeneous equation is found by solving the associated homogeneous equation.

Homomorphismabstract algebra

A structure-preserving map between two algebraic structures that respects the operations defined on them.

// f: (Z, +) -> (Z_3, +mod3) defined by f(n) = n mod 3
const f = n => ((n % 3) + 3) % 3;
// Verify: f(a + b) === (f(a) + f(b)) % 3
console.log(f(5 + 7) === (f(5) + f(7)) % 3); // true

A homomorphism is a function f : G -> H between two groups such that f(a * b) = f(a) * f(b) for all a, b in G, where * denotes the respective group operations. Homomorphisms preserve algebraic structure: they map the identity to the identity and inverses to inverses. The concept generalizes to rings, where a ring homomorphism must preserve both addition and multiplication, and to other algebraic structures.

I
Integerprogramming foundations

A whole number with no decimal point.

let count = 42;
let neg = -7;
let zero = 0;

An integer is a numeric data type representing whole numbers (positive, negative, or zero) without a fractional component. Examples: -3, 0, 42. In JavaScript, all numbers are floating-point internally, but integers are commonly used. Python has arbitrary-precision integers.

Iterationprogramming foundations

The process of repeating a set of instructions.

// 3 iterations:
[10, 20, 30].forEach(x => {
  console.log(x);
});

Iteration is the repetition of a process or set of instructions. Each repetition is called an 'iteration'. Loops are the primary mechanism for iteration in programming. Iteration is one of the two fundamental approaches to repetitive computation (the other being recursion).

Indexprogramming foundations

A number representing an element's position in an array, starting at 0.

const a = ["x", "y", "z"];
a[0]  // "x" (first)
a[2]  // "z" (third)
a[-1] // Python: "z" (last)

An index is the numeric position of an element within an array. In virtually all programming languages, indexing starts at 0 (zero-based). The first element has index 0, the second has index 1, and so on. Accessing an out-of-bounds index returns undefined (JS) or raises an IndexError (Python). Negative indices in Python count from the end.

Iteratorprogramming foundations

An object that produces a sequence of values one at a time.

const iter = [1, 2, 3][Symbol.iterator]();
iter.next(); // { value: 1, done: false }
iter.next(); // { value: 2, done: false }

An iterator is an object that implements a protocol for producing values sequentially. In JavaScript, iterators have a `next()` method that returns `{ value, done }`. In Python, iterators implement `__next__()`. Arrays, strings, maps, and sets are all iterable — they can produce iterators. The `for...of` (JS) and `for...in` (Python) loops consume iterators.

Immutabilityprogramming foundations

The property of a value that cannot be changed after creation.

let s = "hello";
s[0] = "H"; // does nothing! strings are immutable
s = "H" + s.slice(1); // create new string instead

An immutable value cannot be modified after it is created. Strings and numbers are immutable in both JavaScript and Python — operations on them always return new values. Immutability makes code predictable: if a value cannot change, you never have to worry about unexpected modifications. The spread operator creates immutable-style updates for objects and arrays.

Inheritanceprogramming foundations

A mechanism where a child class acquires properties and methods from a parent class.

class Animal {
  speak() { return "..."; }
}
class Dog extends Animal {
  speak() { return "Woof!"; }
}
new Dog().speak(); // "Woof!"

Inheritance allows a class (child/subclass) to reuse the properties and methods of another class (parent/superclass). The child class can add new members or override inherited ones. In JavaScript: `class Child extends Parent`. In Python: `class Child(Parent)`. Use `super()` to call the parent constructor or methods. Inheritance creates an 'is-a' relationship.

Instanceprogramming foundations

A specific object created from a class blueprint.

const a = new User("Alice");
const b = new User("Bob");
a instanceof User  // true
a.name !== b.name  // true (own data)

An instance is a concrete object created by calling a class constructor with `new` (JS) or by calling the class directly (Python). Each instance has its own copy of the class's properties but shares its methods. You can create many instances from one class. The `instanceof` operator (JS) or `isinstance()` function (Python) checks if an object is an instance of a class.

Importprogramming foundations

A statement that brings exported values from another module into the current file.

import { useState } from "react";
import express from "express";
import * as utils from "./utils.js";

The import statement loads values exported by another module. In JavaScript ES modules: `import { name } from './file.js'` (named) or `import thing from './file.js'` (default). In Python: `from module import name` or `import module`. Imports make dependencies between files explicit and allow the bundler/runtime to resolve the dependency graph.

In-Place Algorithmdata structures algorithms

An algorithm that transforms data using only a constant amount of extra memory.

// In-place swap
[arr[i], arr[j]] = [arr[j], arr[i]];

An in-place algorithm modifies the input directly rather than creating a copy. It uses O(1) auxiliary space. Array reversal by swapping ends is in-place. Sorting algorithms like quicksort are mostly in-place; merge sort is not (it needs O(n) extra space).

Inodeoperating systems

A data structure storing metadata about a file (permissions, size, disk location).

$ ls -i file.txt
12345 file.txt  # inode number 12345
$ stat file.txt  # shows all inode metadata

An inode (index node) stores file metadata: owner, permissions, timestamps, size, and pointers to data blocks on disk. The filename is stored in the directory entry, which maps names to inode numbers. Hard links create multiple names pointing to the same inode.

I/O Operationsoperating systems

Reading from and writing to external sources like disk, network, or keyboard.

// Reading stdin
process.stdin.on('data', (data) => {
  process.stdout.write(`Echo: ${data}`);
});

I/O (Input/Output) operations transfer data between a program and external devices. Standard I/O: stdin (keyboard input), stdout (screen output), stderr (error output). I/O is orders of magnitude slower than CPU operations, making it the primary bottleneck in most applications.

Idempotencydistributed systems

An operation that produces the same result no matter how many times it's performed.

// Idempotent: same result if repeated
SET user.name = 'Alice'  // always 'Alice'
DELETE /users/123        // already deleted = no-op

// NOT idempotent
INSERT INTO orders (...)  // creates duplicate!

An idempotent operation can be safely retried without changing the outcome. PUT /users/123 {name:'Alice'} is idempotent — calling it 5 times still sets the name to Alice. POST /users is NOT idempotent — calling it 5 times creates 5 users. Idempotency keys let you make non-idempotent operations safe to retry.

Index Tradeoffdatabases

The balance between faster reads and slower writes when adding database indexes.

CREATE INDEX idx_email ON users(email);
SELECT * FROM users WHERE email = '...'  -- O(log n)
-- But every INSERT must also update the index

Every index speeds up reads but slows down writes because the index must be maintained alongside the table data. Index columns you frequently query and filter on, but avoid indexing columns that are rarely searched.

Isolation Leveldatabases

A setting that controls how much concurrent transactions can see each other's changes.

BEGIN;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT balance FROM accounts WHERE id = 1;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
COMMIT;

Isolation levels define the degree to which transactions are isolated from each other. The SQL standard defines four levels: Read Uncommitted, Read Committed, Repeatable Read, and Serializable. Higher isolation prevents more anomalies but reduces concurrency.

Idempotency Keydistributed systems

A unique identifier attached to a request to prevent duplicate processing.

const res = await fetch('/api/charge', {
  method: 'POST',
  headers: { 'Idempotency-Key': crypto.randomUUID() },
  body: JSON.stringify({ amount: 2999 })
});

An idempotency key is a client-generated unique token sent with a request so the server can detect and deduplicate retries. The server stores the key and its result; if the same key arrives again, it returns the cached result.

Incident Responseproduction engineering

The structured process for detecting, responding to, and resolving production outages.

const severity = {
  SEV1: 'Full outage, all users affected',
  SEV2: 'Degraded, some users affected',
  SEV3: 'Minor issue, workaround available'
};

Incident response includes detection, triage, mitigation (often via rollback), resolution, and follow-up (postmortem). Clear roles keep the process orderly.

Interactive Rebasegit version control

A rebase mode that lets you edit, reorder, squash, or drop individual commits.

// git rebase -i HEAD~3
// pick a1b2c3d Add feature
// squash d4e5f6g Fix typo
// reword g7h8i9j Update tests

git rebase -i opens an editor showing commits. You can pick, squash, reword, edit, or drop each one. Powerful for cleaning up history.

Instruction Cyclecomputer hardware

The fetch-decode-execute loop that the CPU repeats for every instruction.

// The CPU repeats this cycle:
// 1. FETCH: read instruction from RAM
// 2. DECODE: what operation? what operands?
// 3. EXECUTE: perform the operation
// 4. Repeat for next instruction

The instruction cycle (fetch-decode-execute) is the fundamental operation of every CPU. Fetch: read the next instruction from memory. Decode: determine what operation to perform. Execute: carry out the operation. This cycle repeats billions of times per second.

Inequalityalgebra

A mathematical statement that compares two expressions using <, >, ≤, or ≥.

// Solve 2x + 3 > 7
// 2x > 4
// x > 2
let x = 3;
console.log(2 * x + 3 > 7);  // true

An inequality states that two expressions are not necessarily equal, using symbols like < (less than), > (greater than), ≤ (less than or equal to), or ≥ (greater than or equal to). Unlike equations, inequalities typically have infinitely many solutions, often represented as intervals or on a number line. Multiplying or dividing by a negative number reverses the inequality sign.

Interval Notationalgebra

A compact way to describe a set of numbers between two endpoints using brackets and parentheses.

// x > 2 is written as (2, ∞)
// -1 ≤ x ≤ 5 is written as [-1, 5]
// Check if value is in interval [2, 5)
function inInterval(x) {
  return x >= 2 && x < 5;
}

Interval notation represents a continuous range of numbers. Square brackets [ ] mean the endpoint is included (closed), while parentheses ( ) mean it is excluded (open). For example, [2, 5) means all numbers from 2 (included) to 5 (excluded). Infinity always uses a parenthesis because it is not a specific number. Common intervals include (-∞, ∞) for all real numbers.

Inductive Steplogic proofs

The part of a proof by induction that shows if the statement holds for k, it also holds for k + 1.

// Sum of 1..n = n*(n+1)/2
// Inductive step: assume sum(k) = k*(k+1)/2
// Then sum(k+1) = sum(k) + (k+1) = k*(k+1)/2 + (k+1)
// = (k+1)*(k+2)/2

The inductive step is the second component of a proof by mathematical induction. After establishing the base case, the inductive step assumes the statement P(k) is true for an arbitrary natural number k (this assumption is called the inductive hypothesis) and then proves that P(k + 1) must also be true. Together with the base case, this creates a chain of implications that establishes the statement for all natural numbers.

Inverse Trigonometric Functiontrigonometry

A function that returns the angle corresponding to a given trigonometric ratio.

// All return radians
Math.asin(0.5);  // ~0.5236 (30 degrees)
Math.acos(0.5);  // ~1.0472 (60 degrees)
Math.atan(1);    // ~0.7854 (45 degrees)

Inverse trigonometric functions (arcsin, arccos, arctan) reverse the standard trig functions: given a ratio, they return an angle. Because trig functions are periodic and not one-to-one, their domains must be restricted to define proper inverses. The principal ranges are: arcsin returns [-pi/2, pi/2], arccos returns [0, pi], and arctan returns (-pi/2, pi/2). These functions are essential for solving equations of the form sin(x) = k.

Inverse Functionprecalculus

A function that reverses the mapping of another function, so f⁻¹(f(x)) = x.

// f(x) = 2x + 3, inverse f⁻¹(x) = (x - 3) / 2
const f = x => 2 * x + 3;
const fInv = x => (x - 3) / 2;
console.log(f(4));        // 11
console.log(fInv(11));    // 4
console.log(fInv(f(7)));  // 7 — round trip

The inverse function f⁻¹ of a one-to-one function f undoes the action of f: if f(a) = b, then f⁻¹(b) = a. Algebraically, you find f⁻¹ by swapping x and y in the equation y = f(x) and solving for y. Graphically, the inverse is the reflection of f across the line y = x. A function must be one-to-one (pass the horizontal line test) to have an inverse that is also a function.

Implicit Differentiationcalculus

Differentiating an equation where y is not explicitly solved in terms of x.

// x^2 + y^2 = 25 => dy/dx = -x/y
function implicitDeriv(x, y) {
  return -x / y;
}
// At point (3, 4): slope = -3/4
console.log(implicitDeriv(3, 4)); // -0.75

Implicit differentiation is a technique for finding dy/dx when a relationship between x and y is given implicitly, such as x^2 + y^2 = 25. You differentiate both sides with respect to x, applying the chain rule to terms involving y (since y depends on x), then solve for dy/dx algebraically.

Implicit Equationcalculus

An equation defining a relationship between variables without isolating one as a function of the other.

// Check if a point satisfies x^2 + y^2 = 25
function onCircle(x, y) {
  return Math.abs(x * x + y * y - 25) < 0.001;
}
console.log(onCircle(3, 4)); // true
console.log(onCircle(1, 1)); // false

An implicit equation expresses a relationship like F(x, y) = 0 without explicitly writing y = f(x). Examples include x^2 + y^2 = 1 (a circle) or x^3 + y^3 = 6xy. Such equations may define curves that are not functions, but implicit differentiation can still find slopes at individual points.

Increasing/Decreasing Functionscalculus

A function is increasing where its derivative is positive and decreasing where its derivative is negative.

// Determine where f(x) = x^3 - 3x is increasing
function isIncreasing(x) {
  const deriv = 3 * x * x - 3; // f'(x)
  return deriv > 0;
}
console.log(isIncreasing(2));  // true (x > 1)
console.log(isIncreasing(0));  // false (-1 < x < 1)

A function f is increasing on an interval if f'(x) > 0 for all x in that interval, meaning the output grows as the input grows. It is decreasing where f'(x) < 0. The transition between increasing and decreasing behavior occurs at critical points, which are candidates for local extrema.

Inflection Pointcalculus

A point where a function's concavity changes from up to down or vice versa.

// f(x) = x^3 has an inflection point at x = 0
// f''(x) = 6x changes sign at x = 0
function secondDeriv(x) {
  return 6 * x;
}
console.log(secondDeriv(-0.1)); // negative (concave down)
console.log(secondDeriv(0.1));  // positive (concave up)

An inflection point occurs at x = c when the second derivative f''(x) changes sign at c. At this point, the curve transitions from concave up to concave down or the reverse. The second derivative is typically zero or undefined at an inflection point, but f''(c) = 0 alone does not guarantee an inflection point.

Instantaneous Rate of Changecalculus

The rate of change of a function at a single point, given by the derivative.

// Instantaneous rate of change of position s(t) = t^2
function velocity(t) {
  return 2 * t; // s'(t) = 2t
}
console.log(velocity(5)); // 10 units/sec at t=5

The instantaneous rate of change of f at x = a is the value f'(a), obtained as the limit of average rates of change over shrinking intervals. Unlike an average rate (which measures change over a finite interval), the instantaneous rate captures the precise speed of change at one exact moment.

Integration Boundscalculus

The lower and upper limits that define the interval of a definite integral.

// Integral of x from 0 to 5 vs from 5 to 0
function integrate(f, a, b, n = 10000) {
  const dx = (b - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) {
    sum += f(a + (i + 0.5) * dx) * dx;
  }
  return sum;
}
console.log(integrate(x => x, 0, 5));  // 12.5
console.log(integrate(x => x, 5, 0));  // -12.5

Integration bounds a and b in the integral from a to b of f(x) dx specify the interval over which the accumulation occurs. The lower bound a is the starting point and the upper bound b is the ending point. Reversing the bounds negates the integral, and splitting at an intermediate point c allows additive decomposition.

Integration Techniquecalculus

A method for finding antiderivatives that are not immediately obvious.

// U-substitution example: integral of 2x*cos(x^2)
// Let u = x^2, du = 2x dx => integral of cos(u) du = sin(u)
function antiderivative(x) {
  return Math.sin(x * x); // sin(x^2) + C
}

Integration techniques are systematic strategies for evaluating integrals that cannot be solved by direct application of basic rules. Common techniques include u-substitution (reversing the chain rule), integration by parts (reversing the product rule), partial fractions, and trigonometric substitution. Choosing the right technique depends on the form of the integrand.

Intersection Pointcalculus

A point where two curves cross, found by setting their equations equal.

// Find intersection of f(x)=x^2 and g(x)=x
// x^2 = x => x^2 - x = 0 => x(x-1) = 0
function findIntersections() {
  return [0, 1]; // x = 0 and x = 1
}
console.log(findIntersections());

An intersection point of f(x) and g(x) is a value x = c where f(c) = g(c). These points serve as natural bounds when computing the area between curves. Finding them requires solving f(x) = g(x), which may involve algebraic manipulation or numerical methods.

Intermediate Value Theoremcalculus

If a continuous function takes two values, it must take every value in between.

// IVT-based root finding (bisection method)
function bisect(f, a, b, tol = 1e-10) {
  while (b - a > tol) {
    const mid = (a + b) / 2;
    if (f(a) * f(mid) <= 0) b = mid;
    else a = mid;
  }
  return (a + b) / 2;
}
console.log(bisect(x => x*x - 2, 1, 2)); // ~1.4142

The Intermediate Value Theorem states that if f is continuous on [a, b] and N is any number between f(a) and f(b), then there exists at least one c in (a, b) such that f(c) = N. This theorem guarantees the existence of roots and is foundational for numerical root-finding algorithms like bisection.

Improper Integralcalculus 2

An integral with an infinite limit of integration or an integrand that becomes infinite within the interval.

// Approximate integral of 1/x^2 from 1 to infinity
function improperIntegral(f, a, upperBound, n) {
  const dx = (upperBound - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) {
    const x = a + (i + 0.5) * dx;
    sum += f(x) * dx;
  }
  return sum;
}
console.log(improperIntegral(x => 1/(x*x), 1, 10000, 100000)); // approaches 1

An improper integral arises when the interval of integration is unbounded (e.g., integral from a to infinity) or when the integrand has a vertical asymptote within [a, b]. These integrals are evaluated as limits: for example, integral from a to infinity of f(x) dx = lim as t approaches infinity of integral from a to t of f(x) dx. If the limit exists and is finite, the improper integral converges; otherwise it diverges.

Infinite Seriescalculus 2

The sum of infinitely many terms of a sequence.

// Partial sums of the harmonic series 1 + 1/2 + 1/3 + ...
function harmonicPartialSum(N) {
  let sum = 0;
  for (let n = 1; n <= N; n++) sum += 1 / n;
  return sum;
}
console.log(harmonicPartialSum(1000000)); // diverges slowly

An infinite series is an expression of the form sum of a_n for n = 1 to infinity, defined as the limit of its partial sums S_N = a_1 + a_2 + ... + a_N as N approaches infinity. If this limit exists and is finite, the series converges to that value; otherwise it diverges. Infinite series are central to calculus and analysis, providing representations for functions, constants, and solutions to differential equations.

Integration by Partscalculus 2

An integration technique based on the product rule, expressing the integral of u dv as uv minus the integral of v du.

// Numerical integration of x * e^x from 0 to 1
// Exact answer: 1 (by parts: u=x, dv=e^x dx)
function integrate(f, a, b, n) {
  const dx = (b - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) {
    const x = a + (i + 0.5) * dx;
    sum += f(x) * dx;
  }
  return sum;
}
console.log(integrate(x => x * Math.exp(x), 0, 1, 10000)); // ~1.0

Integration by parts is derived from the product rule for differentiation and states that integral of u dv = uv - integral of v du. The technique requires choosing which factor to differentiate (u) and which to integrate (dv), often guided by the LIATE rule (Logarithmic, Inverse trig, Algebraic, Trigonometric, Exponential). Repeated application or tabular integration can handle higher-order products efficiently.

Interval of Convergencecalculus 2

The set of all x values for which a power series converges.

// Test convergence of sum x^n/n at various x values
function powerSeriesSum(x, N) {
  let sum = 0;
  for (let n = 1; n <= N; n++) sum += Math.pow(x, n) / n;
  return sum;
}
// Converges for -1 <= x < 1
console.log(powerSeriesSum(0.5, 100));  // converges
console.log(powerSeriesSum(-1, 100));   // converges (ln 2)

The interval of convergence of a power series centered at c is the set of all real numbers x for which the series converges. It always includes the center c and is symmetric about it, forming an interval (c - R, c + R) where R is the radius of convergence. The endpoints must be checked individually, as the series may converge at one, both, or neither endpoint.

Inverse Matrixlinear algebra

A matrix A^{-1} that when multiplied by A yields the identity matrix.

function inverse2x2(m) {
  const det = m[0][0]*m[1][1] - m[0][1]*m[1][0];
  if (det === 0) throw new Error('Matrix is singular');
  return [
    [m[1][1]/det, -m[0][1]/det],
    [-m[1][0]/det, m[0][0]/det]
  ];
}
console.log(inverse2x2([[2, 1], [1, 1]])); // [[1,-1],[-1,2]]

The inverse of a square matrix A is the unique matrix A^{-1} such that AA^{-1} = A^{-1}A = I, where I is the identity matrix. A matrix is invertible (nonsingular) if and only if its determinant is nonzero, equivalently if its columns are linearly independent. For a 2x2 matrix [[a,b],[c,d]], the inverse is (1/det) * [[d,-b],[-c,a]].

Iterated Integralmultivariable calc

A sequence of nested single-variable integrals used to evaluate a multiple integral one variable at a time.

// Iterated integral: integrate over y first, then x
// ∫₀¹ ∫₀ˣ f(x,y) dy dx
let total = 0;
for (let i = 0; i < n; i++) {
  let inner = 0;
  for (let j = 0; j < n; j++) inner += f(x[i], y[j]) * dy;
  total += inner * dx;
}

An iterated integral evaluates a double or triple integral by integrating with respect to one variable while treating the others as constants, then repeating for each remaining variable. Fubini's Theorem guarantees that the order of integration can be exchanged when the integrand is continuous over the region. Choosing the right order often simplifies computation dramatically.

Initial Value Problemdifferential equations

A differential equation paired with conditions specifying the solution at a single starting point.

// IVP: dy/dt = -y, y(0) = 10
const y0 = 10;
function exactSolution(t) {
  return y0 * Math.exp(-t);
}
console.log('y(1) =', exactSolution(1).toFixed(4));

An initial value problem (IVP) consists of an ODE together with prescribed values of the unknown function and its derivatives at a single point, such as y(t_0) = y_0. The Picard-Lindelof theorem guarantees existence and uniqueness of solutions under continuity and Lipschitz conditions. IVPs model forward-in-time evolution problems like projectile motion and circuit transients.

Inverse Laplace Transformdifferential equations

The operation that recovers a time-domain function from its Laplace-domain representation.

// Inverse Laplace of F(s) = 1/(s+3) is f(t) = e^(-3t)
function inverseLaplaceExample(t) {
  return Math.exp(-3 * t);
}
console.log('f(0) =', inverseLaplaceExample(0));
console.log('f(1) =', inverseLaplaceExample(1).toFixed(4));

The inverse Laplace transform maps a function F(s) in the complex frequency domain back to f(t) in the time domain, formally defined by a Bromwich contour integral. In practice, it is computed using partial fraction decomposition and lookup tables of known transform pairs. It is the essential final step when solving ODEs via the Laplace transform method.

Integrabilityreal analysis

A function is Riemann integrable if its upper and lower Riemann sums converge to the same value.

// Check integrability: upper and lower sums converge
function upperLowerSums(f, a, b, n) {
  const dx = (b - a) / n;
  let upper = 0, lower = 0;
  for (let i = 0; i < n; i++) {
    const samples = Array.from({length: 100}, (_, k) => f(a + dx*i + dx*k/100));
    upper += Math.max(...samples) * dx;
    lower += Math.min(...samples) * dx;
  }
  return { upper, lower, diff: upper - lower };
}
console.log(upperLowerSums(x => x*x, 0, 1, 100));

A bounded function f on [a, b] is Riemann integrable if for every epsilon > 0, there exists a partition P of [a, b] such that U(f, P) - L(f, P) < epsilon, where U and L denote upper and lower sums. Equivalently, f is integrable when its upper integral equals its lower integral. All continuous functions on closed intervals are Riemann integrable, as are monotone functions and functions with finitely many discontinuities.

Idealabstract algebra

A special subset of a ring that absorbs multiplication by any ring element and is closed under addition.

An ideal I of a ring R is a nonempty subset that is closed under addition and subtraction (making it a subgroup of (R, +)) and satisfies the absorption property: for every r in R and every a in I, both ra and ar belong to I. Ideals play the same role in ring theory that normal subgroups play in group theory, enabling the construction of quotient rings R/I. Principal ideals, generated by a single element, are the simplest examples.

Isomorphismabstract algebra

A bijective homomorphism whose inverse is also a homomorphism, establishing that two algebraic structures are structurally identical.

An isomorphism is a homomorphism f : G -> H that is both injective (one-to-one) and surjective (onto), meaning it establishes a perfect one-to-one correspondence between the elements of G and H that preserves the group operation. When an isomorphism exists between two groups, they are said to be isomorphic (G ≅ H) and are considered algebraically indistinguishable. Isomorphic structures share all abstract algebraic properties, including order, commutativity, and subgroup structure.

Imaginary Unitprecalculus

The number i defined by i^2 = -1.

// Powers of i cycle: i, -1, -i, 1
const powers = ['i', '-1', '-i', '1'];
for (let n = 1; n <= 8; n++) {
  console.log(`i^${n} = ${powers[(n - 1) % 4]}`);
}

The imaginary unit, denoted i, is defined as the square root of -1, so that i^2 = -1. It is the fundamental building block of complex numbers, allowing the extension of the real number system. Powers of i cycle through four values: i, -1, -i, 1.

Infinityprecalculus

A concept representing unbounded growth, not a real number.

// Infinity in JavaScript
console.log(1 / 0);           // Infinity
console.log(Infinity + 1);     // Infinity
console.log(Number.isFinite(Infinity)); // false

Infinity is a mathematical concept describing a quantity that grows without bound. It is not a real number and cannot be used in arithmetic the same way finite numbers can. In precalculus, infinity appears when describing end behavior of functions and limits where values increase or decrease without bound.

Inner Functionprecalculus

In a composition f(g(x)), g is the inner function.

// Identifying the inner function
const g = x => 2 * x + 1; // inner
const f = x => x * x;     // outer
console.log(f(g(3)));      // g(3)=7, f(7)=49

In function composition (f o g)(x) = f(g(x)), the inner function is g, the one that is evaluated first. Its output becomes the input for the outer function f. Identifying the inner function is crucial for decomposing composed functions and for applying the chain rule in calculus.

Indefinite Integralcalculus

The family of all antiderivatives of a function, written as integral of f(x) dx = F(x) + C.

// Indefinite integral of 3x^2 is x^3 + C
const antiderivative = (x, C = 0) => x ** 3 + C;

An indefinite integral represents the general antiderivative of a function and is written with the integral sign without limits of integration. The result is a family of functions differing by a constant C. Unlike definite integrals which yield a number, indefinite integrals yield a function plus the constant of integration.

Intermediate Value Theoremcalculus

If f is continuous on [a, b] and k is between f(a) and f(b), then f(c) = k for some c in (a, b).

// Showing a root exists for f(x) = x^2 - 2 on [1, 2]
const f = (x) => x * x - 2;
console.log(f(1)); // -1 (negative)
console.log(f(2)); // 2 (positive)
// By IVT, a root exists between 1 and 2

The Intermediate Value Theorem guarantees that a continuous function on a closed interval takes on every value between its endpoint values. If f is continuous on [a, b] and k lies between f(a) and f(b), there exists at least one c in the open interval (a, b) such that f(c) = k. This theorem is frequently used to prove the existence of roots.

Image (Range)linear algebra

The set of all outputs of a linear transformation.

// A transformation T represented by matrix [[1,0],[0,0]] projects onto the x-axis
// Its image is all vectors of the form [x, 0]
const T = (v) => [1 * v[0] + 0 * v[1], 0 * v[0] + 0 * v[1]];
console.log(T([3, 5])); // [3, 0]

The image (or range) of a linear transformation T is the set of all vectors that can be written as T(v) for some input vector v. It forms a subspace of the codomain. The dimension of the image is called the rank of the transformation, and by the rank-nullity theorem, rank plus nullity equals the dimension of the domain.

Invertible Matrixlinear algebra

A square matrix A with a matrix inverse A^(-1) such that A*A^(-1) = I.

// Inverse of a 2x2 matrix [[a,b],[c,d]] is (1/det) * [[d,-b],[-c,a]]
const A = [[2, 1], [5, 3]];
const det = A[0][0] * A[1][1] - A[0][1] * A[1][0];
const inv = [
  [A[1][1] / det, -A[0][1] / det],
  [-A[1][0] / det, A[0][0] / det]
];
console.log('Inverse:', inv);

An invertible (or nonsingular) matrix is a square matrix A for which there exists another matrix A^(-1) satisfying A*A^(-1) = A^(-1)*A = I, where I is the identity matrix. A matrix is invertible if and only if its determinant is nonzero. Invertibility guarantees that the associated linear system has a unique solution for every right-hand side.

J
JSONprogramming foundations

JavaScript Object Notation — a text format for representing structured data.

const json = '{"name":"Alice","age":28}';
const obj = JSON.parse(json);
obj.name  // "Alice"
JSON.stringify(obj)  // back to string

JSON (JavaScript Object Notation) is a lightweight data interchange format. It's human-readable text that represents objects, arrays, strings, numbers, booleans, and null. JSON is the standard format for API communication, configuration files, and data storage. `JSON.parse()` converts a string to an object; `JSON.stringify()` converts an object to a string.

Jitterdistributed systems

Random variation added to retry delays to prevent synchronized request storms.

function backoffWithJitter(attempt) {
  const base = Math.pow(2, attempt) * 1000;
  return Math.random() * base;
}

Jitter adds randomness to backoff delays so that multiple clients retrying simultaneously do not all hit the server at the exact same moment (thundering herd problem).

Jacobianmultivariable calc

A matrix of all first-order partial derivatives of a vector-valued function, encoding how it locally stretches and rotates space.

// 2D Jacobian determinant for polar coordinates
// x = r cos(θ), y = r sin(θ)
const jacobian = r; // |det(J)| = r

The Jacobian matrix of a function F: Rⁿ → Rᵐ has entry Jᵢⱼ = ∂Fᵢ/∂xⱼ. For coordinate transformations, its determinant (the Jacobian determinant) gives the local scaling factor for volume elements, which appears when changing variables in multiple integrals. In the multivariable chain rule, the Jacobian generalizes the single-variable derivative to compositions of vector-valued functions.

K
Key-Value Pairdata structures algorithms

A data element consisting of a unique key and its associated value.

{ "name": "Alice" }  // key: "name", value: "Alice"
map.set("age", 28);  // key: "age", value: 28

A key-value pair associates a unique identifier (key) with a piece of data (value). Keys must be hashable (strings, numbers). Values can be anything. Key-value pairs are the foundation of hash maps, JSON objects, database records, and configuration files.

Kernel (Algebra)abstract algebra

The set of all elements in the domain of a homomorphism that map to the identity element of the codomain.

// Kernel of f: Z -> Z_3, f(n) = n mod 3
// ker(f) = multiples of 3
const isInKernel = n => n % 3 === 0;
console.log([-6,-3,0,3,6].every(isInKernel)); // true
console.log(isInKernel(4)); // false

The kernel of a group homomorphism f : G -> H is the set ker(f) = {g in G : f(g) = e_H}, where e_H is the identity element of H. The kernel is always a normal subgroup of G and measures how far the homomorphism is from being injective: f is injective if and only if ker(f) = {e_G}. By the first isomorphism theorem, G/ker(f) is isomorphic to the image of f.

Kernel (Null Space)linear algebra

The set of all vectors mapped to zero by a linear transformation.

// For matrix [[1,2],[2,4]], the kernel includes vectors like [-2,1]
const A = [[1, 2], [2, 4]];
const v = [-2, 1];
const result = [
  A[0][0] * v[0] + A[0][1] * v[1],
  A[1][0] * v[0] + A[1][1] * v[1]
];
console.log('A * v =', result); // [0, 0]

The kernel (or null space) of a linear transformation T is the set of all input vectors v such that T(v) = 0. It always forms a subspace of the domain. The dimension of the kernel is called the nullity, and a transformation is injective (one-to-one) if and only if its kernel contains only the zero vector.

L
Loopprogramming foundations

A control structure that repeats a block of code while a condition is true.

for (let i = 0; i < 3; i++) {
  console.log(i); // 0, 1, 2
}

A loop repeatedly executes a block of code as long as a specified condition remains true. The two main types are `for` loops (iterate a known number of times or over a collection) and `while` loops (iterate until a condition changes). Loops are essential for processing collections of data and automating repetitive tasks.

Lexical Scopeprogramming foundations

Scope determined by where code is written, not where it's called.

let x = "global";
function outer() {
  let x = "outer";
  function inner() {
    console.log(x); // "outer" (lexical)
  }
  return inner;
}
outer()();

Lexical (or static) scoping means a function's scope is determined by its position in the source code — specifically, where it was defined, not where it is called. When a function references a variable, the engine looks in the scope where the function was written, then its parent scope, and so on up to global. This is how closures work.

Linear Timedata structures algorithms

An operation whose time grows proportionally with input size — O(n).

function sum(arr) {
  let total = 0;
  for (const n of arr) total += n; // O(n)
  return total;
}

A linear-time algorithm processes each element once (or a constant number of times). Doubling the input doubles the runtime. Linear search, summing an array, and finding the max are all O(n).

Linked Listdata structures algorithms

A data structure where each element (node) points to the next one.

class Node {
  constructor(val) {
    this.val = val;
    this.next = null;
  }
}
head → [1] → [2] → [3] → null

A linked list stores elements in nodes, where each node contains data and a reference (pointer) to the next node. Unlike arrays, elements are not stored contiguously in memory. Insertion/deletion at the head is O(1), but access by index is O(n) since you must traverse from the head.

LIFOdata structures algorithms

Last In, First Out — the most recently added item is removed first.

push A, push B, push C
pop → C (last in, first out)
pop → B
pop → A

LIFO (Last In, First Out) is the ordering principle of a stack. Like a stack of plates, you can only add to or remove from the top. The most recently pushed element is the first one popped. The call stack follows LIFO — the most recently called function returns first.

Level-Order Traversaldata structures algorithms

Visiting tree nodes level by level from top to bottom.

// Tree:    1
//        / \
//       2   3
// Level-order: [1], [2, 3]

Level-order traversal is BFS applied to trees. It visits all nodes at depth 0 (root), then depth 1, then depth 2, and so on. Implemented with a queue: enqueue root, then for each dequeued node, enqueue its children. Useful for printing trees, finding minimum depth, and serialization.

Load Balancernetworking

A device or software that distributes traffic across multiple servers.

Client → Load Balancer → Server 1 (33%)
                       → Server 2 (33%)
                       → Server 3 (33%)

A load balancer sits between clients and servers, distributing incoming requests across multiple backend servers. Algorithms: round-robin, least connections, IP hash, weighted. L4 (transport) load balancers route by IP/port. L7 (application) load balancers can route by URL, headers, or cookies. Health checks remove unhealthy servers.

Latencynetworking

The time delay between sending a request and receiving a response.

// Typical latencies
L1 cache:     ~1 ns
RAM:          ~100 ns
SSD read:     ~100 μs
Network (US): ~30 ms
Transatlantic: ~100 ms

Latency measures how long a single operation takes from start to finish. Network latency includes transmission time, propagation delay, and processing time. Measured in milliseconds. P50 (median) and P99 (99th percentile) latency are key SLO metrics. Lower latency = better user experience.

Loss Functionmachine learning

A function that quantifies how wrong a model's predictions are.

# MSE Loss
loss = mean((predicted - actual) ** 2)

# Cross-Entropy Loss
loss = -sum(actual * log(predicted))

# Lower loss = better model

A loss function measures the difference between predicted and actual values. MSE (Mean Squared Error) for regression: average of (predicted - actual)². Cross-entropy for classification: measures difference between predicted probabilities and actual labels. Training = minimizing the loss function via gradient descent.

Leader Electiondistributed systems

The process of designating one node as the coordinator in a distributed system.

candidate.requestVotes(allNodes);
if (votesReceived > Math.floor(nodes.length / 2)) {
  candidate.becomeLeader();
}

Leader election is a protocol by which distributed nodes choose a single leader to coordinate operations. When the current leader fails, a new election occurs. Must handle split-brain scenarios.

Leader-Follower Replicationdistributed systems

A replication model where one leader handles writes and followers replicate reads.

await leader.query('INSERT INTO users ...');
const user = await follower.query('SELECT * FROM users WHERE id = 1');

In leader-follower replication, a single leader node accepts all write operations and replicates changes to follower nodes. Followers handle read requests. Replication can be synchronous or asynchronous.

Layered Architecturesystem design

A design pattern that organizes code into horizontal layers with distinct responsibilities.

// Presentation layer
app.get('/users/:id', controller.getUser);
// Business layer
const getUser = (req) => userService.find(req.params.id);
// Data layer
const find = (id) => db.query('SELECT...', [id]);

Layered architecture separates a system into layers where each has a specific role: presentation, business logic, data access, and database. Each layer only communicates with adjacent layers.

Loggingsystem design

Recording events and data from a running application for debugging and auditing.

console.log(JSON.stringify({
  level: 'info', event: 'user_login', userId: 123
}));

Logging writes timestamped records of application events. Structured logging (JSON format) makes logs searchable. Log levels (debug, info, warn, error) let you filter by severity.

Layer Normalizationdeep learning llms

Normalizing activations across features within each sample to stabilize training.

import torch.nn as nn
layer_norm = nn.LayerNorm(768)
# Normalize across 768 features per token

Layer normalization computes mean and variance across all features for a single sample, then rescales to zero mean and unit variance. Enables training of very deep networks.

LoRA (Low-Rank Adaptation)deep learning llms

A parameter-efficient fine-tuning method that trains small adapter matrices instead of all weights.

from peft import LoraConfig
config = LoraConfig(
    r=8, lora_alpha=16,
    target_modules=['q_proj', 'v_proj']
)

LoRA freezes original weights and injects small trainable low-rank matrices. Reduces trainable parameters by 100-1000x while achieving similar quality to full fine-tuning.

Learning Ratemathematics

A hyperparameter controlling how large each gradient descent step is.

let weight = 5.0;
const lr = 0.1;
const gradient = 4.0;
weight = weight - lr * gradient; // 4.6

The learning rate determines step size during gradient descent. Too large causes overshooting; too small makes training painfully slow.

Local Minimummathematics

A point where a function's value is lower than all nearby points but not necessarily the lowest overall.

const f = x => x**4 - 2*x**2;
f(1);  // -1 (local min)
f(-1); // -1 (another local min)

Gradient descent can get stuck at a local minimum instead of finding the global minimum. Techniques like momentum, random restarts, and learning rate schedules help escape.

Log Base 2mathematics

The logarithm that answers how many times you multiply 2 to get a number.

Math.log2(1024); // 10 (2^10 = 1024)
Math.log2(8);    // 3  (2^3 = 8)

log2(n) asks: 2 raised to what power equals n? Fundamental in CS because binary trees and binary search repeatedly halve input.

Logarithmmathematics

The inverse of exponentiation — finds what exponent produces a given number.

Math.log10(1000); // 3 (10^3 = 1000)
Math.log2(32);    // 5 (2^5 = 32)

log_b(x) = y means b^y = x. Logarithms convert multiplication into addition and are essential for understanding O(log n) complexity classes.

Logic Gatecomputer hardware

A circuit that performs a basic Boolean operation like AND, OR, or NOT.

// AND: both must be true
console.log(1 & 1); // 1
console.log(1 & 0); // 0
// OR: either can be true
console.log(1 | 0); // 1

Logic gates combine transistors to implement Boolean functions. AND outputs 1 only if both inputs are 1. OR outputs 1 if either input is 1. NOT inverts the input. These gates are combined to build adders, multiplexers, and entire CPUs.

Leading Coefficientalgebra

The coefficient of the term with the highest degree in a polynomial.

// In 3x² + 5x - 1, the leading coefficient is 3
// In -2x³ + x, the leading coefficient is -2

The leading coefficient is the numerical factor of the term with the highest exponent in a polynomial written in standard form. In 3x² + 5x - 1, the leading coefficient is 3. It determines the end behavior of the polynomial's graph: a positive leading coefficient means the graph rises to the right, while a negative one means it falls.

Linear Equationalgebra

An equation whose graph is a straight line, typically in the form ax + b = c.

// Solve 3x + 5 = 14
// 3x = 9
// x = 3
let a = 3, b = 5, c = 14;
let x = (c - b) / a;  // 3

A linear equation is a first-degree polynomial equation in one or more variables. In one variable, it takes the form ax + b = 0 and has exactly one solution (x = -b/a). In two variables, it takes the form ax + by = c and its graph is a straight line. Solving linear equations involves isolating the variable using inverse operations.

Linegeometry

A straight one-dimensional figure that extends infinitely in both directions.

A line is a fundamental geometric object with no thickness that extends infinitely in both directions. It is uniquely determined by any two distinct points on it. A line segment is a bounded portion of a line between two endpoints, and a ray is a portion that extends infinitely in one direction from a single endpoint.

Logical Connectivelogic proofs

A symbol or word used to combine propositions into compound statements.

// The five primary connectives in JS
const not = (p) => !p;
const and = (p, q) => p && q;
const or = (p, q) => p || q;
const implies = (p, q) => !p || q;
const iff = (p, q) => p === q;

A logical connective is an operator that combines one or more propositions to form a new proposition whose truth value depends on the truth values of its components. The five primary connectives are: negation (NOT), conjunction (AND), disjunction (OR), conditional (IF...THEN), and biconditional (IF AND ONLY IF). Each connective is fully defined by its truth table.

Logical Equivalencelogic proofs

A relationship between two statements that have identical truth values in every possible case.

// De Morgan's Law: NOT(P AND Q) === (NOT P) OR (NOT Q)
const deMorgan = (p, q) =>
  (!(p && q)) === (!p || !q);
deMorgan(true, false); // true (always true)

Two propositions are logically equivalent (denoted P <=> Q or P === Q) if they have the same truth value under every possible truth assignment to their variables. Logical equivalence can be verified by constructing truth tables or by applying known equivalence laws such as De Morgan's laws, double negation, and distribution. Logically equivalent statements are interchangeable in proofs and arguments.

Left, Right, and Midpoint Sumscalculus

Riemann sum variants using the left endpoint, right endpoint, or midpoint of each subinterval.

// Compare left, right, and midpoint sums for x^2 on [0,1]
const n = 100, dx = 1/n;
let left = 0, right = 0, mid = 0;
for (let i = 0; i < n; i++) {
  left  += (i*dx)**2 * dx;
  right += ((i+1)*dx)**2 * dx;
  mid   += ((i+0.5)*dx)**2 * dx;
}
console.log({left, right, mid}); // all ~0.3333

Left, right, and midpoint sums are specific types of Riemann sums. A left sum evaluates f at each subinterval's left endpoint, a right sum at the right endpoint, and a midpoint sum at the center. For monotonic functions, left and right sums provide bounds on the true integral, while midpoint sums typically give better accuracy.

Limit (Formal)calculus

The precise epsilon-delta definition of what it means for a function to approach a value.

// Verify formal limit: lim(x->2) x^2 = 4
function findDelta(epsilon) {
  // For f(x)=x^2 near x=2, delta = min(1, epsilon/5) works
  return Math.min(1, epsilon / 5);
}
const eps = 0.01;
const delta = findDelta(eps);
const x = 2 + delta / 2;
console.log(Math.abs(x*x - 4) < eps); // true

The formal definition of a limit states: lim(x->a) f(x) = L if and only if for every epsilon > 0 there exists a delta > 0 such that 0 < |x - a| < delta implies |f(x) - L| < epsilon. This rigorous formulation eliminates ambiguity and underpins all of calculus, replacing intuitive notions of 'getting closer' with precise logical conditions.

Limit (Intuition)calculus

The value a function approaches as its input approaches a given point.

// Explore the limit of sin(x)/x as x -> 0
for (const x of [0.1, 0.01, 0.001, 0.0001]) {
  console.log(`x=${x}, sin(x)/x=${Math.sin(x)/x}`);
}
// Approaches 1

Intuitively, the limit of f(x) as x approaches a is the value that f(x) gets arbitrarily close to as x gets close to a, regardless of whether f(a) itself is defined or equals that value. Limits capture the behavior of functions near a point and form the foundation for defining derivatives, integrals, and continuity.

Linear Independencelinear algebra

A set of vectors where no vector can be expressed as a linear combination of the others.

// Check if two 2D vectors are linearly independent
function areIndependent2D(v1, v2) {
  // Independent iff the 2x2 determinant is nonzero
  return v1[0]*v2[1] - v1[1]*v2[0] !== 0;
}
console.log(areIndependent2D([1, 0], [0, 1])); // true
console.log(areIndependent2D([1, 2], [2, 4])); // false

A set of vectors {v1, v2, ..., vk} is linearly independent if the only solution to c1*v1 + c2*v2 + ... + ck*vk = 0 is c1 = c2 = ... = ck = 0. If a nontrivial combination exists, the vectors are linearly dependent. Linear independence is the key requirement for a set of vectors to serve as a basis and directly relates to whether a matrix has full rank.

Linear Transformationlinear algebra

A function between vector spaces that preserves vector addition and scalar multiplication.

// A 2D rotation is a linear transformation
function rotate2D(v, theta) {
  const cos = Math.cos(theta), sin = Math.sin(theta);
  return [
    cos * v[0] - sin * v[1],
    sin * v[0] + cos * v[1]
  ];
}
console.log(rotate2D([1, 0], Math.PI / 2)); // [~0, 1]

A linear transformation T: V -> W is a function satisfying T(u + v) = T(u) + T(v) and T(cv) = cT(v) for all vectors u, v and scalars c. Every linear transformation from R^n to R^m can be represented by an m x n matrix A such that T(v) = Av. Rotations, reflections, projections, and scaling are all examples of linear transformations.

Line Integralmultivariable calc

An integral of a function evaluated along a curve, accumulating values weighted by arc length or a vector field's tangential component.

// Approximate work integral ∫ F · dr along discrete path
let work = 0;
for (let i = 1; i < path.length; i++) {
  const dr = [path[i][0]-path[i-1][0], path[i][1]-path[i-1][1]];
  work += F(path[i])[0]*dr[0] + F(path[i])[1]*dr[1];
}

A scalar line integral ∫_C f ds sums a function's values along a curve weighted by arc length. A vector line integral ∫_C F · dr sums the tangential component of a vector field along the curve, representing work done by the field. Both depend on the path taken unless the field is conservative, in which case the integral depends only on the endpoints.

Least Squaresprobability stats

An optimization method that finds the best-fitting line or curve by minimizing the sum of the squared differences between observed and predicted values.

// Least squares regression
const x = [1, 2, 3, 4, 5];
const y = [2.1, 4.0, 5.8, 8.1, 9.9];
const n = x.length;
const xMean = x.reduce((a, b) => a + b) / n;
const yMean = y.reduce((a, b) => a + b) / n;
let num = 0, den = 0;
for (let i = 0; i < n; i++) {
  num += (x[i] - xMean) * (y[i] - yMean);
  den += (x[i] - xMean) ** 2;
}
const slope = num / den;
const intercept = yMean - slope * xMean;
console.log(`y = ${slope.toFixed(2)}x + ${intercept.toFixed(2)}`);

The method of least squares estimates model parameters by minimizing the sum of squared residuals: Σ(yᵢ - ŷᵢ)². For simple linear regression, this yields closed-form solutions: slope b₁ = Σ(xᵢ-x̄)(yᵢ-ȳ)/Σ(xᵢ-x̄)² and intercept b₀ = ȳ - b₁x̄. Least squares is optimal under the Gauss-Markov assumptions and provides the best linear unbiased estimator (BLUE) of the regression coefficients.

Likelihoodprobability stats

A function measuring how probable the observed data is for each possible value of a model's parameters.

// Likelihood of observing 7 heads in 10 flips for various p
function likelihood(p, k, n) {
  const comb = factorial(n) / (factorial(k) * factorial(n - k));
  return comb * Math.pow(p, k) * Math.pow(1 - p, n - k);
}
function factorial(x) { return x <= 1 ? 1 : x * factorial(x - 1); }
for (let p = 0.3; p <= 0.9; p += 0.1) {
  console.log(`L(p=${p.toFixed(1)}) = ${likelihood(p, 7, 10).toFixed(4)}`);
}

The likelihood function L(θ|data) expresses the probability of observing the given data as a function of the parameter θ. Unlike probability, which fixes parameters and varies outcomes, likelihood fixes the observed data and varies the parameters. In Bayesian inference, the likelihood is multiplied by the prior to produce the posterior via Bayes' theorem. Maximum likelihood estimation (MLE) finds the parameter value that maximizes this function.

Linear Regressionprobability stats

A statistical method that models the linear relationship between a dependent variable and one or more independent variables.

// Simple linear regression with predictions
const x = [1, 2, 3, 4, 5];
const y = [2.2, 4.1, 5.9, 8.0, 10.1];
const n = x.length;
const mx = x.reduce((a, b) => a + b) / n;
const my = y.reduce((a, b) => a + b) / n;
let b1 = 0, ss = 0;
for (let i = 0; i < n; i++) {
  b1 += (x[i] - mx) * (y[i] - my);
  ss += (x[i] - mx) ** 2;
}
b1 /= ss;
const b0 = my - b1 * mx;
console.log(`y = ${b1.toFixed(2)}x + ${b0.toFixed(2)}`);
console.log(`Predict x=6: y = ${(b1 * 6 + b0).toFixed(2)}`);

Linear regression fits a linear equation y = β₀ + β₁x + ε to observed data, where β₀ is the intercept, β₁ is the slope, and ε is the error term. The coefficients are typically estimated using the least squares method. The model assumes linearity, independence of errors, constant variance (homoscedasticity), and normally distributed residuals. R² measures the proportion of variance in y explained by x, indicating model fit quality.

Laplace Transformdifferential equations

An integral transform that converts a time-domain function into a complex frequency-domain function.

// Numerical approximation of Laplace transform of f(t) = e^(-2t)
function laplaceApprox(s, dt, tMax) {
  let sum = 0;
  for (let t = 0; t < tMax; t += dt) {
    sum += Math.exp(-s * t) * Math.exp(-2 * t) * dt;
  }
  return sum;
}
console.log('F(1) ≈', laplaceApprox(1, 0.01, 20).toFixed(4));

The Laplace transform of f(t) is defined as F(s) = integral from 0 to infinity of e^(-st) f(t) dt, mapping differential equations into algebraic equations in the s-domain. This technique is especially powerful for linear constant-coefficient ODEs with discontinuous or impulsive forcing functions. After algebraic manipulation in the s-domain, the inverse transform recovers the time-domain solution.

Lagrange's Theoremabstract algebra

The order of any subgroup of a finite group divides the order of the group.

Lagrange's theorem states that if G is a finite group and H is a subgroup of G, then the order of H divides the order of G, and the quotient |G|/|H| equals the number of distinct cosets of H in G (the index [G:H]). This theorem has powerful consequences: the order of any element divides the order of the group, and there are no subgroups of order k unless k divides |G|. The converse is not true in general—a divisor of |G| does not guarantee a subgroup of that order exists.

Logarithm Propertiesprecalculus

The product, quotient, and power rules for logarithms.

// Verify logarithm properties
const x = 8, y = 4;
console.log(Math.log(x * y) === Math.log(x) + Math.log(y)); // true
console.log(Math.log(x / y) === Math.log(x) - Math.log(y)); // true
console.log(Math.log(x ** 3) === 3 * Math.log(x));          // true

The three core logarithm properties are: the product rule log_b(xy) = log_b(x) + log_b(y), the quotient rule log_b(x/y) = log_b(x) - log_b(y), and the power rule log_b(x^n) = n * log_b(x). These properties allow you to expand, condense, and simplify logarithmic expressions.

Logarithmic Functionprecalculus

The inverse of an exponential function: if b^y = x then log_b(x) = y.

// Logarithmic function: inverse of exponential
const base = 2;
for (let x of [1, 2, 4, 8, 16, 32]) {
  console.log(`log_${base}(${x}) = ${Math.log(x) / Math.log(base)}`);
}

A logarithmic function answers the question: to what power must the base b be raised to produce x? Written as y = log_b(x), it is the inverse of the exponential function y = b^x. Logarithmic functions have a vertical asymptote at x = 0, pass through (1, 0), and grow slowly compared to polynomial functions.

Linear Combinationlinear algebra

An expression c1*v1 + c2*v2 + ... + cn*vn where ci are scalars.

// Linear combination: 2*[1,0] + 3*[0,1] = [2,3]
const v1 = [1, 0];
const v2 = [0, 1];
const c1 = 2, c2 = 3;
const result = v1.map((x, i) => c1 * x + c2 * v2[i]);
console.log('Result:', result); // [2, 3]

A linear combination is a sum of vectors each multiplied by a scalar coefficient. The set of all linear combinations of a given set of vectors is called their span. Linear combinations are the fundamental building block of linear algebra, connecting concepts like span, linear independence, basis, and dimension.

M
Map (Array Method)programming foundations

Transforms every element in an array by applying a function, returning a new array.

[1, 2, 3].map(x => x * 2)
// [2, 4, 6]

The map method creates a new array by calling a provided function on every element of the original array. The new array has the same length — each element is the result of the transformation function. Map does not modify the original array. In Python, the equivalent is a list comprehension: `[f(x) for x in arr]`.

Mutabilityprogramming foundations

Whether a value can be changed after it is created.

const arr = [1, 2, 3];
arr.push(4);  // mutated in place!

const str = "hello";
// str[0] = "H"; // ERROR: strings are immutable

A mutable value can be modified in place after creation. Arrays and objects are mutable in JavaScript and Python — you can add, remove, or change their contents. An immutable value cannot be changed — strings and numbers are immutable. Understanding mutability is crucial for avoiding unintended side effects, especially when objects are shared across different parts of a program.

Methodprogramming foundations

A function stored as a property on an object.

const user = {
  name: "Alice",
  greet() {
    return "Hi, " + this.name;
  }
};
user.greet(); // "Hi, Alice"

A method is a function that belongs to an object. It is defined as a property whose value is a function. Methods can access other properties of the same object using `this` (JavaScript) or `self` (Python). Methods give objects behavior in addition to data — this is the foundation of object-oriented programming.

Memoizationprogramming foundations

Caching function results to avoid recomputing for the same inputs.

function fib(n, memo = {}) {
  if (n <= 1) return n;
  if (memo[n]) return memo[n];
  memo[n] = fib(n-1, memo) + fib(n-2, memo);
  return memo[n];
}

Memoization is an optimization technique where the results of expensive function calls are stored (cached) and returned when the same inputs occur again. It's particularly effective for recursive functions with overlapping subproblems (like Fibonacci). In Python, `@lru_cache` provides memoization. In JavaScript, you typically use a cache object or Map.

Method Chainingprogramming foundations

Calling multiple methods in sequence, each operating on the result of the previous.

[1,2,3,4,5]
  .filter(n => n > 2)   // [3,4,5]
  .map(n => n * 10)     // [30,40,50]
  .reduce((s,n) => s+n, 0) // 120

Method chaining is a pattern where multiple method calls are linked together in a single expression. Each method returns a value (usually a new array or the same object) that the next method is called on. Common in array operations (`arr.filter(...).map(...).reduce(...)`) and promise chains (`.then(...).then(...).catch(...)`).

Moduleprogramming foundations

A file that encapsulates related code and exports specific values for other files to use.

// utils.js
export function add(a, b) {
  return a + b;
}

// main.js
import { add } from "./utils.js";

A module is a self-contained unit of code (typically one file) that has its own scope. Modules export specific functions, classes, or values that other modules can import. This prevents naming conflicts, organizes code by responsibility, and makes dependencies explicit. In JavaScript, ES modules use import/export syntax. In Python, every .py file is a module.

Merge Sortdata structures algorithms

A divide-and-conquer sort that splits, sorts halves, and merges — O(n log n).

function mergeSort(arr) {
  if (arr.length <= 1) return arr;
  const mid = Math.floor(arr.length / 2);
  const left = mergeSort(arr.slice(0, mid));
  const right = mergeSort(arr.slice(mid));
  return merge(left, right);
}

Merge sort divides the array in half, recursively sorts each half, then merges the sorted halves. Always O(n log n) time. Stable (preserves order of equal elements). Uses O(n) extra space for merging. The go-to sort when stability and guaranteed performance matter.

Multithreadingoperating systems

Running multiple threads concurrently within a single process.

# Python threading
import threading
t = threading.Thread(target=my_func)
t.start()
t.join()  # wait for completion

Multithreading allows a process to perform multiple tasks simultaneously. A web server might use one thread per request. A GUI app uses a main thread for UI and worker threads for computation. Challenges: race conditions, deadlocks, and the need for synchronization primitives (mutexes, semaphores).

Memory Managementoperating systems

How the OS and runtime allocate, use, and reclaim memory.

// Stack: local variables (automatic)
function foo() { let x = 42; }

// Heap: objects (GC-managed)
const obj = { data: new Array(1000) };

Memory management handles allocating memory for programs, tracking what's in use, and reclaiming unused memory. The stack holds function-local variables (automatic, fast). The heap holds dynamically allocated objects (flexible, slower). Garbage collectors automate heap cleanup in languages like JS and Python.

Message Queuedistributed systems

A middleware that stores and forwards messages between decoupled services.

// Producer
await queue.send({ type: 'order', id: 123 });

// Consumer (separate service)
queue.receive((msg) => {
  processOrder(msg.id);
  msg.ack(); // acknowledge
});

A message queue (RabbitMQ, Kafka, SQS) receives messages from producers and delivers them to consumers. Queues decouple services: producers don't need to know about consumers. Benefits: load leveling (absorb spikes), reliability (messages persist), and fan-out (one message to many consumers via pub/sub).

Microservicessystem design

An architecture where an application is split into small, independently deployable services.

// Monolith: one app does everything
// Microservices:
// - User Service (port 3001)
// - Order Service (port 3002)
// - Payment Service (port 3003)
// Each deploys independently

Microservices decompose a monolith into small services, each responsible for one business capability. Services communicate via APIs (HTTP/gRPC) or message queues. Benefits: independent deployment, technology diversity, fault isolation. Costs: network complexity, distributed transactions, operational overhead.

Matrixmathematics

A 2D array of numbers used for linear transformations and data representation.

import numpy as np
A = np.array([[1,2],[3,4]])
B = np.array([[5,6],[7,8]])
A @ B  # matrix multiplication
# [[19, 22], [43, 50]]

A matrix is a rectangular array of numbers with rows and columns. Matrix multiplication is the core operation of neural networks — each layer multiplies inputs by a weight matrix. Key operations: multiplication, transposition, inversion. An m×n matrix has m rows and n columns.

Metrics & Tracessystem design

Numeric measurements and request flow tracking used to monitor system health.

const start = Date.now();
await handleRequest(req);
metrics.histogram('request_ms', Date.now() - start);

Metrics are numeric values tracked over time: request count, error rate, latency. Traces follow a single request through multiple services. Together with logs, they form the three pillars of observability.

Monolithsystem design

An application architecture where all functionality lives in a single deployable unit.

const app = express();
app.use('/users', userRoutes);
app.use('/orders', orderRoutes);
app.use('/payments', paymentRoutes);
app.listen(3000);

A monolith packages all features into one codebase and deployment artifact. Simpler development and debugging, but scaling requires scaling everything.

MVC Patternsystem design

A design pattern that separates an app into Model, View, and Controller layers.

class User { constructor(name) { this.name = name; } }
app.get('/user/:id', (req, res) => {
  const user = UserModel.find(req.params.id);
  res.render('userView', { user });
});

MVC divides an application into Model (data/logic), View (UI), and Controller (handles input). This separation makes code modular and testable.

Mini-Batchmachine learning

A small subset of training data used to compute a gradient update.

batch_size = 32
for epoch in range(10):
    for i in range(0, len(data), batch_size):
        batch = data[i:i+batch_size]
        loss = train_step(model, batch)

A mini-batch is a small group of training examples (32-128) processed together in one gradient step. Balances speed and stability compared to full-batch or single-sample SGD.

Mean Squared Error (MSE)machine learning

A loss function that averages the squared differences between predictions and actual values.

import numpy as np
predicted = np.array([2.5, 3.0, 4.2])
actual = np.array([3.0, 3.0, 4.0])
mse = np.mean((predicted - actual) ** 2)

MSE computes the average of (predicted - actual) squared across all samples. Squaring amplifies large errors. Standard loss function for regression tasks.

Matrix Operationsmathematics

Mathematical operations performed on rectangular grids of numbers (matrices).

const A = [[1,2],[3,4]];
const B = [[5,6],[7,8]];
// A*B[0][0] = 1*5 + 2*7 = 19

Matrix operations include addition, scalar multiplication, transposition, and matrix multiplication. Matrix multiplication is not commutative. Powers neural networks and computer graphics.

Mergegit version control

Combining changes from one branch into another.

// git checkout main
// git merge feature-login

A merge integrates changes from one branch into another. Git auto-merges when changes don't overlap. If both branches modified the same lines, a merge conflict occurs.

Merge Conflictgit version control

A situation where Git cannot automatically combine changes because both branches edited the same lines.

// <<<<<<< HEAD
// const color = 'blue';
// =======
// const color = 'red';
// >>>>>>> feature-theme

Git marks conflicting sections with <<<<<<< ======= >>>>>>> markers. You must manually edit to resolve, then stage and commit.

Memory Hierarchycomputer hardware

The layered system of storage from fast registers to slow disks, trading speed for capacity.

// Access times (approximate)
// Register: 0.3 ns
// L1 Cache: 1 ns
// L2 Cache: 4 ns
// RAM: 100 ns
// SSD: 100,000 ns
// HDD: 10,000,000 ns

The memory hierarchy arranges storage in layers: registers (fastest, smallest), L1/L2/L3 cache, RAM, SSD, and HDD (slowest, largest). Each level is 10-100x slower but 10-100x larger than the one above. Programs exploit locality to keep frequently used data in faster layers.

Memory Modelprogramming foundations

How a program organizes data in memory using stack and heap regions.

// Stack: local variables, function calls
function foo() { let x = 5; } // x on stack
// Heap: objects, dynamic allocation
const obj = { name: "Alice" }; // obj on heap

The memory model defines how a program uses different memory regions: the stack (for function calls and local variables, LIFO) and the heap (for dynamically allocated objects). Understanding the memory model explains variable lifetimes, garbage collection, and stack overflow errors.

Multiplicationarithmetic

The arithmetic operation of repeated addition, combining groups of equal size.

let product = 6 * 7;  // 42
let scaled = 3.5 * 2;  // 7

Multiplication is the operation of scaling one number by another. It is commutative (a * b = b * a), associative ((a * b) * c = a * (b * c)), and distributes over addition (a * (b + c) = a * b + a * c). The result is called the product, and the identity element is one (a * 1 = a).

Mathematical Modelingalgebra

The process of translating a real-world situation into mathematical equations or expressions.

// Model: A car travels at 60 mph for t hours
// Distance = rate * time
function distance(rate, time) {
  return rate * time;
}
distance(60, 2.5);  // 150 miles

Mathematical modeling converts a real-world problem into mathematical language so it can be solved with algebraic techniques. This involves identifying variables, establishing relationships between quantities, writing equations, solving them, and interpreting the results in context. Common models include distance-rate-time problems, mixture problems, and optimization scenarios.

Mixture Problemalgebra

A word problem involving combining two or more quantities with different properties to achieve a desired result.

// Mix x liters of 30% solution with (10-x)
// liters of 60% to get 10L of 40% solution
// 0.30x + 0.60(10 - x) = 0.40 * 10
// -0.30x = -2, x = 6.67 liters

A mixture problem asks you to combine substances or items with different characteristics (such as concentration, price, or speed) and find the resulting mixture's properties or the amounts needed. These problems are solved by setting up equations where the total amount of a key quantity is conserved. For example, mixing solutions of different concentrations to achieve a target concentration.

Midpointgeometry

The point exactly halfway between two given points.

const midpoint = (x1, y1, x2, y2) => ({
  x: (x1 + x2) / 2,
  y: (y1 + y2) / 2
});
midpoint(2, 4, 6, 8); // { x: 4, y: 6 }

The midpoint of a line segment is the point that divides it into two equal halves. For two points (x1, y1) and (x2, y2), the midpoint is ((x1 + x2) / 2, (y1 + y2) / 2). The midpoint is equidistant from both endpoints, and this formula generalizes to higher dimensions by averaging each coordinate.

Mathematical Inductionlogic proofs

A proof technique that establishes a statement for all natural numbers using a base case and an inductive step.

// Verify sum formula by induction concept:
const sumTo = (n) => n * (n + 1) / 2;
// Base: sumTo(1) = 1
// Step: sumTo(k+1) = sumTo(k) + (k+1)

Mathematical induction is a proof method used to show that a statement P(n) holds for all natural numbers n >= n0. It consists of two parts: (1) the base case, which verifies P(n0) directly, and (2) the inductive step, which proves that P(k) implies P(k + 1) for arbitrary k. By the principle of induction, these two steps together guarantee P(n) is true for every n >= n0.

Maclaurin Seriescalculus 2

A Taylor series centered at x = 0.

// Maclaurin series for e^x
function expMaclaurin(x, terms) {
  let sum = 0, factorial = 1;
  for (let n = 0; n < terms; n++) {
    if (n > 0) factorial *= n;
    sum += Math.pow(x, n) / factorial;
  }
  return sum;
}
console.log(expMaclaurin(1, 20)); // approaches e = 2.71828...

A Maclaurin series is the special case of a Taylor series expanded about the point x = 0, giving sum of f^(n)(0) / n! * x^n for n = 0 to infinity. Common Maclaurin series include e^x = sum x^n/n!, sin(x) = sum (-1)^n * x^(2n+1)/(2n+1)!, and cos(x) = sum (-1)^n * x^(2n)/(2n)!. These series provide polynomial approximations that are most accurate near the origin.

Matrix Multiplicationlinear algebra

An operation combining two matrices where each entry is the dot product of a row from the first and a column from the second.

function matMul(A, B) {
  const m = A.length, n = B[0].length, k = B.length;
  return Array.from({length: m}, (_, i) =>
    Array.from({length: n}, (_, j) =>
      A[i].reduce((sum, a, l) => sum + a * B[l][j], 0)
    )
  );
}
const A = [[1, 2], [3, 4]];
const B = [[5, 6], [7, 8]];
console.log(matMul(A, B)); // [[19,22],[43,50]]

The product of an m x n matrix A and an n x p matrix B is an m x p matrix C where C[i][j] = sum of A[i][k]*B[k][j] for k = 1 to n. Matrix multiplication represents the composition of linear transformations: if A represents T and B represents S, then AB represents the transformation T composed with S. The operation is associative but not commutative in general.

Multivariable Chain Rulemultivariable calc

A rule for differentiating compositions of multivariable functions by summing products of partial derivatives along each dependency path.

// Chain rule: dz/dt where z = f(x(t), y(t))
const dz_dt = df_dx * dx_dt + df_dy * dy_dt;

If z = f(x, y) where x = x(t) and y = y(t), the multivariable chain rule gives dz/dt = (∂f/∂x)(dx/dt) + (∂f/∂y)(dy/dt). More generally, for compositions involving multiple intermediate and independent variables, each partial derivative is a sum over all paths in the dependency tree. This rule is compactly expressed using Jacobian matrix multiplication.

Multivariable Functionmultivariable calc

A function that takes two or more input variables and produces one or more output values.

// A multivariable function f(x, y) = x² + y²
function f(x, y) {
  return x * x + y * y;
}

A multivariable function f: Rⁿ → Rᵐ maps an n-dimensional input to an m-dimensional output. When m = 1, the function is scalar-valued and its graph is a surface or hypersurface. Multivariable functions are the foundation of multivariable calculus, requiring new tools like partial derivatives and multiple integrals to analyze their behavior.

Margin of Errorprobability stats

The maximum expected difference between a sample statistic and the true population parameter at a given confidence level.

// Margin of error for a survey proportion
const pHat = 0.55; // sample proportion
const n = 400;     // sample size
const z = 1.96;    // 95% confidence
const moe = z * Math.sqrt(pHat * (1 - pHat) / n);
console.log(`MOE = ±${(moe * 100).toFixed(1)}%`); // ±4.9%

The margin of error (MOE) quantifies the uncertainty in a sample estimate and defines half the width of a confidence interval. For a proportion, MOE = z* × √(p̂(1-p̂)/n), where z* is the critical value for the chosen confidence level. A smaller margin of error requires either a larger sample size or a lower confidence level. It is commonly reported in polls and surveys to convey the precision of results.

Modular Arithmeticdiscrete math

A system of arithmetic for integers where numbers wrap around after reaching a fixed modulus.

// Clock arithmetic: what hour is it 27 hours from now?
const currentHour = 10;
const hoursLater = 27;
const result = (currentHour + hoursLater) % 12;
console.log(result); // 1

Modular arithmetic is a system in which integers are considered equivalent if they share the same remainder upon division by a positive integer n (the modulus). Operations of addition, subtraction, and multiplication are well-defined on residue classes modulo n. Modular arithmetic is foundational in cryptography (RSA, Diffie-Hellman), hash functions, and computer science applications like circular buffers and clock arithmetic.

Modular Inversediscrete math

The integer x such that a * x ≡ 1 (mod n), enabling division in modular arithmetic.

// Find modular inverse using Extended Euclidean Algorithm
function modInverse(a, n) {
  let [old_r, r] = [a, n];
  let [old_s, s] = [1, 0];
  while (r !== 0) {
    const q = Math.floor(old_r / r);
    [old_r, r] = [r, old_r - q * r];
    [old_s, s] = [s, old_s - q * s];
  }
  return old_r === 1 ? ((old_s % n) + n) % n : null;
}
console.log(modInverse(3, 7)); // 5, because 3*5=15≡1(mod 7)

The modular inverse of an integer a modulo n is an integer x such that a * x ≡ 1 (mod n). It exists if and only if gcd(a, n) = 1, meaning a and n are coprime. The Extended Euclidean Algorithm is the standard method for computing modular inverses. Modular inverses are critical in cryptographic algorithms like RSA, where decryption requires computing the inverse of the encryption exponent.

Multiplication Principlediscrete math

If two tasks are performed in sequence, the total number of outcomes is the product of the outcomes of each task.

// Outfits: 5 shirts × 3 pants × 2 shoes
const shirts = 5, pants = 3, shoes = 2;
const outfits = shirts * pants * shoes;
console.log(outfits); // 30

The Multiplication Principle (Rule of Product) states that if a procedure can be broken into k sequential steps, where step 1 can be done in n1 ways, step 2 in n2 ways, and so on independently, then the entire procedure can be done in n1 * n2 * ... * nk ways. This principle underlies the formulas for permutations (n!) and combinations (n choose k), and extends to the Cartesian product of sets.

Mean Value Theoremreal analysis

If f is continuous on [a,b] and differentiable on (a,b), some interior point has derivative equal to the average rate of change.

// Find c satisfying MVT for f(x) = x^2 on [1, 3]
const f = x => x * x;
const a = 1, b = 3;
const avgRate = (f(b) - f(a)) / (b - a); // (9-1)/2 = 4
// f'(x) = 2x = 4 => x = 2
const c = avgRate / 2; // 2
console.log(`c = ${c}, f'(c) = ${2*c}, avg = ${avgRate}`);

The Mean Value Theorem states that if f is continuous on [a, b] and differentiable on (a, b), then there exists a point c in (a, b) such that f'(c) = (f(b) - f(a)) / (b - a). This theorem connects the average rate of change over an interval to an instantaneous rate of change at some interior point. It is proved by applying Rolle's Theorem to an auxiliary function and is fundamental to many results in differential calculus.

Metric Spacereal analysis

A set equipped with a distance function satisfying positivity, symmetry, and the triangle inequality.

// Euclidean metric in R^2
function euclidean(p, q) {
  return Math.sqrt((p[0]-q[0])**2 + (p[1]-q[1])**2);
}
const a = [0,0], b = [3,4], c = [1,0];
console.log('d(a,b):', euclidean(a,b));  // 5
// Triangle inequality: d(a,b) <= d(a,c) + d(c,b)
console.log(euclidean(a,b) <= euclidean(a,c) + euclidean(c,b)); // true

A metric space is a pair (X, d) where X is a set and d: X x X -> R is a metric (distance function) satisfying three axioms: (1) d(x, y) >= 0 with equality iff x = y (positivity), (2) d(x, y) = d(y, x) (symmetry), and (3) d(x, z) <= d(x, y) + d(y, z) (triangle inequality). Metric spaces generalize the notion of distance from Euclidean space and provide the framework for defining convergence, continuity, and topological concepts in analysis.

Monotone Sequencecalculus 2

A sequence that is either always increasing or always decreasing.

// Decreasing sequence a_n = 1/n
const seq = [1, 2, 3, 4, 5].map(n => 1/n);
console.log(seq); // [1, 0.5, 0.333..., 0.25, 0.2]

A monotone sequence moves in only one direction: monotonically increasing means each term is greater than or equal to the previous, and monotonically decreasing means each term is less than or equal to the previous. The Monotone Convergence Theorem states that every bounded monotone sequence converges, making this property essential for proving convergence.

N
Namespaceprogramming foundations

A container that groups related identifiers to prevent naming conflicts.

import * as utils from "./utils.js";
import * as math from "./math.js";
utils.add(1, 2);  // different from
math.add(1, 2);   // no conflict!

A namespace is a scope that holds a set of identifiers (variable and function names). Modules act as namespaces — each module has its own scope, so `utils.add` and `math.add` can coexist without conflict. In JavaScript, `import * as utils` creates a namespace object. Namespaces organize code and prevent global scope pollution.

Node (Data Structure)data structures algorithms

A basic unit in a linked structure that holds data and references to other nodes.

class TreeNode {
  constructor(val) {
    this.val = val;
    this.left = null;
    this.right = null;
  }
}

A node is the fundamental building block of linked data structures (linked lists, trees, graphs). Each node stores a value and one or more pointers to other nodes. In a singly linked list, each node has one pointer (next). In a binary tree, each node has two (left, right).

Non-Blocking I/Ooperating systems

I/O operations that return immediately, notifying the program when data is ready.

// Non-blocking: thread continues
fs.readFile('file.txt', (err, data) => {
  console.log(data); // called later
});
console.log('runs immediately');

Non-blocking I/O returns immediately even if data isn't ready. The program continues executing and is notified (via callback, promise, or event) when the operation completes. This is how Node.js handles thousands of connections on a single thread — the event loop manages all pending I/O.

Neural Networkdeep learning llms

A model of connected layers of neurons that learns patterns from data.

# Simple neural network
input (784) → hidden (128, ReLU) → output (10, softmax)

# Forward pass: x → W₁x + b₁ → ReLU → W₂h + b₂ → softmax

A neural network has an input layer, one or more hidden layers, and an output layer. Each neuron computes: output = activation(weights · inputs + bias). The network learns by adjusting weights via backpropagation to minimize a loss function. Deep learning = neural networks with many layers.

Normal Formsdatabases

A series of rules (1NF, 2NF, 3NF, etc.) for reducing redundancy in database tables.

-- 1NF: separate table for phones
CREATE TABLE phones (
  user_id INT REFERENCES users(id),
  phone TEXT NOT NULL
);

Normal forms are progressive levels of database normalization. First Normal Form (1NF): no repeating groups, atomic values. Second Normal Form (2NF): 1NF plus no partial dependencies. Third Normal Form (3NF): 2NF plus no transitive dependencies.

Normalizationdatabases

The process of organizing database tables to minimize redundancy and dependency.

CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT, email TEXT);
CREATE TABLE orders (id SERIAL PRIMARY KEY, user_id INT REFERENCES users(id), total DECIMAL);

Normalization restructures tables to eliminate data redundancy and ensure data integrity. It involves decomposing large tables into smaller, focused ones connected by foreign keys.

Normalization (ML)machine learning

Scaling input features to a consistent range so no single feature dominates the model.

from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
X_normalized = scaler.fit_transform(X)

Normalization rescales feature values to a comparable range. Min-max maps to [0,1]. Z-score standardization transforms to mean=0, std=1. Most gradient-based models train faster with normalized inputs.

Neurondeep learning llms

The basic unit of a neural network that computes a weighted sum plus activation.

import numpy as np
def neuron(inputs, weights, bias):
    z = np.dot(inputs, weights) + bias
    return max(0, z)  # ReLU

A neuron receives inputs, multiplies each by a weight, sums them, adds bias, and passes through an activation function: output = activation(w1*x1 + w2*x2 + ... + b).

Normmathematics

A function that measures the length or magnitude of a vector.

const v = [3, 4];
const norm = Math.sqrt(v[0]**2 + v[1]**2); // 5

The L2 (Euclidean) norm is sqrt(v1^2 + v2^2 + ...). Used to measure distances, normalize vectors, and regularize ML models.

Number Linearithmetic

A straight line on which every point corresponds to a real number.

A number line is a visual representation of numbers arranged in order along a horizontal line, with zero at the center, positive numbers extending to the right, and negative numbers to the left. It is used to illustrate ordering, distance (absolute value), and arithmetic operations. Each point on the line corresponds to exactly one real number.

Numerator and Denominatorarithmetic

The top and bottom numbers of a fraction, representing the number of parts taken and the total number of equal parts.

// In the fraction 3/4:
let numerator = 3;    // parts taken
let denominator = 4;  // total equal parts
let value = numerator / denominator;  // 0.75

In a fraction a/b, the numerator (a) indicates how many parts are being counted, while the denominator (b) indicates how many equal parts the whole is divided into. The denominator must never be zero. Changing only the numerator changes the fraction's size; changing the denominator changes the size of each part.

Number Line Inequalityalgebra

A visual representation of an inequality's solution set on a number line.

A number line inequality displays the solution set of an inequality by shading the appropriate portion of a number line. An open circle indicates that the endpoint is not included (strict inequality: < or >), while a closed (filled) circle indicates inclusion (≤ or ≥). An arrow shows that the solutions extend infinitely in one direction.

Negationlogic proofs

A unary logical operation that reverses the truth value of a proposition.

const negate = (p) => !p;
negate(true);  // false
negate(false); // true
// Double negation: !!true === true

Negation is the logical operation that takes a single proposition P and produces NOT P, which is true when P is false and false when P is true. Negation is an involution: applying it twice returns the original truth value (NOT NOT P = P). The negation of a universal statement is existential, and vice versa: NOT(for all x, P(x)) = there exists x such that NOT P(x).

Natural Logarithmprecalculus

The logarithm with base e (≈ 2.71828), written ln(x), which is the inverse of the natural exponential function eˣ.

// Natural logarithm in JavaScript is Math.log()
console.log(Math.log(1));       // 0 — because e^0 = 1
console.log(Math.log(Math.E));  // 1 — because e^1 = e
console.log(Math.log(100));     // 4.605 — ln(100)
// Inverse relationship: e^(ln(x)) = x
console.log(Math.exp(Math.log(42))); // 42

The natural logarithm, denoted ln(x), is the logarithm with base e ≈ 2.71828. It answers the question: to what power must e be raised to produce x? The natural log is distinguished from other logarithms by its deep connection to calculus — the derivative of ln(x) is 1/x, and it can be defined as the integral of 1/t from 1 to x. It is ubiquitous in continuous growth models, compound interest, and differential equations.

Nonlinear Systemprecalculus

A system of equations in which at least one equation is not linear, often involving quadratics, conics, or other curves.

// Solve: y = x^2 and y = x + 2
// Substitution: x^2 = x + 2 → x^2 - x - 2 = 0 → (x-2)(x+1) = 0
const solutions = [
  { x: 2, y: 2**2 },    // (2, 4)
  { x: -1, y: (-1)**2 } // (-1, 1)
];
solutions.forEach(s => console.log(`(${s.x}, ${s.y})`));

A nonlinear system of equations contains at least one equation that is not of the first degree, such as a quadratic, polynomial, or conic equation. Solving such systems typically involves substitution (solving one equation for a variable and substituting into the other) or elimination. Unlike linear systems, nonlinear systems can have zero, one, two, or more solutions, and the solution set represents the intersection points of the curves described by each equation.

Nested Functioncalculus

A function used as the input to another function, forming a composition.

// Nested function: sin(x^2)
function outer(u) { return Math.sin(u); }
function inner(x) { return x * x; }
function composed(x) { return outer(inner(x)); }
console.log(composed(Math.sqrt(Math.PI))); // ~0 (sin(pi))

A nested function arises when one function is placed inside another, written as f(g(x)). The inner function g(x) is evaluated first, and its output becomes the input to the outer function f. Recognizing nested structure is essential for applying the chain rule correctly during differentiation.

Null Spacelinear algebra

The set of all vectors that a matrix maps to the zero vector.

// For A = [[1, 2], [2, 4]], the null space is span{[-2, 1]}
// because A * [-2, 1]^T = [1*(-2)+2*1, 2*(-2)+4*1] = [0, 0]
const A = [[1, 2], [2, 4]];
const v = [-2, 1];
const result = A.map(row => row[0]*v[0] + row[1]*v[1]);
console.log(result); // [0, 0]

The null space (or kernel) of a matrix A is the set of all vectors x such that Ax = 0. It is always a subspace of R^n for an m x n matrix. The dimension of the null space is called the nullity, and by the rank-nullity theorem, rank(A) + nullity(A) = n. A matrix is invertible if and only if its null space contains only the zero vector.

Normal Distributionprobability stats

A symmetric, bell-shaped continuous probability distribution defined by its mean and standard deviation.

// Approximate normal PDF
function normalPDF(x, mean, std) {
  const coeff = 1 / (std * Math.sqrt(2 * Math.PI));
  const exp = -0.5 * ((x - mean) / std) ** 2;
  return coeff * Math.exp(exp);
}
// Standard normal at key points
[-2, -1, 0, 1, 2].forEach(x =>
  console.log(`f(${x}) = ${normalPDF(x, 0, 1).toFixed(4)}`)
);

The normal (Gaussian) distribution N(μ, σ²) is a continuous probability distribution with probability density function f(x) = (1/(σ√(2π))) × e^(-(x-μ)²/(2σ²)). It is symmetric about its mean μ, with approximately 68% of values within one standard deviation, 95% within two, and 99.7% within three (the empirical rule). The normal distribution arises naturally via the Central Limit Theorem and is the most widely used distribution in statistical inference.

Null Hypothesisprobability stats

A default claim that there is no effect or no difference, which a hypothesis test seeks to find evidence against.

// Testing H₀: mean = 50 vs H₁: mean ≠ 50
const sample = [52, 48, 55, 51, 49, 53, 47, 54, 50, 52];
const n = sample.length;
const xBar = sample.reduce((a, b) => a + b) / n;
const s = Math.sqrt(sample.reduce((sum, x) => sum + (x - xBar) ** 2, 0) / (n - 1));
const mu0 = 50;
const tStat = (xBar - mu0) / (s / Math.sqrt(n));
console.log(`t-statistic = ${tStat.toFixed(3)}`);

The null hypothesis H₀ is a statement of no effect, no difference, or no association that serves as the default assumption in hypothesis testing. For example, H₀: μ = μ₀ asserts the population mean equals a specified value. The test calculates a p-value measuring the probability of observing data as extreme as the sample under H₀. If this probability is sufficiently small (below α), we reject H₀ in favor of the alternative hypothesis H₁. Failing to reject H₀ does not prove it true—it means insufficient evidence was found.

O
Objectprogramming foundations

A collection of key-value pairs that maps named properties to values.

const user = {
  name: "Alice",
  age: 28,
  isAdmin: true
};
user.name  // "Alice"

An object (called a dictionary or dict in Python) stores data as key-value pairs. Keys are typically strings; values can be any type including other objects. Objects are the primary way to represent structured data — entities with named attributes. In JavaScript, almost everything is an object. JSON (JavaScript Object Notation) is the standard serialization format based on objects.

Observabilitysystem design

The ability to understand a system's internal state from its external outputs.

// Logs: what happened
console.log(JSON.stringify({ event: 'order', id: 123 }));

// Metrics: how much
counter.inc('orders_created');

// Traces: request path
span.setTag('user_id', userId);

Observability has three pillars: Logs (event records), Metrics (numeric measurements over time), and Traces (request flow across services). Observable systems let you answer 'why is this broken?' not just 'is it broken?' Tools: Datadog, Grafana, Prometheus, Jaeger.

Overfittingmachine learning

When a model memorizes training data instead of learning general patterns.

# Training accuracy: 99.5%
# Test accuracy: 72.3%
# Gap = overfitting!

# Fix: add regularization
model.add(Dropout(0.5))

An overfit model performs well on training data but poorly on new data. It has learned noise and details specific to the training set. Signs: high training accuracy, low test accuracy. Solutions: more training data, regularization (L1/L2), dropout, early stopping, simpler model architecture.

Overheadoperating systems

The extra time or resources consumed by system operations beyond the actual work.

// Thread pool reduces overhead by reusing threads
const pool = new WorkerPool(4);
await pool.run(task);

Overhead is the cost of managing a system rather than doing productive work. Context switching has overhead. Function calls have overhead. Reducing overhead is a key optimization goal.

One-Hot Encodingmachine learning

Converting categorical values into binary columns, one per category.

import pandas as pd
df = pd.DataFrame({'color': ['red', 'green', 'blue']})
encoded = pd.get_dummies(df, columns=['color'])

One-hot encoding represents each category as a binary vector. Prevents the model from assuming ordinal relationships between categories.

Optimizermachine learning

An algorithm that adjusts model weights to minimize the loss function.

import torch.optim as optim
optimizer = optim.SGD(model.parameters(), lr=0.01)
optimizer = optim.Adam(model.parameters(), lr=0.001)

An optimizer implements the strategy for updating model parameters during training. SGD subtracts learning_rate * gradient. Adam combines momentum and adaptive learning rates.

Optimizationmathematics

The process of finding inputs that minimize or maximize a function's output.

let x = 0;
for (let i = 0; i < 100; i++) {
  x -= 0.1 * 2 * (x - 3);
} // x -> 3

Optimization finds the best solution by minimizing a cost function or maximizing an objective. In ML, gradient descent iteratively adjusts parameters to minimize prediction error.

Observabilityproduction engineering

The ability to understand a system's internal state from its external outputs.

const pillars = {
  logs: 'Structured event records',
  metrics: 'Counters, gauges, histograms',
  traces: 'Distributed request tracking'
};

Observability uses three pillars: logs (event records), metrics (numerical measurements), and traces (request paths). Lets engineers diagnose problems without deploying new code.

Order of Operationsarithmetic

The set of rules that determines the sequence in which operations are evaluated in an expression.

let a = 2 + 3 * 4;      // 14, not 20
let b = (2 + 3) * 4;    // 20
let c = 2 ** 3 + 1;     // 9 (8 + 1)

The order of operations is a convention that avoids ambiguity in mathematical expressions. Operations are evaluated in this priority: parentheses first, then exponents, then multiplication and division (left to right), and finally addition and subtraction (left to right). This is commonly remembered by the acronym PEMDAS.

One-Sided Limitcalculus

The value a function approaches from only the left or only the right of a point.

// One-sided limits of |x|/x at x = 0
function f(x) { return Math.abs(x) / x; }
console.log(f(0.001));  // 1 (right-hand limit)
console.log(f(-0.001)); // -1 (left-hand limit)
// Two-sided limit does not exist

A left-hand limit (x -> a^-) considers only values of x less than a, while a right-hand limit (x -> a^+) considers only values greater than a. The two-sided limit exists if and only if both one-sided limits exist and are equal. One-sided limits are crucial for analyzing piecewise functions and jump discontinuities.

Optimization (Calculus)calculus

Using derivatives to find the maximum or minimum values of a function.

// Maximize area of a rectangle with perimeter 20
// A(w) = w * (10 - w), A'(w) = 10 - 2w = 0 => w = 5
function area(w) { return w * (10 - w); }
function areaDerivative(w) { return 10 - 2 * w; }
console.log('Optimal width:', 5, 'Max area:', area(5)); // 25

Optimization in calculus involves finding extreme values of a function on a given domain. The process requires finding critical points where f'(x) = 0 or is undefined, classifying them using the first or second derivative test, and comparing with endpoint values on closed intervals. This technique solves problems like maximizing area, minimizing cost, or finding optimal dimensions.

Orthogonallinear algebra

Two vectors are orthogonal if their dot product is zero, meaning they are perpendicular.

function areOrthogonal(u, v) {
  const dot = u.reduce((sum, ui, i) => sum + ui * v[i], 0);
  return Math.abs(dot) < 1e-10;
}
console.log(areOrthogonal([1, 0, 0], [0, 1, 0])); // true
console.log(areOrthogonal([1, 1], [1, -1]));       // true
console.log(areOrthogonal([1, 1], [1, 1]));         // false

Two vectors u and v are orthogonal if u . v = 0, generalizing the concept of perpendicularity to arbitrary dimensions. An orthogonal set of nonzero vectors is automatically linearly independent. An orthogonal matrix Q satisfies Q^T Q = I, meaning its columns form an orthonormal basis. Orthogonal matrices preserve lengths and angles, making them essential in rotations and the QR decomposition.

Ordinary Differential Equationdifferential equations

An equation relating a function of one independent variable to its derivatives.

// Verify that y = e^(2x) solves y' - 2y = 0
function y(x) { return Math.exp(2 * x); }
function yPrime(x) { return 2 * Math.exp(2 * x); }
const x = 1;
console.log('y\' - 2y =', (yPrime(x) - 2 * y(x)).toFixed(6));

An ordinary differential equation (ODE) involves an unknown function y(x) and one or more of its derivatives with respect to a single independent variable x. The order of the ODE is the highest derivative that appears, and the degree is the power of that highest derivative when the equation is polynomial in derivatives. ODEs are fundamental to modeling physical, biological, and engineering systems where quantities change continuously.

Open Setreal analysis

A set where every point has a neighborhood entirely contained within the set.

// (0, 1) is open: every point has room around it
function isInteriorPoint(x, a, b) {
  if (x <= a || x >= b) return false;
  const epsilon = Math.min(x - a, b - x);
  return epsilon > 0;
}
console.log(isInteriorPoint(0.5, 0, 1)); // true
console.log(isInteriorPoint(0, 0, 1));   // false (boundary)

A subset U of a metric space (X, d) is open if for every point x in U, there exists an epsilon > 0 such that the open ball B(x, epsilon) = { y in X : d(x, y) < epsilon } is entirely contained in U. Open sets are the building blocks of topology: the empty set and X are open, arbitrary unions of open sets are open, and finite intersections of open sets are open. In the real line, open intervals (a, b) are the prototypical open sets.

Outer Functionprecalculus

In a composition f(g(x)), f is the outer function.

// Identifying the outer function
const g = x => x + 3;     // inner
const f = x => Math.sqrt(x); // outer
console.log(f(g(6)));     // g(6)=9, f(9)=3

In function composition (f o g)(x) = f(g(x)), the outer function is f, the one that is applied last. It receives the output of the inner function g as its input. Recognizing the outer function helps when decomposing complex expressions and is essential for applying the chain rule in calculus.

Orthogonal Vectorslinear algebra

Two vectors whose dot product is zero.

// Check if two vectors are orthogonal
const a = [1, 2, -1];
const b = [2, -1, 0];
const dot = a.reduce((sum, val, i) => sum + val * b[i], 0);
console.log('Dot product:', dot, '| Orthogonal:', dot === 0);

Two vectors are orthogonal if their dot product equals zero, meaning they are perpendicular in the geometric sense. Orthogonality generalizes the notion of right angles to any number of dimensions. A set of mutually orthogonal nonzero vectors is always linearly independent, making orthogonal bases particularly useful for computation and analysis.

P
Parameterprogramming foundations

A variable declared in a function definition that receives a value when called.

function greet(name) {
//            ^^^^ parameter
  return `Hi ${name}`;
}

A parameter is a variable listed in a function's definition that acts as a placeholder for values the function will receive. When the function is called, the actual values passed in (arguments) are assigned to the parameters. Parameters define the function's interface.

Propertyprogramming foundations

A named value stored on an object, accessed via dot or bracket notation.

const obj = { x: 1, y: 2 };
obj.x     // 1 (dot notation)
obj["y"]  // 2 (bracket notation)
obj.z = 3; // add new property

A property is a key-value pair on an object. The key (property name) is a string, and the value can be any type. Properties are accessed with dot notation (`obj.name`) or bracket notation (`obj["name"]`). Properties can be added, modified, or deleted at runtime in JavaScript and Python.

Promiseprogramming foundations

An object representing a value that will be available in the future.

const p = new Promise((resolve, reject) => {
  setTimeout(() => resolve(42), 1000);
});
p.then(val => console.log(val)); // 42

A Promise is an object that represents the eventual completion (or failure) of an asynchronous operation. It has three states: pending (not yet settled), fulfilled/resolved (completed with a value), or rejected (failed with an error). Promises are consumed with .then()/.catch() or with async/await.

Packageprogramming foundations

A collection of modules published for others to install and use.

// Install: npm install lodash
import _ from "lodash";
_.chunk([1,2,3,4], 2); // [[1,2],[3,4]]

A package is a distributable collection of modules, typically published to a registry (npm for JavaScript, PyPI for Python). Packages have a name, version, and dependency list. You install them with package managers (npm install, pip install) and import them like local modules. Popular packages: React, Express, lodash (JS); Django, pandas, requests (Python).

Push/Popdata structures algorithms

The two fundamental stack operations — add to top and remove from top.

stack.push(42);  // add to top
stack.pop();     // remove from top → 42
stack[stack.length-1]; // peek at top

Push adds an element to the top of the stack. Pop removes and returns the top element. Both operations are O(1). Peek (or top) returns the top element without removing it. These operations enforce the LIFO ordering.

Priority Queuedata structures algorithms

A queue where elements are dequeued in order of priority, not arrival time.

pq.insert(5); pq.insert(1); pq.insert(3);
pq.extractMin(); // 1 (highest priority)
pq.extractMin(); // 3

A priority queue serves the highest-priority element first regardless of insertion order. Typically implemented with a heap data structure for O(log n) insert and O(log n) extract-min/max. Used in Dijkstra's algorithm, task scheduling, and event-driven simulation.

Processoperating systems

An independent running instance of a program with its own memory space.

// Node.js: spawn a child process
const { exec } = require('child_process');
exec('ls -la', (err, stdout) => console.log(stdout));

A process is a program in execution. Each process has its own memory space, file descriptors, and security context. The OS schedules processes to share the CPU. Processes are isolated — one crashing doesn't affect others. Created via fork/exec (Unix) or CreateProcess (Windows).

Process Stateoperating systems

The current status of a process: new, ready, running, waiting, or terminated.

New → Ready → Running → Terminated
              ↕
           Waiting (I/O)

A process transitions through states: New (being created), Ready (waiting for CPU), Running (executing on CPU), Waiting/Blocked (waiting for I/O), Terminated (finished). The OS scheduler moves processes between ready and running states.

Process ID (PID)operating systems

A unique number assigned by the OS to identify each running process.

process.pid       // Node.js
os.getpid()       # Python
ps aux | grep node  # Terminal

Every process gets a unique Process ID (PID) from the OS. PIDs are used to manage processes: send signals (kill), check status, and establish parent-child relationships. PID 1 is typically the init/systemd process. You can view PIDs with `ps` or `top`.

Parallelismoperating systems

Executing multiple tasks truly simultaneously on multiple CPU cores.

// True parallelism with Worker Threads
const { Worker } = require('worker_threads');
new Worker('./heavy-computation.js');

Parallelism requires multiple CPU cores or processors executing instructions at the same time. It's a subset of concurrency. A 4-core CPU can run 4 threads in parallel. Parallelism speeds up CPU-bound tasks but doesn't help I/O-bound tasks (which benefit from concurrency).

Process Schedulingoperating systems

The OS algorithm that decides which process gets CPU time and when.

// Round Robin: each process gets a time quantum
Process A: [==]    [==]
Process B:    [==]     [==]
Process C:       [==]

The scheduler determines which ready process runs next on the CPU. Algorithms include FCFS (first come first served), Round Robin (time slices), Priority (highest priority first), and Multilevel Feedback Queue. Preemptive schedulers can interrupt running processes; cooperative schedulers wait for voluntary yields.

Page Tableoperating systems

A data structure mapping virtual memory pages to physical memory frames.

// Page Table Entry
Virtual Page 5 → Physical Frame 12
Virtual Page 6 → Physical Frame 3
Virtual Page 7 → [on disk] (page fault!)

A page table translates virtual addresses to physical addresses. Memory is divided into fixed-size pages (typically 4KB). Each page table entry maps a virtual page number to a physical frame number and includes status bits (present, dirty, accessed). The TLB (Translation Lookaside Buffer) caches recent translations for speed.

Page Faultoperating systems

An interrupt triggered when a program accesses a page not currently in physical memory.

// Program accesses virtual address
// Page not in RAM → page fault
// OS loads page from disk → resumes program
// This is ~100,000x slower than a RAM access

A page fault occurs when a process accesses a virtual page that isn't in RAM. The OS must load the page from disk (swap space), which is extremely slow (~10ms vs ~100ns for RAM). Excessive page faults = thrashing, where the system spends more time swapping than executing. Adding RAM or optimizing memory usage fixes this.

Primary Keydatabases

A column (or columns) that uniquely identifies each row in a table.

CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email TEXT UNIQUE NOT NULL,
  name TEXT NOT NULL
);

A primary key is a unique, non-null identifier for each row. Common choices: auto-incrementing integer (id), UUID, or natural key (email). Primary keys are automatically indexed. Every table should have a primary key. Foreign keys in other tables reference primary keys to create relationships.

Probabilitymathematics

A number between 0 and 1 representing the likelihood of an event occurring.

# Coin flip: P(heads) = 0.5
# Rolling 6: P(six) = 1/6 ≈ 0.167
# Two heads in a row: 0.5 * 0.5 = 0.25

Probability quantifies uncertainty. P(event) = favorable outcomes / total outcomes. P = 0 means impossible, P = 1 means certain. Key rules: P(A or B) = P(A) + P(B) - P(A and B). Independent events: P(A and B) = P(A) × P(B). Bayesian probability updates beliefs with new evidence.

Prompt Engineeringdeep learning llms

Crafting effective inputs to guide LLM outputs toward desired results.

// Zero-shot
"Classify this review as positive or negative"

// Few-shot
"Review: Great! → positive
 Review: Terrible → negative
 Review: Amazing → "

Prompt engineering is the practice of designing inputs that elicit accurate, useful responses from language models. Techniques: system prompts (set behavior), few-shot examples (show desired format), chain-of-thought (request step-by-step reasoning), structured output (request JSON). Prompt quality often matters more than model size.

Primary-Replicadatabases

A replication topology where one server handles writes and replicas serve reads.

const primary = new Pool({ host: 'db-primary' });
const replica = new Pool({ host: 'db-replica' });
await primary.query('INSERT INTO orders ...');
await replica.query('SELECT * FROM orders ...');

In primary-replica replication, the primary server processes all write operations and streams changes to one or more read replicas. Replicas handle read queries, distributing load across servers.

Process Control Block (PCB)operating systems

A kernel data structure that stores all information the OS needs about a process.

// Conceptual PCB structure
// PCB { pid: 1234, state: 'running',
//   registers: { eax: 0x5, eip: 0x401000 },
//   openFiles: [fd0, fd1, fd2] }

The Process Control Block stores the process ID, state, CPU register values, program counter, memory mappings, open file descriptors, and scheduling priority. During a context switch, the OS saves and loads PCBs.

Priority Schedulingoperating systems

A scheduling algorithm where each process is assigned a priority and higher priorities run first.

// P1: priority 3
// P2: priority 1 <- runs first
// P3: priority 2 <- runs second
// Aging: P1 priority improves over time

Priority scheduling assigns a numeric priority to each process, and the CPU always runs the highest-priority ready process. The risk is starvation — low-priority processes may never run. Aging solves this.

Partition Tolerancedistributed systems

A system's ability to continue operating despite network partitions between nodes.

// Network partition: nodes A,B can't reach C,D
// Partition-tolerant: both sides keep running
// After healing: reconcile diverged state

Partition tolerance means the system continues to function even when network failures prevent some nodes from communicating. In practice, partitions are inevitable, so partition tolerance is not optional.

Paxosdistributed systems

A foundational consensus algorithm for achieving agreement among distributed nodes.

// Phase 1: Prepare
proposer.send('PREPARE', proposalNum);
// Phase 2: Accept
proposer.send('ACCEPT', proposalNum, value);

Paxos is a consensus algorithm where a proposer sends a proposal to acceptors, who promise not to accept older proposals. Once a majority accepts, the value is chosen. Many modern systems use Raft as a more understandable alternative.

Producer-Consumerdistributed systems

A pattern where producers send messages to a queue and consumers process them.

await queue.send({ type: 'email', to: 'a@b.com' });
while (true) {
  const msg = await queue.receive();
  await sendEmail(msg.data);
  await msg.ack();
}

The producer-consumer pattern decouples the creation of work from its processing via a shared queue. This enables independent scaling and fault isolation.

Pub/Subdistributed systems

A messaging pattern where publishers broadcast messages to all interested subscribers.

await topic.publish('order-events', { id: 1 });
topic.subscribe('order-events', chargeCustomer);
topic.subscribe('order-events', sendConfirmation);

Publish-subscribe is a messaging pattern where publishers send messages to a topic and subscribers receive all messages on subscribed topics. Unlike point-to-point queues, pub/sub delivers each message to every subscriber.

Precision & Recallmachine learning

Precision measures correctness of positive predictions; recall measures completeness.

precision = 40 / (40 + 10)  # 0.80
recall    = 40 / (40 + 5)   # 0.89
f1 = 2 * (precision * recall) / (precision + recall)

Precision = TP/(TP+FP). Recall = TP/(TP+FN). The F1 score is the harmonic mean of both, balancing the tradeoff in a single number.

Pushgit version control

Uploading local commits to a remote repository.

// git push origin main
// git push -u origin feature-login

Pushing sends local commits to a remote. A push is rejected if the remote has newer commits you haven't pulled.

Pullgit version control

Downloading and integrating remote changes into your local branch.

// git pull origin main
// Equivalent: git fetch origin && git merge origin/main

Pulling fetches new commits from a remote and merges them into your local branch. Essentially git fetch followed by git merge.

Pull Requestgit version control

A request to merge your branch into another, enabling code review before integration.

// git push -u origin feature-login
// gh pr create --title 'Add login page'

A PR provides a space for code review, discussion, and automated CI checks before changes are accepted. Primary collaboration mechanism in modern dev.

POSTcomputer hardware

Power-On Self Test — hardware diagnostics that run immediately when a computer starts.

// POST checks (conceptual)
// 1. CPU registers working? -> pass
// 2. RAM detected and accessible? -> pass
// 3. GPU initialized? -> pass
// 4. Storage device found? -> pass
// All pass -> continue to bootloader

POST (Power-On Self Test) is a series of diagnostic checks run by firmware when the computer powers on. It verifies that essential hardware (CPU, RAM, GPU, storage) is present and functioning. Failures are reported via beep codes or on-screen messages.

PEMDASarithmetic

An acronym for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction — the standard order of operations.

// P: (2 + 3) = 5
// E: 5 ** 2 = 25
// M/D: 25 * 2 = 50
// A/S: 50 - 1 = 49
let result = (2 + 3) ** 2 * 2 - 1;  // 49

PEMDAS is a mnemonic for the order of operations: Parentheses first, then Exponents, then Multiplication and Division (left to right), and finally Addition and Subtraction (left to right). Note that multiplication and division share the same precedence, as do addition and subtraction, so within each pair they are evaluated left to right.

Percentagearithmetic

A ratio expressed as a fraction of 100, denoted by the % symbol.

let fraction = 3 / 4;
let percent = fraction * 100;  // 75
// 20% of 150
let discount = 0.20 * 150;  // 30

A percentage represents a proportion out of 100. To convert a fraction to a percentage, divide the numerator by the denominator and multiply by 100. For example, 3/4 = 0.75 = 75%. Percentages are widely used to express rates, discounts, interest, and changes in value.

Place Valuearithmetic

The value of a digit determined by its position within a number.

// In the number 305.72:
// 3 is in the hundreds place (3 * 100)
// 0 is in the tens place (0 * 10)
// 5 is in the ones place (5 * 1)
// 7 is in the tenths place (7 * 0.1)
// 2 is in the hundredths place (2 * 0.01)

Place value is the system in which the position of a digit in a number determines its value. In the base-ten system, each position represents a power of 10: ones, tens, hundreds, and so on. To the right of the decimal point, positions represent tenths, hundredths, thousandths, etc. Understanding place value is essential for decimal arithmetic.

Powerarithmetic

The result of raising a base to an exponent; also refers to the exponent itself.

let square = 5 ** 2;  // 25 (5 squared)
let cube = 2 ** 3;    // 8 (2 cubed)
let tenth = 2 ** 10;  // 1024

A power is the result of exponentiation, where a base number is multiplied by itself a specified number of times. In b^n, the entire expression is called "b to the power of n" or "b to the nth power." Common powers include squares (n=2) and cubes (n=3). The term is often used interchangeably with exponent in casual usage.

Prime Numberarithmetic

A natural number greater than 1 that has no positive divisors other than 1 and itself.

function isPrime(n) {
  if (n < 2) return false;
  for (let i = 2; i <= Math.sqrt(n); i++) {
    if (n % i === 0) return false;
  }
  return true;
}
isPrime(17);  // true

A prime number is a natural number greater than 1 whose only factors are 1 and the number itself. The first few primes are 2, 3, 5, 7, 11, and 13. The number 2 is the only even prime. The Fundamental Theorem of Arithmetic states that every integer greater than 1 can be uniquely expressed as a product of prime factors.

Parabolaalgebra

The U-shaped curve that is the graph of a quadratic function.

// Vertex of y = 2x² - 8x + 6
let a = 2, b = -8, c = 6;
let vertexX = -b / (2 * a);  // 2
let vertexY = a * vertexX ** 2 + b * vertexX + c;  // -2
// Vertex: (2, -2)

A parabola is the graph of a quadratic function f(x) = ax² + bx + c. It opens upward when a > 0 and downward when a < 0. Every parabola has a vertex (its minimum or maximum point), an axis of symmetry passing through the vertex, and may cross the x-axis at zero, one, or two points. The vertex is located at x = -b/(2a).

Polynomialalgebra

An expression consisting of variables raised to non-negative integer powers, multiplied by coefficients, and combined with addition or subtraction.

// Evaluate p(x) = 2x³ - 3x² + x - 5
function p(x) {
  return 2*x**3 - 3*x**2 + x - 5;
}
p(2);  // 16 - 12 + 2 - 5 = 1

A polynomial is an expression of the form a_n*x^n + a_(n-1)*x^(n-1) + ... + a_1*x + a_0, where the exponents are non-negative integers and the coefficients are real numbers. Polynomials are classified by degree: constant (0), linear (1), quadratic (2), cubic (3), and so on. They can be added, subtracted, multiplied, and factored.

Perimetergeometry

The total distance around the boundary of a two-dimensional shape.

const rectPerimeter = (l, w) => 2 * (l + w);
rectPerimeter(5, 3); // 16

Perimeter is the sum of the lengths of all sides of a polygon, or more generally, the total length of the boundary of any closed two-dimensional figure. For a rectangle, P = 2(l + w). For a regular polygon with n sides of length s, P = n * s. The perimeter of a circle is specifically called the circumference.

Pointgeometry

An exact location in space with no size, width, or depth.

const point = { x: 3, y: 7 };

A point is the most fundamental object in geometry, representing a precise position with zero dimensions. It has no length, width, or area. In the coordinate plane, a point is represented by an ordered pair (x, y). Points are used to define all other geometric objects, including lines, angles, and shapes.

Polygongeometry

A closed two-dimensional shape formed by three or more straight line segments.

const interiorAngleSum = (sides) => (sides - 2) * 180;
interiorAngleSum(6); // 720 degrees (hexagon)

A polygon is a closed plane figure bounded by a finite number of straight line segments (sides) that connect end-to-end to form a closed chain. Polygons are classified by their number of sides: triangle (3), quadrilateral (4), pentagon (5), hexagon (6), etc. A polygon is regular if all sides and all interior angles are equal. The sum of interior angles of an n-sided polygon is (n - 2) * 180 degrees.

Prismgeometry

A three-dimensional solid with two identical parallel polygon bases connected by rectangular faces.

const prismVolume = (baseArea, height) => baseArea * height;
prismVolume(12, 5); // 60 cubic units

A prism is a polyhedron with two congruent, parallel polygonal bases and rectangular lateral faces. The volume of a prism is V = B * h, where B is the area of a base and h is the perpendicular height between the bases. The surface area is SA = 2B + P * h, where P is the perimeter of the base. Common types include rectangular prisms (boxes) and triangular prisms.

Pythagorean Theoremgeometry

In a right triangle, the square of the hypotenuse equals the sum of the squares of the other two sides.

const hypotenuse = (a, b) => Math.sqrt(a ** 2 + b ** 2);
hypotenuse(3, 4); // 5

The Pythagorean theorem states that for any right triangle with legs a and b and hypotenuse c, a^2 + b^2 = c^2. The converse is also true: if a^2 + b^2 = c^2 for the sides of a triangle, then the triangle is a right triangle. This theorem is foundational to the distance formula, trigonometry, and numerous areas of mathematics.

Predicatelogic proofs

A statement containing one or more variables that becomes a proposition when values are substituted.

// P(x): "x is even"
const isEven = (x) => x % 2 === 0;
isEven(4); // true (proposition)
isEven(7); // false (proposition)

A predicate is a function from some domain to truth values. Written P(x), it becomes a proposition (either true or false) once a specific value is substituted for x. For example, 'x > 5' is a predicate that becomes true for x = 7 and false for x = 3. Predicates are combined with quantifiers (universal and existential) to make statements about entire domains.

Proof by Contradictionlogic proofs

A proof technique that assumes the negation of the desired conclusion and derives a logical impossibility.

// Proof that sqrt(2) is irrational:
// Assume sqrt(2) = a/b (reduced fraction)
// Then 2 = a^2/b^2, so a^2 = 2b^2
// Therefore a is even, say a = 2k
// Then 4k^2 = 2b^2, so b^2 = 2k^2, b is even
// Contradiction: a/b was already reduced

Proof by contradiction (reductio ad absurdum) begins by assuming the statement to be proved is false. Through valid logical steps, it derives a contradiction, an impossible situation such as P AND NOT P. Since the assumption leads to an impossibility, the assumption must be false, meaning the original statement must be true. This technique is especially useful when direct proof is difficult or when proving impossibility results.

Propositionlogic proofs

A declarative statement that is either true or false, but not both.

// Propositions have definite truth values
const p = (2 + 3 === 5); // true
const q = (1 > 10);      // false

A proposition is a declarative sentence that has a definite truth value: it is either true or false, never both and never neither. Examples include '2 + 3 = 5' (true) and 'The Earth is flat' (false). Questions, commands, and exclamations are not propositions. Propositions are the atomic building blocks of propositional logic and can be combined using logical connectives to form compound propositions.

Periodtrigonometry

The length of the smallest interval after which a periodic function repeats its values.

// y = sin(2x) has period pi (not 2pi)
const period = (B) => (2 * Math.PI) / Math.abs(B);
period(2); // ~3.1416 (pi)
period(1); // ~6.2832 (2pi)

The period of a function f is the smallest positive number T such that f(x + T) = f(x) for all x. For the basic sine and cosine functions, the period is 2*pi. For y = A*sin(B*x + C) + D, the period is 2*pi / |B|. Tangent and cotangent have a fundamental period of pi. Changing the period compresses or stretches the graph horizontally.

Phase Shifttrigonometry

The horizontal displacement of a periodic function from its standard position.

// y = sin(x - pi/4) shifts right by pi/4
const phaseShift = (C, B) => -C / B;
phaseShift(-Math.PI/4, 1); // pi/4 (right shift)

Phase shift is the horizontal translation of a trigonometric function. For y = A*sin(B*x + C) + D, the phase shift is -C/B. A positive phase shift moves the graph to the right; a negative shift moves it to the left. Phase shift does not affect the amplitude or period of the function, only where along the x-axis the cycle begins.

Pythagorean Identitytrigonometry

The fundamental identity sin^2(theta) + cos^2(theta) = 1.

// Verify for any angle
const verify = (theta) => {
  const result = Math.sin(theta)**2 + Math.cos(theta)**2;
  return Math.abs(result - 1) < 1e-10; // true
};
verify(0.7); // true

The Pythagorean identity states that sin^2(theta) + cos^2(theta) = 1 for all angles theta. It follows directly from the Pythagorean theorem applied to the unit circle: the point (cos(theta), sin(theta)) lies on x^2 + y^2 = 1. Two derived forms are: 1 + tan^2(theta) = sec^2(theta) and 1 + cot^2(theta) = csc^2(theta). This identity is fundamental for simplifying trigonometric expressions.

Parametric Equationprecalculus

A pair of equations that express x and y coordinates as separate functions of an independent parameter, typically t.

// Parametric circle: x = cos(t), y = sin(t)
const points = [];
for (let t = 0; t < 2 * Math.PI; t += 0.5) {
  points.push({ x: Math.cos(t).toFixed(2), y: Math.sin(t).toFixed(2) });
}
console.log(points);

Parametric equations define a curve by expressing both coordinates as functions of an independent parameter: x = f(t) and y = g(t). This representation can describe curves that fail the vertical line test, motion along a path with direction and speed, and complex shapes not easily expressed as y = f(x). The parameter t often represents time, and eliminating t yields the rectangular (Cartesian) equation of the curve.

Polar Coordinateprecalculus

A coordinate system that locates a point by its distance from the origin (r) and the angle (θ) from the positive x-axis.

// Convert polar (r, θ) to Cartesian (x, y)
function polarToCartesian(r, theta) {
  return { x: r * Math.cos(theta), y: r * Math.sin(theta) };
}
console.log(polarToCartesian(5, Math.PI / 3));
// { x: 2.5, y: 4.33 }

Polar coordinates represent a point in the plane using an ordered pair (r, θ), where r is the radial distance from the origin (pole) and θ is the angle measured counterclockwise from the positive x-axis (polar axis). Conversion to Cartesian coordinates uses x = r·cos(θ) and y = r·sin(θ). Polar coordinates are especially useful for curves with rotational symmetry, such as spirals, roses, and cardioids.

Polynomial Functionprecalculus

A function of the form f(x) = aₙxⁿ + aₙ₋₁xⁿ⁻¹ + ... + a₁x + a₀ with non-negative integer exponents.

// Evaluate polynomial f(x) = 2x^3 - 4x^2 + x - 7
const f = x => 2*x**3 - 4*x**2 + x - 7;
console.log('f(0) =', f(0));  // -7
console.log('f(2) =', f(2));  // -5
console.log('Degree: 3, Leading coefficient: 2');

A polynomial function is a sum of terms of the form aₖxᵏ, where each coefficient aₖ is a real number and each exponent k is a non-negative integer. The highest exponent n with a nonzero coefficient is the degree of the polynomial, and the corresponding term aₙxⁿ is the leading term. Polynomial functions are continuous and smooth everywhere, and the Fundamental Theorem of Algebra guarantees that a degree-n polynomial has exactly n roots (counted with multiplicity) in the complex numbers.

Partitioncalculus

A division of an interval into smaller subintervals for Riemann sum computation.

// Create a regular partition of [0, 2] with n subintervals
function partition(a, b, n) {
  const points = [];
  const dx = (b - a) / n;
  for (let i = 0; i <= n; i++) {
    points.push(a + i * dx);
  }
  return points;
}
console.log(partition(0, 2, 4)); // [0, 0.5, 1, 1.5, 2]

A partition of [a, b] is a finite set of points a = x_0 < x_1 < ... < x_n = b that divides the interval into n subintervals. The width of each subinterval is delta_x_i = x_{i} - x_{i-1}. A regular partition uses equal widths. As the partition gets finer (n increases), the Riemann sum converges to the definite integral.

Power Rulecalculus

The derivative of x^n is n*x^(n-1) for any real number n.

// Power rule: derivative of x^n
function powerRuleDerivative(n, x) {
  return n * Math.pow(x, n - 1);
}
// d/dx[x^3] at x = 2 => 3*2^2 = 12
console.log(powerRuleDerivative(3, 2)); // 12
// d/dx[x^0.5] at x = 4 => 0.5*4^(-0.5) = 0.25
console.log(powerRuleDerivative(0.5, 4)); // 0.25

The power rule states that d/dx[x^n] = n * x^(n-1). It applies to positive integers, negative integers, and fractional exponents alike. Combined with the constant multiple rule and sum rule, the power rule handles the differentiation of all polynomial functions and many algebraic expressions.

Product Rulecalculus

The derivative of a product of two functions: (fg)' = f'g + fg'.

// Product rule: d/dx[x^2 * sin(x)]
// = 2x*sin(x) + x^2*cos(x)
function productDerivative(x) {
  return 2*x*Math.sin(x) + x*x*Math.cos(x);
}
console.log(productDerivative(Math.PI)); // ~-9.87

The product rule states that the derivative of f(x) * g(x) equals f'(x) * g(x) + f(x) * g'(x). It is necessary because the derivative of a product is not simply the product of the derivatives. The rule extends to products of three or more functions by repeated application.

P-Seriescalculus 2

An infinite series of the form sum of 1/n^p.

// Compare p-series for different values of p
function pSeries(p, N) {
  let sum = 0;
  for (let n = 1; n <= N; n++) sum += 1 / Math.pow(n, p);
  return sum;
}
console.log('p=0.5:', pSeries(0.5, 10000));  // diverges
console.log('p=1:', pSeries(1, 10000));        // diverges
console.log('p=2:', pSeries(2, 10000));        // converges to pi^2/6

A p-series has the form sum of 1/n^p for n = 1 to infinity, where p is a positive constant. The series converges if and only if p > 1 and diverges if p <= 1. When p = 1, it reduces to the harmonic series, which diverges. P-series are frequently used as comparison benchmarks when applying the Comparison Test or Limit Comparison Test to other series.

Partial Fractionscalculus 2

A technique that decomposes a rational function into simpler fractions that are easier to integrate.

// Integrate 1/((x+1)(x+2)) from 0 to 1 using partial fractions
// Decomposition: 1/(x+1) - 1/(x+2)
function integrate(f, a, b, n) {
  const dx = (b - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) sum += f(a + (i + 0.5) * dx) * dx;
  return sum;
}
console.log(integrate(x => 1/((x+1)*(x+2)), 0, 1, 10000));
// ln(2) - ln(3/2) = ln(4/3) ~ 0.2877

Partial fraction decomposition rewrites a proper rational function P(x)/Q(x) as a sum of simpler fractions whose denominators are the irreducible factors of Q(x). Linear factors contribute terms of the form A/(x - a), while irreducible quadratic factors contribute (Bx + C)/(x^2 + bx + c). This decomposition transforms complex rational integrals into sums of standard integrals involving logarithms and arctangent functions.

Power Seriescalculus 2

An infinite series of the form sum of a_n * (x - c)^n, representing a function as a polynomial of infinite degree.

// Power series for 1/(1-x) = sum x^n, |x| < 1
function powerSeries(x, N) {
  let sum = 0;
  for (let n = 0; n <= N; n++) sum += Math.pow(x, n);
  return sum;
}
console.log(powerSeries(0.5, 50));  // approaches 2
console.log(1 / (1 - 0.5));         // exact: 2

A power series centered at c is an expression sum of a_n * (x - c)^n for n = 0 to infinity, where a_n are the coefficients. Every power series has a radius of convergence R such that the series converges absolutely for |x - c| < R and diverges for |x - c| > R. Within its interval of convergence, a power series defines an infinitely differentiable function that can be differentiated and integrated term by term.

Projectionlinear algebra

The component of one vector in the direction of another vector or onto a subspace.

function project(u, v) {
  const dot_uv = u.reduce((s, ui, i) => s + ui * v[i], 0);
  const dot_vv = v.reduce((s, vi) => s + vi * vi, 0);
  const scalar = dot_uv / dot_vv;
  return v.map(vi => scalar * vi);
}
console.log(project([3, 4], [1, 0])); // [3, 0]

The projection of vector u onto vector v is proj_v(u) = ((u . v) / (v . v)) * v, producing the closest point on the line spanned by v to u. More generally, the projection onto a subspace W with orthonormal basis {w1, ..., wk} is the sum of (u . wi)*wi. Projections are central to least-squares approximation, the Gram-Schmidt process, and computing orthogonal complements.

Partial Derivativemultivariable calc

The derivative of a multivariable function with respect to one variable while holding all other variables constant.

// Numerical partial derivative ∂f/∂x
const df_dx = (f(x + h, y) - f(x - h, y)) / (2 * h);

The partial derivative ∂f/∂x measures the instantaneous rate of change of f in the x-direction, treating y (and any other variables) as constants. Geometrically, it gives the slope of the tangent line to the surface z = f(x, y) in the x-direction. Higher-order and mixed partial derivatives describe curvature and twist of the surface.

Partial Derivative Notationmultivariable calc

The symbolic conventions used to denote partial derivatives, including ∂f/∂x, fₓ, and subscript notation.

Partial derivatives are written as ∂f/∂x (Leibniz notation), fₓ (subscript notation), or Dₓf (operator notation). The symbol ∂ (a rounded 'd') distinguishes partial from ordinary derivatives. For higher-order partials, ∂²f/∂x∂y denotes differentiating first with respect to y, then x, and Clairaut's theorem guarantees the order does not matter when the mixed partials are continuous.

P-Valueprobability stats

The probability of observing a test statistic as extreme as, or more extreme than, the one computed from the sample, assuming the null hypothesis is true.

// Simulate p-value for a coin fairness test
// Observed: 65 heads out of 100 flips. H₀: p = 0.5
let moreExtreme = 0;
const trials = 100000;
for (let i = 0; i < trials; i++) {
  let heads = 0;
  for (let j = 0; j < 100; j++) if (Math.random() < 0.5) heads++;
  if (Math.abs(heads - 50) >= 15) moreExtreme++;
}
console.log(`Simulated p-value ≈ ${(moreExtreme / trials).toFixed(4)}`);

The p-value quantifies the strength of evidence against the null hypothesis. It is calculated as the probability of obtaining results at least as extreme as the observed data under the assumption that H₀ is true. A small p-value (typically ≤ 0.05) suggests the observed data is unlikely under H₀, providing grounds for rejection. The p-value is not the probability that H₀ is true, nor does it measure effect size—it only measures the compatibility of the data with H₀.

Permutationprobability stats

An ordered arrangement of items selected from a set, where the sequence matters.

// Calculate P(n, k) and list permutations
function permCount(n, k) {
  let result = 1;
  for (let i = 0; i < k; i++) result *= (n - i);
  return result;
}
console.log(`P(5,3) = ${permCount(5, 3)}`); // 60
// List permutations of 2 from [A, B, C]
const items = ['A', 'B', 'C'];
const perms = [];
for (const a of items) for (const b of items) if (a !== b) perms.push(a + b);
console.log(perms); // ['AB','AC','BA','BC','CA','CB']

A permutation is an arrangement of k items chosen from n distinct items where order matters. The count is P(n,k) = n!/(n-k)!, representing the number of distinct sequences. For example, the permutations of choosing 2 from {A,B,C} are AB, AC, BA, BC, CA, CB—six arrangements versus three combinations. Permutations are used in probability when the order of selection affects the outcome, such as race finishing positions or password arrangements.

Poisson Distributionprobability stats

A discrete probability distribution expressing the probability of a given number of events occurring in a fixed interval of time or space.

// Poisson PMF: probability of k events with rate λ
function poissonPMF(k, lambda) {
  let factorial = 1;
  for (let i = 2; i <= k; i++) factorial *= i;
  return (Math.pow(lambda, k) * Math.exp(-lambda)) / factorial;
}
const lambda = 3; // average 3 events per interval
for (let k = 0; k <= 8; k++) {
  console.log(`P(X=${k}) = ${poissonPMF(k, lambda).toFixed(4)}`);
}

The Poisson distribution models the count of events occurring independently at a constant average rate λ in a fixed interval. Its PMF is P(X=k) = (λ^k × e^(-λ))/k!, with both mean and variance equal to λ. It approximates the binomial distribution when n is large and p is small (np ≈ λ). Common applications include modeling arrivals per hour, defects per unit, or rare events like server crashes per day.

Prior and Posteriorprobability stats

The prior is the probability distribution of a parameter before observing data; the posterior is the updated distribution after incorporating evidence.

// Prior vs posterior: updating belief about a coin's fairness
// Prior: uniform (all p equally likely)
// After observing 8 heads in 10 flips:
const a0 = 1, b0 = 1; // uniform Beta prior
const heads = 8, tails = 2;
const aPost = a0 + heads; // 9
const bPost = b0 + tails; // 3
const priorMean = a0 / (a0 + b0);
const postMean = aPost / (aPost + bPost);
console.log(`Prior mean: ${priorMean.toFixed(2)}`);
console.log(`Posterior mean: ${postMean.toFixed(2)}`);

In Bayesian statistics, the prior distribution P(θ) encodes beliefs about a parameter before seeing data. After observing data D, Bayes' theorem produces the posterior distribution P(θ|D) ∝ P(D|θ)P(θ), which blends prior knowledge with the evidence from the likelihood. As more data accumulates, the posterior becomes dominated by the likelihood, and the influence of the prior diminishes. The prior-to-posterior update is the central mechanism of Bayesian learning.

Probability Axiomprobability stats

One of Kolmogorov's three foundational rules that all probability measures must satisfy.

// Verify the three probability axioms with a die
const S = [1, 2, 3, 4, 5, 6];
const P = event => event.length / S.length;

// Axiom 1: Non-negativity
console.log(`P({3}) = ${P([3])} >= 0 ✓`);
// Axiom 2: Normalization
console.log(`P(S) = ${P(S)} === 1 ✓`);
// Axiom 3: Additivity (disjoint: odd, {6})
const odd = [1, 3, 5];
console.log(`P(odd ∪ {6}) = ${P([...odd, 6])} === ${P(odd)} + ${P([6])} ✓`);

Kolmogorov's axioms define the mathematical foundation of probability theory. Axiom 1 (Non-negativity): P(A) ≥ 0 for every event A. Axiom 2 (Normalization): P(S) = 1 for the sample space S. Axiom 3 (Additivity): For mutually exclusive events A and B, P(A ∪ B) = P(A) + P(B). From these three axioms, all rules of probability—complement rule, inclusion-exclusion, conditional probability—can be derived as theorems.

Phase Portraitdifferential equations

A geometric plot showing trajectories of a system of ODEs in the state-variable plane.

// Compute direction field for dx/dt = y, dy/dt = -x
const points = [];
for (let x = -2; x <= 2; x += 1) {
  for (let y = -2; y <= 2; y += 1) {
    points.push({ x, y, dx: y, dy: -x });
  }
}
console.log('Direction field points:', points.length);

A phase portrait displays solution curves of a two-dimensional autonomous system in the (x, y) plane, with each point representing a state and arrows indicating the direction of evolution. Critical points (equilibria) are classified as nodes, spirals, saddles, or centers based on the eigenvalues of the Jacobian matrix. Phase portraits reveal global qualitative behavior such as stability, periodicity, and basins of attraction without requiring explicit solutions.

Population Modeldifferential equations

A differential equation describing how a population changes over time due to growth, decay, or interaction.

// Logistic growth: dP/dt = rP(1 - P/K)
const r = 0.5, K = 1000;
let P = 10;
const dt = 0.1;
for (let t = 0; t <= 20; t += dt) {
  P += r * P * (1 - P / K) * dt;
}
console.log('Final population:', Math.round(P));

Population models use ODEs to capture biological dynamics, from simple exponential growth (dP/dt = rP) to logistic models with carrying capacity (dP/dt = rP(1 - P/K)) and multi-species interactions like Lotka-Volterra predator-prey systems. These models predict equilibrium populations, oscillatory cycles, and extinction thresholds. They are foundational applications of first-order and coupled ODE systems in mathematical biology.

Prime Factorizationdiscrete math

The expression of a positive integer as a product of prime numbers.

// Prime factorization
function primeFactors(n) {
  const factors = [];
  for (let d = 2; d * d <= n; d++) {
    while (n % d === 0) {
      factors.push(d);
      n /= d;
    }
  }
  if (n > 1) factors.push(n);
  return factors;
}
console.log(primeFactors(60)); // [2, 2, 3, 5]

Prime factorization is the decomposition of a positive integer n > 1 into a product of prime numbers, which by the Fundamental Theorem of Arithmetic is unique up to the order of factors. For example, 60 = 2^2 * 3 * 5. Prime factorization is essential for computing GCDs and LCMs, testing primality, and underpins the security of RSA encryption, which relies on the difficulty of factoring large semiprimes.

Partial Fraction Decompositioncalculus 2

Breaking a rational function into simpler fractions.

// Decompose 1/(x^2 - 1) = A/(x-1) + B/(x+1)
// Solving: A = 1/2, B = -1/2
// So 1/(x^2-1) = 1/(2(x-1)) - 1/(2(x+1))

Partial fraction decomposition expresses a rational function as a sum of simpler fractions whose denominators are factors of the original denominator. This technique is essential for integrating rational functions. The method involves factoring the denominator, setting up unknown coefficients, and solving a system of equations.

Parametric Curvecalculus 2

A curve defined by x = f(t), y = g(t) as t varies.

// A circle as a parametric curve
const x = (t) => Math.cos(t);
const y = (t) => Math.sin(t);
// t ranges from 0 to 2*Math.PI

A parametric curve represents a path in the plane where both x and y coordinates are given as separate functions of a parameter t. This allows curves that cannot be expressed as y = f(x), such as loops and self-intersecting paths. Derivatives, arc length, and area can all be computed using the parametric equations.

Polar Coordinatescalculus 2

A coordinate system using (r, theta) instead of (x, y).

// Convert polar (r, theta) to Cartesian (x, y)
const toCartesian = (r, theta) => ({
  x: r * Math.cos(theta),
  y: r * Math.sin(theta)
});

Polar coordinates describe a point in the plane by its distance r from the origin and the angle theta measured counterclockwise from the positive x-axis. Conversion formulas are x = r cos(theta) and y = r sin(theta). Many curves with rotational symmetry have simpler equations in polar form than in Cartesian form.

Polar Equationcalculus 2

An equation expressing r as a function of theta.

// Cardioid: r = 1 + cos(theta)
const r = (theta) => 1 + Math.cos(theta);

A polar equation defines a curve by giving the radial distance r as a function of the angle theta. Classic examples include r = a (circle), r = a*cos(theta) (circle through origin), and r = a + b*cos(theta) (limacons). Areas enclosed by polar curves are computed using the integral of (1/2)*r^2 with respect to theta.

Principal Component Analysis (PCA)linear algebra

A technique that uses eigendecomposition to find the directions of maximum variance in data.

// Conceptual PCA: center data, compute covariance, find eigenvectors
const data = [[2, 1], [3, 3], [5, 4], [6, 6]];
const mean = data[0].map((_, i) => data.reduce((s, r) => s + r[i], 0) / data.length);
const centered = data.map(r => r.map((v, i) => v - mean[i]));
console.log('Centered data:', centered);

Principal Component Analysis (PCA) is a dimensionality-reduction technique that identifies the principal components, the orthogonal directions along which the data varies most. It works by computing the eigenvalues and eigenvectors of the data's covariance matrix; the eigenvectors define the new axes and the eigenvalues indicate how much variance each axis captures. PCA is widely used in machine learning, image compression, and exploratory data analysis.

Q
Quadratic Timedata structures algorithms

An operation whose time grows with the square of input size — O(n²).

// O(n²) — all pairs
for (let i = 0; i < n; i++)
  for (let j = i+1; j < n; j++)
    compare(arr[i], arr[j]);

Quadratic time means nested iteration over the input. Doubling n quadruples the runtime. Bubble sort, selection sort, and checking all pairs in an array are O(n²). Quadratic algorithms become impractical for large inputs.

Queuedata structures algorithms

A First-In-First-Out (FIFO) data structure — the first element added is the first removed.

const q = [];
q.push(1);   // enqueue: [1]
q.push(2);   // enqueue: [1, 2]
q.shift();   // dequeue: 1, q = [2]

A queue supports enqueue (add to back) and dequeue (remove from front). Like a line at a store, the first person in line is served first. Queues are used for BFS, task scheduling, message processing, and print spooling.

Quicksortdata structures algorithms

A divide-and-conquer sort that partitions around a pivot — O(n log n) average.

function quicksort(arr, lo = 0, hi = arr.length - 1) {
  if (lo >= hi) return;
  const pivot = partition(arr, lo, hi);
  quicksort(arr, lo, pivot - 1);
  quicksort(arr, pivot + 1, hi);
}

Quicksort picks a pivot element, partitions the array into elements less than and greater than the pivot, then recursively sorts each partition. Average O(n log n), worst O(n²) with bad pivot choices. In-place (O(log n) stack space). Often faster than merge sort in practice due to cache efficiency.

Query Optimizationdatabases

Techniques for making database queries run faster and use fewer resources.

-- Slow: full table scan
SELECT * FROM orders WHERE status = 'pending';
-- Optimized: index + specific columns
CREATE INDEX idx_status ON orders(status);
SELECT id, total FROM orders WHERE status = 'pending';

Query optimization improves performance through better SQL, proper indexing, and schema design. Common techniques: add indexes on frequently filtered columns, avoid SELECT *, use EXPLAIN to identify full table scans.

Query Plannerdatabases

The database component that determines the most efficient way to execute a query.

EXPLAIN SELECT * FROM users WHERE age > 90;
-- Might choose: Index Scan (few rows match)
EXPLAIN SELECT * FROM users WHERE age > 5;
-- Might choose: Seq Scan (most rows match)

The query planner analyzes a SQL query and generates an execution plan. It considers available indexes, table statistics, join algorithms, and estimated costs to choose the fastest strategy.

Quorumdistributed systems

The minimum number of nodes that must agree for a distributed operation to succeed.

const N = 5, W = 3, R = 3;
// W + R > N -> guaranteed overlap
if (acks >= W) commit();
if (reads >= R) returnLatestValue();

A quorum is the minimum number of votes (typically a majority) needed to commit a read or write. Quorum-based systems ensure that any read quorum and write quorum overlap by at least one node.

Query, Key, Valuedeep learning llms

Three projections of each token used to compute attention scores and outputs.

Q = X @ W_q
K = X @ W_k
V = X @ W_v
attention = softmax(Q @ K.T / sqrt(d_k)) @ V

In self-attention, each token is projected into Query (what am I looking for?), Key (what do I contain?), and Value (what info do I provide?). Attention = softmax(Q*K^T/sqrt(d)) * V.

Quadratic Equationalgebra

A polynomial equation of degree 2, in the standard form ax² + bx + c = 0.

// Solve x² - 5x + 6 = 0
// Factor: (x - 2)(x - 3) = 0
// x = 2 or x = 3
let a = 1, b = -5, c = 6;
let x1 = (-b + Math.sqrt(b**2 - 4*a*c)) / (2*a);  // 3
let x2 = (-b - Math.sqrt(b**2 - 4*a*c)) / (2*a);  // 2

A quadratic equation has the standard form ax² + bx + c = 0, where a ≠ 0. It can be solved by factoring, completing the square, or using the quadratic formula. A quadratic equation has at most two real solutions, determined by the discriminant (b² - 4ac). Its graph is a parabola.

Quadratic Formulaalgebra

The formula x = (-b ± √(b² - 4ac)) / 2a that solves any quadratic equation.

function solveQuadratic(a, b, c) {
  let disc = b ** 2 - 4 * a * c;
  if (disc < 0) return [];
  let x1 = (-b + Math.sqrt(disc)) / (2 * a);
  let x2 = (-b - Math.sqrt(disc)) / (2 * a);
  return disc === 0 ? [x1] : [x1, x2];
}
solveQuadratic(1, -5, 6);  // [3, 2]

The quadratic formula provides the solutions to any quadratic equation ax² + bx + c = 0. It is derived by completing the square and yields x = (-b ± √(b² - 4ac)) / (2a). The ± symbol indicates two possible solutions. The expression under the square root (b² - 4ac) is the discriminant, which determines the nature and number of solutions.

Quadranttrigonometry

One of the four regions of the coordinate plane divided by the x-axis and y-axis.

const getQuadrant = (x, y) => {
  if (x > 0 && y > 0) return 'I';
  if (x < 0 && y > 0) return 'II';
  if (x < 0 && y < 0) return 'III';
  if (x > 0 && y < 0) return 'IV';
  return 'on axis';
};

The four quadrants of the coordinate plane are numbered counterclockwise starting from the upper right: Quadrant I (x > 0, y > 0), Quadrant II (x < 0, y > 0), Quadrant III (x < 0, y < 0), and Quadrant IV (x > 0, y < 0). In trigonometry, the quadrant of an angle determines the signs of its trig functions: sine is positive in I and II, cosine in I and IV, and tangent in I and III.

Quotient Rulecalculus

The derivative of a quotient of two functions: (f/g)' = (f'g - fg') / g^2.

// Quotient rule: d/dx[sin(x)/x]
// = (cos(x)*x - sin(x)) / x^2
function quotientDerivative(x) {
  return (Math.cos(x)*x - Math.sin(x)) / (x*x);
}
console.log(quotientDerivative(1)); // ~0.3012

The quotient rule states that the derivative of f(x)/g(x) is [f'(x)*g(x) - f(x)*g'(x)] / [g(x)]^2, provided g(x) is not zero. It can be derived from the product rule and chain rule. While always valid, sometimes rewriting the quotient as a product with a negative exponent and using the product rule is simpler.

R
Return Valueprogramming foundations

The value a function sends back to its caller.

function double(n) {
  return n * 2;
}
let result = double(5); // 10

A return value is the output that a function produces and sends back to the code that called it. The `return` statement specifies what value to send back and immediately exits the function. Functions without an explicit return statement return `undefined` (JS) or `None` (Python).

Recursionprogramming foundations

When a function calls itself to solve a problem by breaking it into smaller subproblems.

function fact(n) {
  if (n <= 1) return 1;
  return n * fact(n - 1);
}

Recursion is a technique where a function calls itself with a modified input, solving a problem by breaking it into smaller instances of the same problem. Every recursive function needs a base case (stopping condition) to prevent infinite recursion. Common examples: factorial, Fibonacci, tree traversal.

Reduceprogramming foundations

Combines all elements in an array into a single value using an accumulator function.

[1, 2, 3, 4].reduce(
  (sum, n) => sum + n, 0
)  // 10

The reduce method iterates over an array, applying a function that takes an accumulator and the current element, and returns the new accumulator value. After processing all elements, the final accumulator is returned. Common uses: summing, finding max/min, grouping, and building objects from arrays.

Reference Typeprogramming foundations

A type where variables hold a reference (pointer) to data, not the data itself.

const a = { x: 1 };
const b = a;  // b points to same object
b.x = 2;
console.log(a.x); // 2 (both changed!)

Reference types (objects, arrays, functions) are stored in memory and variables hold a reference (memory address) to the data, not the data itself. When you assign a reference type to another variable, both variables point to the same data. Modifying one affects the other. This is why spread/copy is necessary for immutable patterns.

Recursive Caseprogramming foundations

The part of a recursive function that calls itself with a smaller or simpler input.

function sum(arr) {
  if (arr.length === 0) return 0;
  // recursive case: process first + rest
  return arr[0] + sum(arr.slice(1));
}

The recursive case is the branch of a recursive function where it calls itself with a modified (usually smaller) input, moving toward the base case. Each recursive call should make progress — the input must get closer to the base case with each call. If it doesn't, the recursion will never terminate.

Round Robin Schedulingoperating systems

A scheduling algorithm that gives each process an equal time slice in rotation.

// Time quantum = 2 units
P1: [2] → wait → [2] → done
P2: wait → [2] → wait → [1] → done

Round Robin assigns each process a fixed time quantum (e.g., 10ms). Processes run in circular order — when a process's time is up, it goes to the back of the queue. Fair but can have high overhead with very small quanta. The most common general-purpose scheduling algorithm.

REST APInetworking

A web API design pattern using HTTP methods on URL-based resources.

// RESTful API design
GET    /api/posts         — list posts
POST   /api/posts         — create post
GET    /api/posts/:id     — get one post
PUT    /api/posts/:id     — update post
DELETE /api/posts/:id     — delete post

REST (Representational State Transfer) is an architectural style for APIs. Resources are identified by URLs (/users/123). HTTP methods map to CRUD operations. REST APIs are stateless — each request contains all needed information. Responses are typically JSON. RESTful APIs are the standard for web services.

Relational Modeldatabases

A data model that organizes information into tables with rows and columns.

SELECT name, email
FROM users
WHERE age > 18
ORDER BY name;

The relational model represents data as relations (tables). Each table has columns (attributes) and rows (tuples). SQL is the language for querying relational data. The model supports operations like selection (filter rows), projection (pick columns), and join (combine tables). PostgreSQL, MySQL, and SQLite are relational databases.

Retry Strategydistributed systems

A pattern for retrying failed operations with increasing delays.

async function fetchWithRetry(url, retries = 3) {
  for (let i = 0; i < retries; i++) {
    try { return await fetch(url); }
    catch (e) {
      const delay = Math.pow(2, i) * 1000;
      await sleep(delay + Math.random() * 1000);
    }
  }
}

When a network call fails, retrying after a delay often succeeds. Exponential backoff increases the delay between retries (1s, 2s, 4s, 8s...). Jitter adds randomness to prevent thundering herd (all clients retrying simultaneously). Set a max retry count and use circuit breakers for persistent failures.

RAGdeep learning llms

Retrieval-Augmented Generation — giving LLMs access to external knowledge at query time.

// RAG pipeline
1. User question → embed → vector
2. Search vector DB → top 5 relevant docs
3. Prompt: docs + question → LLM
4. LLM generates answer grounded in docs

RAG combines retrieval (searching a knowledge base) with generation (LLM response). Process: embed the query → search vector database for relevant documents → include them in the prompt → LLM generates an answer grounded in retrieved context. RAG reduces hallucinations and enables LLMs to use private/current data.

Read Committeddatabases

An isolation level where transactions only see data committed before each statement.

BEGIN;
SELECT balance FROM accounts WHERE id = 1; -- returns 100
-- Another transaction commits: UPDATE balance to 80
SELECT balance FROM accounts WHERE id = 1; -- returns 80
COMMIT;

Read Committed is the default isolation level in PostgreSQL. Each statement within a transaction sees only data committed before that statement began. This prevents dirty reads but allows non-repeatable reads.

Replication Lagdatabases

The delay between a write on the primary and its appearance on replicas.

await primary.query('UPDATE users SET name = $1 WHERE id = $2', ['Bob', 1]);
const user = await replica.query('SELECT name FROM users WHERE id = 1');
// user.name might still be 'Alice' due to lag!

Replication lag is the time it takes for changes written to the primary database to propagate to read replicas. With asynchronous replication, lag can range from milliseconds to seconds.

Raftdistributed systems

A consensus algorithm designed to be more understandable than Paxos.

leader.appendEntry({ term: 3, cmd: 'SET x=1' });
// Majority ack -> entry committed

Raft achieves distributed consensus through leader election and log replication. A leader is elected by majority vote; it replicates log entries to followers. Used in etcd, CockroachDB, and Consul.

Rate Limitingsystem design

Restricting the number of requests a client can make within a time window.

const requests = {};
function rateLimit(ip) {
  requests[ip] = (requests[ip] || 0) + 1;
  if (requests[ip] > 100) return 429;
  return 200;
}

Rate limiting protects APIs from abuse by capping requests per time period. Common algorithms: fixed window, sliding window, and token bucket. Exceeded limits return HTTP 429.

Request-Responsesystem design

A communication pattern where a client sends a request and waits for a server's reply.

const response = await fetch('/api/users', {
  method: 'GET', headers: { 'Accept': 'application/json' }
});
const data = await response.json();

Request-response is the foundational communication pattern of the web. The client sends a request and blocks until the server returns a response. HTTP is the most common request-response protocol.

Real-Time Communicationnetworking

Instant data exchange between client and server without manual refreshing.

// Polling: wasteful
setInterval(() => fetch('/api/messages'), 1000);
// WebSocket: efficient
const ws = new WebSocket('wss://chat.app');
ws.onmessage = (e) => showMessage(e.data);

Real-time communication delivers data as soon as it's available. Techniques: WebSockets (persistent bidirectional), Server-Sent Events (server push), long polling.

Reverse Proxynetworking

A server that sits in front of backend servers and forwards client requests to them.

// Reverse proxy routing
Client -> Reverse Proxy (nginx:443)
  /api/*    -> backend-api:3000
  /static/* -> cdn-origin:8080

A reverse proxy receives client requests and routes them to backend servers. Uses: load balancing, SSL termination, caching, and security. NGINX and HAProxy are popular choices.

Round-Robin Load Balancingnetworking

A load-balancing algorithm that distributes requests to servers in sequential rotation.

const servers = ['s1', 's2', 's3'];
let index = 0;
function nextServer() {
  const server = servers[index];
  index = (index + 1) % servers.length;
  return server;
}

Round-robin sends each new request to the next server in circular order. Works well when servers are equally capable and requests have similar cost.

Regressionmachine learning

A supervised learning task that predicts a continuous numeric value.

from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(X_train, y_train)
predicted = model.predict([[1500, 3]])

Regression predicts continuous outputs like price or temperature. Linear regression fits y = wx + b. The model minimizes a loss function like MSE.

Regularizationmachine learning

A technique that penalizes model complexity to prevent overfitting.

from sklearn.linear_model import Ridge, Lasso
ridge = Ridge(alpha=1.0).fit(X, y)
lasso = Lasso(alpha=0.1).fit(X, y)

Regularization adds a penalty term to the loss function. L1 (Lasso) encourages sparsity. L2 (Ridge) encourages small weights. Dropout randomly disables neurons during training.

Rollbackproduction engineering

Reverting a deployment to a previous known-good version.

const deploy = {
  current: 'v2.3.1',
  rollbackTo: 'v2.3.0',
  reason: 'Increased error rate after deploy'
};

A rollback reverts production to a previously stable version. The fastest way to mitigate incidents caused by bad deploys.

Runbookproduction engineering

A documented set of step-by-step procedures for handling specific operational tasks.

const runbook = {
  title: 'High Memory Usage',
  symptoms: ['OOM alerts', 'slow responses'],
  steps: ['Check top processes', 'Restart service']
};

A runbook provides tested steps for diagnosing and resolving common operational issues. Reduces mean time to recovery by providing clear guidance under pressure.

Repositorygit version control

A directory tracked by Git containing your project's files and history.

// git init my-project
// cd my-project
// ls -a  ->  .git/

A repository contains all project files plus a hidden .git folder with the complete version history, branches, and configuration.

Remote Repositorygit version control

A version of your repository hosted on a server like GitHub for collaboration.

// git remote add origin https://github.com/user/repo.git
// git remote -v

A remote repository is hosted on a server. The default remote is named origin. Remotes enable collaboration by providing a shared source of truth.

Rebasegit version control

Replaying your branch's commits on top of another branch's latest commit.

// git checkout feature-x
// git rebase main
// git checkout main && git merge feature-x

Rebasing creates a linear history by replaying commits onto a new base. Never rebase commits that have been shared publicly.

Registercomputer hardware

A tiny, ultra-fast storage location inside the CPU that holds data being processed.

// Registers are like local variables for the CPU
// let a = 5 might use register R1
// LOAD R1, 5       <- put 5 in register
// ADD R1, R1, 3    <- add 3 (result: 8)
// STORE [addr], R1 <- save to memory

Registers are the fastest storage in a computer, built directly into the CPU. They hold the values currently being operated on. A typical CPU has 16-32 general-purpose registers. Accessing a register takes about 0.3 nanoseconds vs 100ns for RAM.

RAMcomputer hardware

Random Access Memory — volatile working memory where running programs and data are stored.

// Variables live in RAM while your program runs
const users = []; // allocated in RAM
for (let i = 0; i < 1000000; i++) {
  users.push({ id: i }); // more RAM used
}
// When program exits, RAM is freed

RAM (Random Access Memory) is the main working memory of a computer. It holds the OS, running programs, and their data. RAM is volatile — contents are lost when power is off. Modern computers have 8-64 GB of DDR5 RAM with ~100ns access time.

Remainderarithmetic

The amount left over after dividing one integer by another.

let r = 7 % 3;   // 1
let r2 = 10 % 5;  // 0 (divides evenly)
let r3 = 17 % 4;  // 1

The remainder is the integer left over when one integer is divided by another using integer division. For a ÷ b, if a = b * q + r, then r is the remainder and q is the quotient. The modulo operator (%) in most programming languages returns this remainder. For example, 7 ÷ 3 = 2 remainder 1.

Rate Problemalgebra

A word problem involving relationships between distance, speed, and time, or similar rate-based quantities.

// Two cars leave from the same point:
// Car A at 60 mph, Car B at 80 mph
// How long until they are 280 miles apart?
// 60t + 80t = 280
let t = 280 / (60 + 80);  // 2 hours

A rate problem involves quantities that change at a constant rate, most commonly using the formula distance = rate × time. These problems may involve two objects moving toward or away from each other, or working together at different rates. Setting up the correct equation requires identifying the relationship between the quantities and choosing consistent units.

Reflectiongeometry

A transformation that produces a mirror image of a figure across a line of reflection.

const reflectX = (point) => ({ x: point.x, y: -point.y });
const reflectY = (point) => ({ x: -point.x, y: point.y });

A reflection is a rigid transformation (isometry) that flips a figure over a specified line called the line of reflection. Every point in the original figure maps to a point equidistant from the line of reflection on the opposite side. Reflections preserve size and shape but reverse orientation (chirality). Reflecting across the x-axis changes (x, y) to (x, -y); reflecting across the y-axis changes (x, y) to (-x, y).

Rotationgeometry

A transformation that turns a figure around a fixed point by a given angle.

const rotate = (x, y, theta) => ({
  x: x * Math.cos(theta) - y * Math.sin(theta),
  y: x * Math.sin(theta) + y * Math.cos(theta)
});

A rotation is a rigid transformation that turns every point of a figure through a specified angle about a fixed center point. Rotations preserve size, shape, and orientation. A rotation by angle theta about the origin maps (x, y) to (x*cos(theta) - y*sin(theta), x*sin(theta) + y*cos(theta)). Positive angles rotate counterclockwise by convention.

Radiantrigonometry

A unit of angle measure where one radian is the angle subtended by an arc equal in length to the radius.

// JavaScript's Math functions use radians
Math.sin(Math.PI / 6); // 0.5 (sin 30 degrees)
// pi radians = 180 degrees
const fullCircle = 2 * Math.PI; // ~6.2832 radians

A radian is the standard unit of angular measure in mathematics. One radian is the angle at the center of a circle subtended by an arc whose length equals the radius. A full circle is 2*pi radians (approximately 6.2832). Radians are dimensionless (they are a ratio of two lengths) and are the natural unit for calculus, since the derivatives of trig functions take their simplest form when angles are in radians.

Reference Angletrigonometry

The acute angle formed between the terminal side of an angle and the nearest portion of the x-axis.

const referenceAngle = (theta) => {
  const t = ((theta % (2*Math.PI)) + 2*Math.PI) % (2*Math.PI);
  if (t <= Math.PI/2) return t;
  if (t <= Math.PI) return Math.PI - t;
  if (t <= 3*Math.PI/2) return t - Math.PI;
  return 2*Math.PI - t;
};

A reference angle is the positive acute angle (between 0 and pi/2, exclusive) between the terminal side of a given angle and the x-axis. For an angle theta: in QI, the reference angle is theta; in QII, it is pi - theta; in QIII, it is theta - pi; in QIV, it is 2*pi - theta. Reference angles simplify evaluation of trig functions because |trig(theta)| = trig(reference angle), with the sign determined by the quadrant.

Rational Functionprecalculus

A function expressed as the ratio of two polynomials, f(x) = p(x)/q(x), where q(x) ≠ 0.

// Rational function f(x) = (x^2 - 1) / (x - 1) has a hole at x=1
const f = x => (x**2 - 1) / (x - 1);
console.log(f(2));    // 3
console.log(f(1));    // NaN — hole at x=1
console.log(f(1.001)); // ≈ 2.001 — approaches 2

A rational function is the quotient of two polynomial functions, written f(x) = p(x)/q(x), where q(x) is not the zero polynomial. The domain excludes all x-values where q(x) = 0. Rational functions may have vertical asymptotes (where the denominator is zero and the numerator is not), horizontal or oblique asymptotes (governing end behavior), and holes (where both numerator and denominator share a common factor that cancels).

Root of Polynomialprecalculus

A value of x for which a polynomial function equals zero, also called a zero or x-intercept.

// Find roots of x^2 - 5x + 6 = 0 by factoring: (x-2)(x-3)
const p = x => x**2 - 5*x + 6;
console.log(p(2)); // 0 — root
console.log(p(3)); // 0 — root
// Quadratic formula
const [a, b, c] = [1, -5, 6];
const disc = b**2 - 4*a*c;
console.log((-b + Math.sqrt(disc)) / (2*a)); // 3
console.log((-b - Math.sqrt(disc)) / (2*a)); // 2

A root (or zero) of a polynomial p(x) is a value r such that p(r) = 0. Graphically, roots correspond to x-intercepts where the curve crosses or touches the x-axis. The Fundamental Theorem of Algebra states that a polynomial of degree n has exactly n roots in the complex numbers, counted with multiplicity. Roots can be found by factoring, using the Rational Root Theorem, synthetic division, or numerical methods.

Rate of Changecalculus

How quickly one quantity changes with respect to another.

// Average vs instantaneous rate of change
const f = t => t * t; // position
// Average rate from t=1 to t=3
const avg = (f(3) - f(1)) / (3 - 1);
console.log('Average:', avg); // 4
// Instantaneous rate at t=2
const inst = 2 * 2; // f'(t) = 2t
console.log('Instantaneous:', inst); // 4

A rate of change measures the ratio of change in a dependent variable to change in an independent variable. The average rate of change over an interval is [f(b) - f(a)] / (b - a), which is the slope of the secant line. The instantaneous rate of change at a point is the derivative, giving the slope of the tangent line.

Removable Discontinuitycalculus

A discontinuity that can be eliminated by redefining the function at a single point.

// f(x) = (x^2-4)/(x-2) has removable discontinuity at x=2
function f(x) {
  if (x === 2) return NaN; // undefined at x=2
  return (x*x - 4) / (x - 2);
}
// "Fix" it by defining f(2) = limit = 4
function fFixed(x) {
  if (x === 2) return 4;
  return (x*x - 4) / (x - 2);
}

A removable discontinuity at x = a occurs when the limit of f(x) as x approaches a exists but does not equal f(a), or f(a) is undefined. The discontinuity is 'removable' because defining or redefining f(a) as the limit value produces a continuous function. This is in contrast to jump or infinite discontinuities, which cannot be repaired.

Riemann Sumcalculus

An approximation of a definite integral using a finite sum of rectangular areas.

// Riemann sum for integral of x^2 from 0 to 1
function riemannSum(f, a, b, n) {
  const dx = (b - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) {
    const x = a + i * dx; // left endpoint
    sum += f(x) * dx;
  }
  return sum;
}
console.log(riemannSum(x => x*x, 0, 1, 1000)); // ~0.333

A Riemann sum approximates the integral of f(x) over [a, b] by partitioning the interval into subintervals, evaluating f at a sample point in each subinterval, and summing the products f(x_i) * delta_x_i. As the partition becomes finer, the Riemann sum converges to the definite integral. This concept bridges finite sums and continuous accumulation.

Radius of Convergencecalculus 2

The distance from the center of a power series within which the series converges absolutely.

// Find radius of convergence for sum x^n/n! (e^x series)
// R = lim |a_n/a_(n+1)| = lim (n+1)! / n! = lim (n+1) = infinity
function ratioTest(n) {
  // a_n = 1/n!, a_(n+1) = 1/(n+1)!
  return (n + 1); // ratio a_n/a_(n+1)
}
console.log('Ratios grow without bound:', ratioTest(100)); // R = infinity

The radius of convergence R of a power series sum of a_n * (x - c)^n is the non-negative number (or infinity) such that the series converges absolutely when |x - c| < R and diverges when |x - c| > R. It can be computed using the Ratio Test as R = lim |a_n / a_(n+1)| or equivalently R = 1 / lim sup |a_n|^(1/n). At |x - c| = R, convergence must be determined separately.

Ratio Testcalculus 2

A convergence test that examines the limit of the ratio of consecutive terms.

// Apply Ratio Test to sum n!/n^n
function ratioTestLimit(n) {
  // |a_(n+1)/a_n| = (n+1)!/(n+1)^(n+1) * n^n/n!
  // = (n/(n+1))^n = (1 - 1/(n+1))^n
  return Math.pow(1 - 1/(n+1), n);
}
console.log(ratioTestLimit(10000)); // approaches 1/e < 1, so converges

The Ratio Test states that for a series sum of a_n, if L = lim |a_(n+1) / a_n| exists, then the series converges absolutely if L < 1, diverges if L > 1, and the test is inconclusive if L = 1. The Ratio Test is particularly effective for series involving factorials, exponentials, or powers, and is the primary tool for finding the radius of convergence of power series.

Ranklinear algebra

The number of linearly independent rows (or equivalently columns) in a matrix.

// After row reduction, count the pivots to find rank
// [[1, 2, 3], [0, 1, 1], [0, 0, 0]] has rank 2 (two pivots)
const rref = [[1, 2, 3], [0, 1, 1], [0, 0, 0]];
const rank = rref.filter(row => row.some(v => Math.abs(v) > 1e-10)).length;
console.log('Rank:', rank); // 2

The rank of a matrix A is the dimension of its column space, equivalently the dimension of its row space. It equals the number of pivot positions in the row echelon form of A. A matrix has full rank if its rank equals the minimum of its row and column counts. The rank determines the number of independent equations in a linear system and, by the rank-nullity theorem, constrains the dimension of the null space.

Row Reductionlinear algebra

The process of using elementary row operations to simplify a matrix into echelon or reduced echelon form.

// Elementary row operation: add c * row_i to row_j
function addScaledRow(matrix, i, j, c) {
  matrix[j] = matrix[j].map((val, k) => val + c * matrix[i][k]);
  return matrix;
}
let M = [[2, 4, 6], [1, 3, 5]];
M = addScaledRow(M, 0, 1, -0.5); // R2 = R2 - 0.5*R1
console.log(M); // [[2,4,6],[0,1,2]]

Row reduction applies a sequence of elementary row operations (row swapping, row scaling, and adding a scalar multiple of one row to another) to transform a matrix into row echelon form or reduced row echelon form (RREF). In RREF, each leading entry is 1, is the only nonzero entry in its column, and each leading 1 appears to the right of the one above it. Row reduction is the computational backbone of Gaussian elimination and is used to find rank, bases, and solutions to linear systems.

Region of Integrationmultivariable calc

The subset of the plane or space over which a multiple integral is evaluated.

// Type I region: a ≤ x ≤ b, g1(x) ≤ y ≤ g2(x)
const a = 0, b = 1;
const g1 = (x) => 0;
const g2 = (x) => x;

The region of integration defines the domain for a double or triple integral and determines the limits on each iterated integral. Regions can be described as Type I (bounded by functions of x), Type II (bounded by functions of y), or more complex shapes requiring polar, cylindrical, or spherical coordinates. Choosing the right description often simplifies the computation significantly.

R-Squaredprobability stats

The proportion of variance in the dependent variable that is explained by the independent variable(s) in a regression model.

// Calculate R² for a regression model
const actual = [2.1, 4.0, 5.8, 8.1, 9.9];
const predicted = [2.0, 4.0, 6.0, 8.0, 10.0];
const mean = actual.reduce((a, b) => a + b) / actual.length;
const ssTot = actual.reduce((s, y) => s + (y - mean) ** 2, 0);
const ssRes = actual.reduce((s, y, i) => s + (y - predicted[i]) ** 2, 0);
const rSquared = 1 - ssRes / ssTot;
console.log(`R² = ${rSquared.toFixed(4)}`); // ≈ 0.9990

R² (coefficient of determination) measures the goodness of fit of a regression model, calculated as R² = 1 - (SS_res / SS_tot), where SS_res is the sum of squared residuals and SS_tot is the total sum of squares. An R² of 1.0 indicates a perfect fit, while 0.0 means the model explains none of the variance. R² always increases when adding predictors, so adjusted R² is preferred for multiple regression as it penalizes model complexity.

Random Variableprobability stats

A function that assigns a numerical value to each outcome in a sample space.

// Random variable X = sum of two dice
const outcomes = [];
for (let d1 = 1; d1 <= 6; d1++)
  for (let d2 = 1; d2 <= 6; d2++)
    outcomes.push(d1 + d2);

const dist = {};
outcomes.forEach(x => dist[x] = (dist[x] || 0) + 1);
for (const [val, count] of Object.entries(dist)) {
  console.log(`P(X=${val}) = ${count}/36 = ${(count/36).toFixed(4)}`);
}

A random variable X is a measurable function from a sample space S to the real numbers, mapping each outcome ω to a value X(ω). Discrete random variables take on countable values (e.g., number of heads), while continuous random variables can take any value in an interval (e.g., height). A random variable is fully characterized by its probability distribution, which assigns probabilities to each possible value or range of values.

RC Circuitdifferential equations

An electrical circuit containing a resistor and capacitor whose voltage obeys a first-order ODE.

// RC circuit discharge: V(t) = V0 * e^(-t/(RC))
const R = 1000; // ohms
const C = 0.001; // farads
const V0 = 5; // volts
const tau = R * C;
function voltage(t) { return V0 * Math.exp(-t / tau); }
console.log('V(1s) =', voltage(1).toFixed(4), 'V');

An RC circuit is governed by the first-order ODE R dq/dt + q/C = V(t), where R is resistance, C is capacitance, q is charge, and V(t) is the applied voltage. The time constant tau = RC determines how quickly the circuit charges or discharges exponentially. RC circuits are canonical examples of first-order linear ODEs with constant coefficients and appear in signal filtering, timing circuits, and sensor systems.

Recurrence Relationdiscrete math

An equation that defines each term of a sequence as a function of its preceding terms.

// Solve T(n) = 2T(n-1) + 1, T(0) = 0
function recurrence(n) {
  if (n === 0) return 0;
  return 2 * recurrence(n - 1) + 1;
}
// Closed form: T(n) = 2^n - 1
console.log(recurrence(5), 2**5 - 1); // 31 31

A recurrence relation defines the nth term of a sequence in terms of one or more previous terms, together with initial conditions. For example, T(n) = 2T(n-1) + 1 with T(0) = 0. Solving a recurrence relation means finding a closed-form expression for the nth term. Common techniques include substitution, the characteristic equation method for linear recurrences, and the Master Theorem for divide-and-conquer recurrences.

Real Numbersreal analysis

The complete ordered field that includes all rational and irrational numbers.

// Rationals have gaps; reals fill them
// There's no rational whose square is 2
function rationalApprox(target, maxDenom) {
  let best = 0, bestDenom = 1;
  for (let d = 1; d <= maxDenom; d++)
    for (let n = 0; n <= d * 2; n++)
      if (Math.abs(n/d - target) < Math.abs(best/bestDenom - target))
        { best = n; bestDenom = d; }
  return `${best}/${bestDenom} ≈ ${best/bestDenom}`;
}
console.log(rationalApprox(Math.sqrt(2), 100));

The real numbers R form a complete ordered field, uniquely characterized (up to isomorphism) by the field axioms, the order axioms, and the Completeness Axiom. They extend the rational numbers by filling in all gaps, such as sqrt(2) and pi. The real number system is the foundational setting for analysis, providing the continuum on which limits, continuity, differentiation, and integration are defined.

Riemann Integral (Rigorous)real analysis

The definite integral defined as the common limit of upper and lower Riemann sums over partitions.

// Riemann sum approximation of integral of x^2 from 0 to 1
function riemannSum(f, a, b, n) {
  const dx = (b - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) {
    sum += f(a + (i + 0.5) * dx) * dx; // midpoint rule
  }
  return sum;
}
console.log(riemannSum(x => x*x, 0, 1, 10000)); // ~0.3333

The Riemann integral of a bounded function f on [a, b] is the unique real number I such that for every partition P, L(f, P) <= I <= U(f, P), where L and U are lower and upper Darboux sums. It exists precisely when the upper and lower integrals coincide. The Riemann integral formalizes the notion of signed area under a curve and serves as the basis for the Fundamental Theorem of Calculus.

Rolle's Theoremreal analysis

If f is continuous on [a,b], differentiable on (a,b), and f(a)=f(b), then f'(c)=0 for some c in (a,b).

// Rolle's: f(x) = x^2 - 4x + 3 on [1, 3], f(1)=f(3)=0
const f = x => x*x - 4*x + 3;
console.log(`f(1)=${f(1)}, f(3)=${f(3)}`); // both 0
// f'(x) = 2x - 4 = 0 => x = 2
const c = 2;
const fPrime = x => 2*x - 4;
console.log(`c=${c}, f'(c)=${fPrime(c)}`); // f'(2) = 0

Rolle's Theorem states that if f is continuous on the closed interval [a, b], differentiable on the open interval (a, b), and f(a) = f(b), then there exists at least one point c in (a, b) where f'(c) = 0. The proof uses the Extreme Value Theorem: f attains a maximum and minimum on [a, b], and if either occurs in the interior, the derivative there must be zero. Rolle's Theorem is a special case of the Mean Value Theorem and serves as a key lemma in its proof.

Ringabstract algebra

An algebraic structure with two operations—addition and multiplication—where addition forms an abelian group and multiplication is associative and distributes over addition.

A ring (R, +, *) is a set R equipped with two binary operations such that (R, +) is an abelian group, multiplication is associative, and multiplication distributes over addition from both sides. A ring may or may not have a multiplicative identity (a ring with one is called a unital ring) and multiplication need not be commutative. The integers, polynomials, and matrices are canonical examples of rings, each illustrating different properties a ring may or may not possess.

Root (Zero)precalculus

A value of x that makes f(x) = 0.

// Find roots of f(x) = x^2 - 5x + 6
const a = 1, b = -5, c = 6;
const disc = b * b - 4 * a * c;
const r1 = (-b + Math.sqrt(disc)) / (2 * a);
const r2 = (-b - Math.sqrt(disc)) / (2 * a);
console.log(`Roots: ${r1}, ${r2}`); // 3, 2

A root, also called a zero, of a function f is any value x = r such that f(r) = 0. Graphically, roots are the x-intercepts where the curve crosses or touches the x-axis. For a polynomial of degree n, the Fundamental Theorem of Algebra guarantees exactly n roots when counted with multiplicity in the complex numbers.

Rational Integrandcalculus 2

An integrand that is a ratio of two polynomials.

// Example rational integrand: (2x + 3) / (x^2 + x)
const integrand = (x) => (2 * x + 3) / (x * x + x);

A rational integrand has the form P(x)/Q(x) where both P and Q are polynomials. Integrating these functions typically requires partial fraction decomposition after ensuring the degree of P is less than the degree of Q. If the numerator has equal or higher degree, polynomial long division is performed first.

Row Echelon Formlinear algebra

A matrix form where each leading entry is to the right of the one above it and all entries below leading entries are zero.

// Example of a matrix in row echelon form
const ref = [
  [1, 3, -1, 4],
  [0, 1,  2, 3],
  [0, 0,  1, 5]
];
console.log('Row echelon form:', ref);

A matrix is in row echelon form when every leading (first nonzero) entry of a row is strictly to the right of the leading entry of the row above, and all rows of zeros are at the bottom. Reduced row echelon form additionally requires each leading entry to be 1 and to be the only nonzero entry in its column. Gaussian elimination converts any matrix to row echelon form to solve linear systems.

S
Stringprogramming foundations

A sequence of characters representing text.

let s = "hello";
s.length    // 5
s.toUpperCase() // "HELLO"

A string is a data type that represents text. Strings are enclosed in quotes (single, double, or backticks in JS; single or double in Python). Strings support operations like concatenation, slicing, searching, and formatting.

Scopeprogramming foundations

The region of code where a variable is accessible.

function foo() {
  let x = 1; // local scope
}
// x is NOT accessible here

Scope defines where in your code a variable can be referenced. Variables declared inside a function have local scope (only accessible within that function). Variables declared outside all functions have global scope. Block-scoped variables (declared with `let` or `const` in JS) are only accessible within their enclosing `{}` block.

Spread Operatorprogramming foundations

The ... syntax that expands an array or object into individual elements.

const a = { x: 1, y: 2 };
const b = { ...a, y: 3, z: 4 };
// b = { x: 1, y: 3, z: 4 }

The spread operator (`...` in JS, `**` for dicts / `*` for lists in Python) expands an iterable into individual elements. For arrays: `[...arr1, ...arr2]` merges arrays. For objects: `{...obj1, ...obj2}` merges objects (later values override). Spread creates shallow copies and is the standard way to do immutable updates.

Stack Overflowprogramming foundations

An error that occurs when the call stack exceeds its maximum size.

function infinite() {
  return infinite(); // no base case!
}
infinite(); // RangeError: Maximum call stack size exceeded

A stack overflow happens when too many function calls are pushed onto the call stack without returning. This is most commonly caused by infinite recursion (a recursive function with no base case, or a base case that's never reached). The stack has a finite size (typically a few MB), so unbounded recursion will always eventually crash.

String Methodprogramming foundations

A built-in function on strings like toUpperCase, split, replace, or trim.

"hello world".toUpperCase() // "HELLO WORLD"
"  spaces  ".trim()         // "spaces"
"a,b,c".split(",")          // ["a","b","c"]

String methods are functions available on string values. Since strings are immutable, all string methods return a new string rather than modifying the original. Common methods: toUpperCase/lower, trim (remove whitespace), split (to array), replace, includes, startsWith, indexOf, slice, repeat.

Substringprogramming foundations

A portion of a string extracted by specifying start and end positions.

"hello world".slice(0, 5)  // "hello"
"hello world".slice(6)     // "world"
"hello"[1:4]               // Python: "ell"

A substring is a contiguous sequence of characters within a string, extracted using slice or substring methods. In JavaScript: str.slice(start, end). In Python: str[start:end]. Both use zero-based indexing and the end index is exclusive (not included). Negative indices count from the end of the string.

Space Complexitydata structures algorithms

A measure of how much memory an algorithm uses relative to input size.

// O(1) space — in-place
function reverse(arr) {
  let l = 0, r = arr.length - 1;
  while (l < r) [arr[l++], arr[r--]] = [arr[r], arr[l]];
}

Space complexity measures the total memory an algorithm needs as a function of input size. It includes auxiliary space (extra memory beyond the input) and input space. An in-place algorithm uses O(1) auxiliary space. Recursive algorithms use O(depth) stack space.

Sliding Windowdata structures algorithms

A technique that maintains a window of elements as it slides across an array.

function maxSum(arr, k) {
  let sum = arr.slice(0, k).reduce((a,b) => a+b);
  let max = sum;
  for (let i = k; i < arr.length; i++) {
    sum += arr[i] - arr[i-k]; // slide
    max = Math.max(max, sum);
  }
  return max;
}

The sliding window pattern maintains a contiguous subarray (window) that expands or contracts as it moves through the data. Used for problems involving subarrays of a given size or condition: max sum subarray, longest substring without repeats, minimum window substring.

Singly Linked Listdata structures algorithms

A linked list where each node points only to the next node.

head → [A] → [B] → [C] → null
// Can only go forward

In a singly linked list, each node has a reference to the next node only. You can traverse forward but not backward. Prepending is O(1), appending is O(n) unless you maintain a tail pointer. Deletion requires finding the previous node first.

Stackdata structures algorithms

A Last-In-First-Out (LIFO) data structure — the last element added is the first removed.

const stack = [];
stack.push(1); // [1]
stack.push(2); // [1, 2]
stack.pop();   // 2, stack = [1]

A stack supports two primary operations: push (add to top) and pop (remove from top), both O(1). The call stack tracks function execution. Stacks are used for undo/redo, expression parsing, backtracking, and DFS traversal.

Set (Data Structure)data structures algorithms

A collection that stores only unique values with O(1) membership testing.

const s = new Set([1, 2, 2, 3]);
s.size;      // 3 (duplicates removed)
s.has(2);    // true O(1)
s.add(4);    // {1, 2, 3, 4}

A set is an unordered collection of unique elements. Adding a duplicate has no effect. Sets support O(1) add, delete, and has operations (hash-based). Set operations: union (combine), intersection (common elements), difference (in A but not B). Used for deduplication and fast lookups.

Set Operationsdata structures algorithms

Union, intersection, and difference — combining and comparing sets.

const a = new Set([1,2,3]);
const b = new Set([2,3,4]);
// Union: {1,2,3,4}
// Intersection: {2,3}
// Difference: {1}

Set operations combine sets mathematically. Union (A ∪ B): all elements in either set. Intersection (A ∩ B): elements in both sets. Difference (A − B): elements in A but not B. Symmetric difference: elements in either but not both. These operations are fundamental in database queries and data analysis.

Sorting Algorithmdata structures algorithms

An algorithm that arranges elements in a specific order (ascending/descending).

arr.sort((a, b) => a - b); // ascending
arr.sort((a, b) => b - a); // descending

Sorting algorithms reorder elements according to a comparison function. Simple sorts (bubble, selection, insertion) are O(n²). Efficient sorts (merge sort, quicksort, heapsort) are O(n log n). The choice depends on data size, memory constraints, and whether stability matters (preserving equal-element order).

Search Spacedata structures algorithms

The set of all possible values that could contain the answer.

// Array of 1000 elements
// Linear search: space = 1000
// After 1 binary search step: space = 500
// After 10 steps: space = ~1

The search space is the domain of possible solutions. Binary search reduces the search space by half each step. In optimization, the search space includes all possible configurations. Smaller search spaces lead to faster algorithms. Pruning eliminates impossible portions of the search space.

Shortest Path (Unweighted)data structures algorithms

The path between two nodes with the fewest edges, found using BFS.

// BFS from A finds:
// A→B: 1 edge (shortest)
// A→C→D→B: 3 edges (not shortest)

In an unweighted graph, the shortest path has the minimum number of edges. BFS naturally finds this because it explores nodes in order of distance from the source. Track parents during BFS to reconstruct the path. For weighted graphs, use Dijkstra's algorithm instead.

Stack Memoryoperating systems

Fast, automatically managed memory for function calls and local variables.

function a() { let x = 1; b(); }
function b() { let y = 2; }
// Stack: [main] → [main, a(x=1)] → [main, a, b(y=2)]

The stack is a LIFO memory region that stores function call frames, local variables, and return addresses. Each function call pushes a frame; returning pops it. Stack allocation is instant (just move the pointer). Limited size (~1-8 MB). Stack overflow = too many frames (usually infinite recursion).

SQLdatabases

Structured Query Language — the standard language for querying relational databases.

SELECT u.name, COUNT(o.id) as orders
FROM users u
JOIN orders o ON u.id = o.user_id
GROUP BY u.name
HAVING COUNT(o.id) > 5;

SQL (Structured Query Language) is a declarative language for managing relational data. Core statements: SELECT (query), INSERT (add), UPDATE (modify), DELETE (remove), CREATE TABLE (schema). SQL is declarative — you describe what data you want, and the database figures out how to get it efficiently.

Serverlessproduction engineering

A cloud model where the provider manages servers and you only write function code.

// Vercel/Next.js API route (serverless)
export default function handler(req, res) {
  res.json({ message: 'Hello!' });
}
// Scales to 0 when idle, scales up under load

Serverless (Function as a Service) lets you deploy individual functions that run in response to events. No server management, automatic scaling, pay-per-invocation. AWS Lambda, Vercel Functions, Cloudflare Workers. Tradeoffs: cold starts (first invocation is slow), execution time limits, and vendor lock-in.

SLOproduction engineering

Service Level Objective — a target for service reliability (e.g., 99.9% uptime).

SLI: p99 latency = 200ms (measured)
SLO: p99 latency < 500ms (target)
SLA: p99 latency < 1000ms (contract)

99.9% uptime = 8.7 hrs/year downtime
99.99% = 52 min/year

An SLO (Service Level Objective) is an internal reliability target. SLI (Service Level Indicator) is the measurement (e.g., request latency p99). SLA (Service Level Agreement) is the contractual guarantee with penalties. 99.9% uptime (three nines) = ~8.7 hours downtime per year. Error budgets = allowed downtime before freezing deploys.

Supervised Learningmachine learning

Training a model on labeled examples to predict outputs for new inputs.

# Training data: (features, label)
# ([bedrooms, sqft, age], price)
train_data = [
  ([3, 1500, 10], 300000),
  ([4, 2000, 5],  450000),
]
# Model learns: features → price

Supervised learning uses a dataset of input-output pairs to learn a mapping function. Classification predicts discrete labels (spam/not spam). Regression predicts continuous values (house price). The model minimizes a loss function on training data and is evaluated on held-out test data.

Serializabledatabases

The strictest isolation level where transactions execute as if they were sequential.

BEGIN;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SELECT COUNT(*) FROM orders WHERE status = 'pending';
COMMIT;

Serializable isolation guarantees that concurrent transactions produce the same result as if they ran one after another. It prevents all anomalies: dirty reads, non-repeatable reads, and phantom reads.

Standard Streams (stdin/stdout)operating systems

The default input and output channels every process receives from the OS.

process.stdin.on('data', (input) => {
  process.stdout.write(`You typed: ${input}`);
});
process.stderr.write('Something went wrong!');

Every process starts with three standard streams: stdin (fd 0) for reading input, stdout (fd 1) for normal output, and stderr (fd 2) for error messages. Shells use these for piping.

Split-Braindistributed systems

A failure where network partitions cause multiple nodes to act as leader simultaneously.

// Partition A: {node1, node2} -> 2 nodes, no quorum
// Partition B: {node3, node4, node5} -> 3 nodes, valid leader

Split-brain occurs when a network partition divides a cluster, each side electing its own leader. Both sides accept writes independently, leading to data divergence. Fix: require majority for leader election.

Strong Consistencydistributed systems

A model guaranteeing every read returns the most recent write's value.

await db.write('balance', 100);
const val = await db.read('balance');
console.log(val); // always 100, never stale

Strong consistency guarantees that once a write completes, all subsequent reads from any node return that value. This simplifies application logic but costs performance and availability during partitions.

Scalabilitysystem design

A system's ability to handle increased load by adding resources.

// 100 users -> 50ms avg
// 1,000 users -> 55ms avg (scales well)
// 10,000 users -> 500ms avg (bottleneck)

Scalability is how well a system adapts to growing demand. Vertical scaling adds power to one machine. Horizontal scaling adds more machines. Good scalability requires stateless design, caching, and database optimization.

Separation of Concernssystem design

A design principle where each module handles one distinct responsibility.

function validateUser(data) { /* validation only */ }
function saveUser(user) { /* database only */ }
function renderUser(user) { /* display only */ }

Separation of concerns means dividing a system so each part addresses a single concern. This reduces coupling, making code easier to change, test, and understand.

Service Boundarysystem design

The defined interface and scope of responsibility for a microservice.

// Good boundaries: each service owns its data
// UserService -> users DB
// OrderService -> orders DB
// They communicate via APIs, not shared DBs

A service boundary defines what a microservice owns — its data, business logic, and API contract. Well-drawn boundaries follow domain-driven design: each service encapsulates one business capability.

Stateless Protocolsystem design

A protocol where each request is independent, with no memory of previous requests.

fetch('/api/profile', {
  headers: { 'Authorization': 'Bearer token123' }
});
// Server doesn't remember you — token proves identity

A stateless protocol treats every request as brand new. HTTP is stateless: each request must carry all needed information. Statelessness simplifies scaling because any server can handle any request.

SSL Terminationnetworking

Decrypting TLS/SSL traffic at a proxy before forwarding it unencrypted internally.

// Client -> [HTTPS] -> Load Balancer
// Load Balancer -> [HTTP] -> Backend 1
// Load Balancer -> [HTTP] -> Backend 2

SSL termination decrypts encrypted traffic at a reverse proxy or load balancer, then forwards plain HTTP to backend servers. This offloads cryptography from application servers.

Stochastic Gradient Descent (SGD)machine learning

A variant of gradient descent that updates weights using one random sample at a time.

for epoch in range(100):
    np.random.shuffle(data)
    for x, y in data:
        grad = compute_gradient(weights, x, y)
        weights -= learning_rate * grad

SGD approximates the true gradient using a single randomly chosen training example per step. In practice, mini-batch SGD using 32-256 samples is most common.

Self-Attentiondeep learning llms

A mechanism where each token attends to all other tokens in the same sequence.

# 'The cat sat because it was tired'
# 'it' attends to:
# 'cat': 0.45  <- highest weight
# 'sat': 0.15, 'tired': 0.20

Self-attention lets every position compute a weighted combination of all other positions. Multi-head attention runs multiple self-attention computations in parallel.

Standard Deviationmathematics

A measure of how spread out values are from the mean.

const data = [2, 4, 4, 4, 5, 5, 7, 9];
const mean = data.reduce((a,b) => a+b) / data.length;
const variance = data.reduce((s,x) => s + (x-mean)**2, 0) / data.length;
const stdDev = Math.sqrt(variance);

Standard deviation is the square root of variance. Low std dev means data clusters near the mean; high means spread out. In a normal distribution, ~68% of values fall within one std dev.

SLA / SLI / SLOproduction engineering

Service-level agreements, indicators, and objectives that define reliability targets.

const reliability = {
  sli: 'request latency p99',
  slo: 'p99 < 200ms, 99.9% of the time',
  sla: '99.9% uptime or credits issued'
};

SLI is a measurable metric. SLO is an internal target for that metric. SLA is a contractual promise with consequences. Together they define, measure, and commit to reliability.

Structured Loggingproduction engineering

Logging in a machine-parseable format like JSON instead of plain text.

console.log(JSON.stringify({
  timestamp: Date.now(), level: 'error',
  message: 'Payment failed', userId: 'u_123'
}));

Structured logging outputs log entries as key-value data (JSON) instead of unstructured text. Makes logs searchable and filterable by aggregation tools.

Staging Areagit version control

A holding zone where you prepare changes before committing them.

// git add header.js
// git add src/
// git status

The staging area (index) is an intermediate space between working directory and repository. git add moves files to staging, giving you control over what goes into each commit.

Storage Devicecomputer hardware

Non-volatile hardware (SSD, HDD) that persists data when power is off.

// Files are stored on disk (SSD/HDD)
fs.writeFileSync("data.json", JSON.stringify(data));
// Persists after power off
// SSD: ~0.1ms access, HDD: ~5ms access

Storage devices (SSDs, HDDs) provide permanent data storage. HDDs use spinning magnetic platters (~5ms access). SSDs use flash memory chips (~0.1ms access, no moving parts). SSDs are 50-100x faster than HDDs for random access.

Square Rootarithmetic

A value that, when multiplied by itself, gives the original number.

Math.sqrt(25);   // 5
Math.sqrt(2);    // 1.4142135...
25 ** 0.5;       // 5 (alternate syntax)

The square root of a number x is a value y such that y * y = x, written as √x. Every positive number has two square roots: one positive and one negative, but the principal square root is the non-negative one. The square root of a negative number is not a real number. Square roots are the inverse operation of squaring.

Subtractionarithmetic

The arithmetic operation of finding the difference between two numbers.

let diff = 10 - 3;   // 7
let negative = 3 - 10;  // -7

Subtraction is the inverse of addition. It finds the difference by removing one quantity from another. Unlike addition, subtraction is not commutative (a - b ≠ b - a) and not associative. The result is called the difference. Subtraction can produce negative numbers when the subtrahend is greater than the minuend.

Slopealgebra

The measure of a line's steepness, calculated as the ratio of vertical change to horizontal change.

function slope(x1, y1, x2, y2) {
  return (y2 - y1) / (x2 - x1);
}
slope(1, 2, 4, 8);  // 2
slope(0, 5, 3, 5);  // 0 (horizontal)

Slope measures how steep a line is by computing rise over run: m = (y2 - y1) / (x2 - x1). A positive slope means the line rises from left to right; a negative slope means it falls. A slope of zero is a horizontal line, and an undefined slope is a vertical line. Slope is the rate of change of y with respect to x.

Slope-Intercept Formalgebra

The linear equation format y = mx + b, where m is the slope and b is the y-intercept.

// y = 2x + 3: slope = 2, y-intercept = 3
function line(x) {
  let m = 2, b = 3;
  return m * x + b;
}
line(0);  // 3 (the y-intercept)
line(1);  // 5

Slope-intercept form writes a linear equation as y = mx + b, making it easy to identify the slope (m) and y-intercept (b) directly. The slope determines the line's steepness and direction, while the y-intercept is where the line crosses the y-axis. This form is ideal for quickly graphing a line: start at (0, b) and use the slope to plot additional points.

Substitution Methodalgebra

A technique for solving systems of equations by expressing one variable in terms of another and substituting.

// y = 2x + 1
// 3x + y = 11
// Substitute: 3x + (2x + 1) = 11
// 5x + 1 = 11 => x = 2
// y = 2(2) + 1 = 5
let x = 2, y = 5;

The substitution method solves a system of equations by isolating one variable in one equation and substituting that expression into the other equation. This reduces the system to a single equation in one variable. After solving for that variable, its value is substituted back to find the other variable. It works best when one variable is already isolated or has a coefficient of 1.

System of Equationsalgebra

A set of two or more equations with the same variables that are solved simultaneously.

// System: x + y = 10 and x - y = 4
// Add: 2x = 14, x = 7
// Subtract: y = 3
let x = 7, y = 3;
console.log(x + y === 10 && x - y === 4);  // true

A system of equations is a collection of equations that share variables and must all be satisfied at the same time. A solution is a set of values that makes every equation true simultaneously. Systems can be solved by graphing, substitution, or elimination. A system with two linear equations in two variables can have one solution (intersecting lines), no solution (parallel lines), or infinitely many solutions (identical lines).

Scale Factorgeometry

The ratio by which all lengths of a figure are multiplied in a dilation.

const scale = (point, factor) => ({
  x: point.x * factor,
  y: point.y * factor
});
scale({ x: 3, y: 4 }, 2); // { x: 6, y: 8 }

A scale factor is the constant ratio k that describes how much a figure is enlarged or reduced in a dilation. If k > 1, the figure is enlarged; if 0 < k < 1, it is reduced; if k = 1, the figure is unchanged. Under a scale factor k, lengths multiply by k, areas multiply by k^2, and volumes multiply by k^3. Two figures are similar if one can be obtained from the other by a combination of rigid transformations and a dilation.

Similaritygeometry

A relationship between figures that have the same shape but not necessarily the same size.

Two geometric figures are similar if one can be obtained from the other by a sequence of rotations, reflections, translations, and dilations. Similar figures have equal corresponding angles and proportional corresponding sides. For triangles, similarity can be established by AA (two pairs of equal angles), SAS (proportional sides with included equal angle), or SSS (all three pairs of sides proportional).

Surface Areageometry

The total area of all faces and curved surfaces of a three-dimensional solid.

const boxSA = (l, w, h) => 2 * (l*w + l*h + w*h);
const sphereSA = (r) => 4 * Math.PI * r ** 2;

Surface area is the sum of the areas of all exterior surfaces of a three-dimensional object. For a rectangular prism, SA = 2(lw + lh + wh). For a cylinder, SA = 2*pi*r^2 + 2*pi*r*h. For a sphere, SA = 4*pi*r^2. Surface area is measured in square units and determines how much material is needed to cover or wrap a solid.

Set Intersectionlogic proofs

The set of all elements that belong to both of two given sets.

const A = new Set([1, 2, 3, 4]);
const B = new Set([3, 4, 5, 6]);
const intersection = new Set([...A].filter(x => B.has(x)));
// Set {3, 4}

The intersection of sets A and B, written A intersect B, is the set containing exactly the elements that are in both A and B. If A intersect B is empty, the sets are called disjoint. Intersection is commutative (A intersect B = B intersect A) and associative. The intersection distributes over union, and by De Morgan's law for sets, the complement of a union equals the intersection of the complements.

Set Unionlogic proofs

The set of all elements that belong to at least one of two given sets.

const A = new Set([1, 2, 3]);
const B = new Set([3, 4, 5]);
const union = new Set([...A, ...B]);
// Set {1, 2, 3, 4, 5}

The union of sets A and B, written A union B, is the set containing all elements that are in A, in B, or in both. Union is commutative (A union B = B union A) and associative. The cardinality of a union follows the inclusion-exclusion principle: |A union B| = |A| + |B| - |A intersect B|. Union distributes over intersection, and by De Morgan's law, the complement of an intersection equals the union of the complements.

Sinetrigonometry

A trigonometric function that returns the y-coordinate of a point on the unit circle at a given angle.

Math.sin(0);            // 0
Math.sin(Math.PI / 6);  // 0.5
Math.sin(Math.PI / 2);  // 1

Sine is a fundamental trigonometric function. For an angle theta, sin(theta) equals the y-coordinate of the point where the terminal side of the angle intersects the unit circle. In a right triangle, it is the ratio of the opposite side to the hypotenuse. Sine is periodic with period 2*pi, is an odd function (sin(-theta) = -sin(theta)), and ranges from -1 to 1.

Sequenceprecalculus

An ordered list of numbers defined by a rule, where each number is called a term and is indexed by its position.

// Arithmetic sequence: a₁=2, d=3
const arithmetic = (n) => 2 + (n - 1) * 3;
// Geometric sequence: a₁=5, r=2
const geometric = (n) => 5 * 2 ** (n - 1);
console.log([1,2,3,4,5].map(arithmetic)); // [2,5,8,11,14]
console.log([1,2,3,4,5].map(geometric)); // [5,10,20,40,80]

A sequence is an ordered list of numbers a₁, a₂, a₃, ... generated by a defining rule. An arithmetic sequence has a constant common difference d between consecutive terms (aₙ = a₁ + (n−1)d), while a geometric sequence has a constant common ratio r (aₙ = a₁·rⁿ⁻¹). Sequences can also be defined recursively, where each term depends on one or more preceding terms (e.g., the Fibonacci sequence).

Seriesprecalculus

The sum of the terms of a sequence, either finite (partial sum) or infinite.

// Sum of arithmetic series: 1 + 2 + 3 + ... + 100
const n = 100;
console.log(n * (1 + n) / 2); // 5050
// Geometric series sum: a=1, r=0.5, infinite
const a = 1, r = 0.5;
console.log(a / (1 - r)); // 2

A series is the sum of the terms of a sequence. A finite series (partial sum) adds a fixed number of terms: Sₙ = a₁ + a₂ + ... + aₙ. An infinite series adds all terms and may converge to a finite value or diverge. The partial sum of an arithmetic series is Sₙ = n(a₁ + aₙ)/2, and for a geometric series with |r| < 1, the infinite sum is S = a₁/(1 − r). Series are fundamental to approximating functions and modeling cumulative quantities.

Sigma Notationprecalculus

A compact way to write a sum using the Greek letter Σ, specifying the index variable, bounds, and the expression to sum.

// Sigma notation: Σ(i=1 to 5) i^2 = 1 + 4 + 9 + 16 + 25
function sigma(start, end, fn) {
  let sum = 0;
  for (let i = start; i <= end; i++) sum += fn(i);
  return sum;
}
console.log(sigma(1, 5, i => i ** 2)); // 55

Sigma notation (summation notation) uses the Greek capital letter Σ to express a sum concisely. It takes the form Σ (from i=m to n) of aᵢ, meaning add up aᵢ for each integer i starting at the lower bound m and ending at the upper bound n. The variable i is the index of summation, m is the starting index, and n is the ending index. This notation is essential for expressing series, defining statistical formulas, and writing algorithms that accumulate values.

Stretch and Compressionprecalculus

Transformations that scale a graph vertically or horizontally by multiplying the output or input by a constant factor.

const f = x => Math.sin(x);
const vertStretch = x => 3 * f(x);    // amplitude tripled
const horizCompress = x => f(2 * x);  // period halved
console.log(f(Math.PI / 2));          // 1
console.log(vertStretch(Math.PI / 2)); // 3
console.log(horizCompress(Math.PI / 4)); // 1 (same as f(π/2))

A vertical stretch or compression multiplies all output values of f(x) by a constant a: the graph of a·f(x) stretches vertically when |a| > 1 and compresses when 0 < |a| < 1. A horizontal stretch or compression replaces x with bx: the graph of f(bx) compresses horizontally when |b| > 1 and stretches when 0 < |b| < 1. These transformations change the scale of the graph without shifting its position, and they preserve the x-intercepts (vertical) or y-intercepts (horizontal).

Second Derivative Testcalculus

A method using the second derivative to classify critical points as maxima, minima, or inconclusive.

// Classify critical point of f(x) = x^3 - 3x
// f'(x) = 3x^2 - 3 = 0 => x = ±1
// f''(x) = 6x
console.log(6 * 1);  // 6 > 0 => local minimum at x=1
console.log(6 * -1); // -6 < 0 => local maximum at x=-1

The second derivative test states that at a critical point c where f'(c) = 0: if f''(c) > 0, then c is a local minimum (concave up); if f''(c) < 0, then c is a local maximum (concave down); if f''(c) = 0, the test is inconclusive and other methods must be used. It provides a quick classification when the second derivative is easy to compute.

Signed Areacalculus

Area counted as positive above the x-axis and negative below it.

// Signed area of sin(x) from 0 to 2*PI
function integrate(f, a, b, n = 10000) {
  const dx = (b - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) {
    sum += f(a + (i + 0.5) * dx) * dx;
  }
  return sum;
}
console.log(integrate(Math.sin, 0, 2*Math.PI)); // ~0 (cancels out)
console.log(integrate(x => Math.abs(Math.sin(x)), 0, 2*Math.PI)); // ~4

Signed area is the geometric interpretation of the definite integral. When f(x) > 0, the area between the curve and the x-axis is positive; when f(x) < 0, it is negative. The definite integral computes the net signed area, meaning areas above and below the axis can cancel each other out. To find total (unsigned) area, integrate |f(x)|.

Squeeze Theoremcalculus

If a function is trapped between two others that share the same limit, it must share that limit too.

// Squeeze theorem: lim(x->0) x^2*sin(1/x) = 0
// Because -x^2 <= x^2*sin(1/x) <= x^2
// and lim(x->0) x^2 = lim(x->0) -x^2 = 0
for (const x of [0.1, 0.01, 0.001]) {
  const lower = -x*x;
  const value = x*x * Math.sin(1/x);
  const upper = x*x;
  console.log(`${lower.toFixed(6)} <= ${value.toFixed(6)} <= ${upper.toFixed(6)}`);
}

The squeeze theorem (also called the sandwich theorem) states that if g(x) <= f(x) <= h(x) near x = a, and the limits of g and h as x approaches a both equal L, then the limit of f(x) as x approaches a also equals L. This is especially useful for evaluating limits of oscillating functions like (sin x)/x as x approaches 0.

Sequence Convergencecalculus 2

A sequence converges if its terms approach a finite limit as the index grows without bound.

// Check if sequence a_n = (2n+1)/(3n-1) converges
function sequenceTerm(n) {
  return (2 * n + 1) / (3 * n - 1);
}
for (let n of [10, 100, 1000, 10000]) {
  console.log(`a_${n} = ${sequenceTerm(n)}`); // approaches 2/3
}

A sequence {a_n} converges to limit L if for every epsilon > 0 there exists an N such that |a_n - L| < epsilon for all n > N. Intuitively, the terms of the sequence get arbitrarily close to L and stay close. If no such limit exists, the sequence diverges. Sequence convergence is a prerequisite for series convergence, since the terms of a convergent series must converge to zero.

Shell Methodcalculus 2

A technique for finding volumes of solids of revolution by integrating cylindrical shells parallel to the axis of rotation.

// Volume of y = x^2 from 0 to 1 revolved about y-axis (shell method)
function shellVolume(a, b, n) {
  const dx = (b - a) / n;
  let vol = 0;
  for (let i = 0; i < n; i++) {
    const x = a + (i + 0.5) * dx;
    vol += 2 * Math.PI * x * (x * x) * dx;
  }
  return vol;
}
console.log(shellVolume(0, 1, 10000)); // pi/2 ~ 1.5708

The shell method computes volumes by summing the volumes of thin cylindrical shells: V = 2*pi * integral of (radius)(height) dx. For a region revolved about the y-axis, the radius is x and the height is f(x), giving V = 2*pi * integral of x * f(x) dx. The shell method is often preferred over the disk/washer method when the solid is easier to describe using shells parallel to the axis of rotation.

Surface Area of Revolutioncalculus 2

The area of the surface generated by revolving a curve about an axis.

// Surface area of y = sqrt(x) from 0 to 1 revolved about x-axis
function surfaceArea(f, fPrime, a, b, n) {
  const dx = (b - a) / n;
  let area = 0;
  for (let i = 0; i < n; i++) {
    const x = a + (i + 0.5) * dx;
    area += 2 * Math.PI * f(x) * Math.sqrt(1 + fPrime(x) ** 2) * dx;
  }
  return area;
}
console.log(surfaceArea(x => Math.sqrt(x), x => 0.5/Math.sqrt(x), 0.001, 1, 10000));

When a smooth curve y = f(x) from x = a to x = b is revolved about the x-axis, the surface area is S = 2*pi * integral of f(x) * sqrt(1 + (f'(x))^2) dx. This formula multiplies the arc length element by the circumference of the circle traced by each point on the curve. For revolution about the y-axis, the factor f(x) is replaced by x.

Spanlinear algebra

The set of all possible linear combinations of a given set of vectors.

// Span of [1,0] and [0,1] is all of R2
// Any 2D vector [a,b] = a*[1,0] + b*[0,1]
function isInSpan2D(v, basis1, basis2) {
  const det = basis1[0]*basis2[1] - basis1[1]*basis2[0];
  return Math.abs(det) > 1e-10; // if det != 0, span is all of R2
}
console.log(isInSpan2D([5, 3], [1, 0], [0, 1])); // true

The span of a set of vectors {v1, v2, ..., vk} is the set of all vectors that can be written as c1*v1 + c2*v2 + ... + ck*vk for arbitrary scalars c1 through ck. The span is always a subspace of the ambient vector space. If the vectors are linearly independent, removing any one of them shrinks the span; if dependent, at least one vector is redundant.

Steepest Ascentmultivariable calc

The direction in which a scalar function increases most rapidly, given by the gradient vector.

// Steepest ascent direction
const mag = Math.sqrt(grad_x**2 + grad_y**2);
const dir = [grad_x / mag, grad_y / mag];

At any point where the gradient is nonzero, the direction of steepest ascent is the unit vector in the gradient's direction, ∇f/|∇f|. The rate of increase in this direction equals |∇f|, the gradient's magnitude. This principle underlies gradient ascent optimization algorithms and explains why the gradient is perpendicular to level curves.

Stokes' Theoremmultivariable calc

A theorem relating the circulation of a vector field around a closed curve to the flux of its curl through the bounded surface.

Stokes' Theorem states that ∮_C F · dr = ∬_S (∇ × F) · dS, where C is the boundary curve of surface S with compatible orientation. It generalizes Green's Theorem to three-dimensional surfaces and provides a deep connection between a field's circulation on the boundary and its rotational behavior over the interior. It is one of the fundamental theorems of vector calculus.

Surface Integralmultivariable calc

An integral that accumulates a scalar or vector quantity over a two-dimensional surface in three-dimensional space.

A scalar surface integral ∬_S f dS sums a function over a surface weighted by surface area elements. A vector surface integral (flux integral) ∬_S F · dS measures the net flow of a vector field through the surface. Computing either requires parameterizing the surface and using the cross product of partial derivatives to obtain the area element or normal vector.

Sample Spaceprobability stats

The set of all possible outcomes of a random experiment.

// Sample spaces for different experiments
const coinFlip = ['Heads', 'Tails'];
const dieRoll = [1, 2, 3, 4, 5, 6];
const twoDice = [];
for (const a of dieRoll) for (const b of dieRoll) twoDice.push([a, b]);

console.log(`Coin: ${coinFlip.length} outcomes`);
console.log(`Die: ${dieRoll.length} outcomes`);
console.log(`Two dice: ${twoDice.length} outcomes`);

The sample space S (or Ω) is the universal set containing every possible outcome of a probability experiment. For a coin flip, S = {Heads, Tails}; for a die roll, S = {1,2,3,4,5,6}. Sample spaces can be finite, countably infinite (natural numbers), or uncountably infinite (real numbers in an interval). Every event in a probability model is a subset of the sample space, and P(S) = 1 by Kolmogorov's normalization axiom.

Sampling Distributionprobability stats

The probability distribution of a statistic obtained from repeated random samples of the same size from a population.

// Build sampling distribution of the mean
const population = Array.from({length: 10000}, () => Math.random() * 100);
const sampleSize = 30, numSamples = 1000;
const means = [];
for (let i = 0; i < numSamples; i++) {
  let sum = 0;
  for (let j = 0; j < sampleSize; j++) {
    sum += population[Math.floor(Math.random() * population.length)];
  }
  means.push(sum / sampleSize);
}
const grandMean = means.reduce((a, b) => a + b) / means.length;
console.log(`Mean of sampling dist: ${grandMean.toFixed(2)}`);

A sampling distribution describes the variability of a sample statistic (such as the mean or proportion) across all possible samples of size n drawn from a population. The Central Limit Theorem guarantees that the sampling distribution of the sample mean is approximately normal for large n, with mean μ and standard deviation σ/√n (the standard error). Understanding sampling distributions is essential for constructing confidence intervals and performing hypothesis tests.

Standard Errorprobability stats

The standard deviation of a sampling distribution, measuring how much a sample statistic typically varies from the population parameter.

// Standard error of the mean
const data = [23, 25, 28, 22, 27, 24, 26, 29, 21, 25];
const n = data.length;
const mean = data.reduce((a, b) => a + b) / n;
const s = Math.sqrt(data.reduce((sum, x) => sum + (x - mean) ** 2, 0) / (n - 1));
const se = s / Math.sqrt(n);
console.log(`Sample std dev: ${s.toFixed(3)}`);
console.log(`Standard error: ${se.toFixed(3)}`);

The standard error (SE) quantifies the precision of a sample statistic as an estimate of the population parameter. For the sample mean, SE = σ/√n (or s/√n when σ is unknown). The standard error decreases with the square root of the sample size, meaning quadrupling the sample size halves the standard error. It is the key quantity in computing confidence intervals and test statistics, linking sample variability to inferential uncertainty.

Second-Order ODEdifferential equations

A differential equation in which the highest derivative of the unknown function is the second derivative.

// Verify y = sin(3x) solves y'' + 9y = 0
const x = Math.PI / 6;
const y = Math.sin(3 * x);
const yDoublePrime = -9 * Math.sin(3 * x);
console.log('y\'\' + 9y =', (yDoublePrime + 9 * y).toFixed(6));

A second-order ODE involves y'' as its highest-order term and has the general form y'' = f(x, y, y'). Linear constant-coefficient second-order ODEs are solved via the characteristic equation, yielding exponential, oscillatory, or critically damped solutions depending on the discriminant. They model mechanical vibrations, electrical oscillations, and beam deflections throughout science and engineering.

Separable Equationdifferential equations

A first-order ODE that can be written so that each variable appears on only one side of the equation.

// Separable: dy/dx = xy → ∫dy/y = ∫x dx → ln|y| = x²/2 + C
function solution(x, C) {
  return Math.exp(x * x / 2 + C);
}
console.log('y(1, C=0) =', solution(1, 0).toFixed(4));

A separable equation has the form dy/dx = g(x) h(y), allowing the variables to be separated as dy/h(y) = g(x) dx and each side integrated independently. This is often the first solution technique taught because it reduces an ODE to two standard integration problems. Many fundamental models including exponential growth, Newton's cooling law, and radioactive decay yield separable equations.

Separation of Variablesdifferential equations

A technique that isolates each variable on a different side of the equation before integrating.

// Solve dy/dx = 2x/y by separation: y dy = 2x dx
// Integrating: y²/2 = x² + C → y = sqrt(2x² + 2C)
function solution(x, C) {
  return Math.sqrt(2 * x * x + 2 * C);
}
console.log('y(3, C=1) =', solution(3, 1).toFixed(4));

Separation of variables rewrites a separable ODE dy/dx = g(x) h(y) into the form (1/h(y)) dy = g(x) dx, then integrates both sides independently to obtain an implicit or explicit solution. The method requires that the equation factors cleanly into a product of single-variable functions. It extends to partial differential equations where the solution is assumed to be a product of functions each depending on a single coordinate.

Spring-Mass Systemdifferential equations

A mechanical system whose motion is governed by a second-order ODE derived from Hooke's law and Newton's second law.

// Underdamped spring-mass: m=1, b=0.5, k=4
const m = 1, b = 0.5, k = 4;
const omega = Math.sqrt(k/m - (b/(2*m))**2);
const decay = b / (2 * m);
function position(t) {
  return Math.exp(-decay * t) * Math.cos(omega * t);
}
console.log('y(2) =', position(2).toFixed(4));

A spring-mass system models an object of mass m attached to a spring with stiffness k, governed by the ODE m y'' + b y' + k y = F(t), where b is the damping coefficient and F(t) is an external force. The system exhibits underdamped oscillation, critical damping, or overdamped decay depending on the discriminant b^2 - 4mk. It is the prototypical example of second-order linear ODEs in mechanical engineering and physics.

System of ODEsdifferential equations

A collection of ordinary differential equations involving multiple unknown functions that must be solved simultaneously.

// Convert y'' + 3y' + 2y = 0 to system: let v = y'
// dy/dt = v, dv/dt = -2y - 3v
function system(t, y, v) {
  return { dydt: v, dvdt: -2 * y - 3 * v };
}
const state = system(0, 1, 0);
console.log('dy/dt =', state.dydt, 'dv/dt =', state.dvdt);

A system of ODEs expresses the derivatives of a vector of unknowns as a function of the independent variable and the unknowns themselves, written compactly as dx/dt = F(t, x). Linear systems with constant coefficients are solved via eigenvalue analysis of the coefficient matrix, while nonlinear systems often require numerical methods or qualitative analysis. Any single higher-order ODE can be converted into an equivalent first-order system by introducing auxiliary variables.

Sequence Limit (Rigorous)real analysis

The value L that a sequence approaches, formalized by the epsilon-N definition.

// Prove lim (2n+1)/(n+1) = 2
// |(2n+1)/(n+1) - 2| = |(-1)/(n+1)| = 1/(n+1)
function verifyLimit(epsilon) {
  const N = Math.ceil(1/epsilon);
  const n = N;
  const term = (2*n+1)/(n+1);
  const diff = Math.abs(term - 2);
  return { N, term, diff, withinEpsilon: diff < epsilon };
}
console.log(verifyLimit(0.01));

The limit of a sequence (a_n) is a real number L such that for every epsilon > 0, there exists a natural number N where for all n >= N, |a_n - L| < epsilon. If such an L exists, the sequence is said to converge to L, written lim a_n = L. The limit is unique when it exists. This definition transforms the intuitive idea of 'getting closer' into a precise logical statement involving universal and existential quantifiers.

Subgroupabstract algebra

A subset of a group that is itself a group under the same operation.

// Even integers form a subgroup of (Z, +)
const isEven = n => n % 2 === 0;
const closure = (a, b) => isEven(a + b);
console.log(closure(4, 6)); // true
console.log(isEven(0));     // true (identity)
console.log(isEven(-4));    // true (inverse)

A subgroup H of a group G is a nonempty subset of G that is closed under the group operation and taking inverses, making H a group in its own right with the inherited operation. Equivalently, H is a subgroup if and only if for all a, b in H, the element ab⁻¹ is also in H (the one-step subgroup test). Every group has at least two subgroups: the trivial subgroup containing only the identity and the group itself, both called improper subgroups.

Sequenceprecalculus

An ordered list of numbers following a pattern.

// Define a sequence explicitly and recursively
const explicit = n => 2 * n + 1; // 3, 5, 7, 9, ...
const recursive = [1];
for (let i = 1; i < 6; i++) recursive.push(recursive[i-1] + 2);
console.log(Array.from({length: 6}, (_, i) => explicit(i + 1)));
console.log(recursive);

A sequence is an ordered list of numbers, called terms, that follow a defined pattern or rule. Each term has a position index, typically starting at 1. Sequences can be defined explicitly with a formula for the nth term or recursively where each term depends on previous terms.

Singular Value Decomposition (SVD)linear algebra

Factoring any matrix as A = U*S*V^T where U and V are orthogonal and S is diagonal.

// SVD conceptual example: a rank-1 matrix A = u * s * v^T
const u = [1, 0];
const s = 5;
const v = [0.6, 0.8];
const A = u.map(ui => v.map(vj => ui * s * vj));
console.log('Rank-1 matrix:', A); // [[3,4],[0,0]]

The Singular Value Decomposition expresses any m-by-n matrix A as the product U*S*V^T, where U is an m-by-m orthogonal matrix, S is an m-by-n diagonal matrix of nonnegative singular values, and V is an n-by-n orthogonal matrix. The singular values reveal the rank and conditioning of A. SVD is the foundation of many applications including PCA, pseudoinverse computation, and low-rank matrix approximation.

T
Try/Catchprogramming foundations

A control structure that catches errors and prevents them from crashing the program.

try {
  riskyOperation();
} catch (error) {
  console.log(error.message);
} finally {
  cleanup();
}

try/catch (try/except in Python) wraps code that might throw an error. If an error occurs in the try block, execution jumps to the catch block, which receives the error object. This prevents the error from propagating up and crashing the program. The optional finally block runs regardless of whether an error occurred.

Throwprogramming foundations

A statement that creates and signals an error for callers to handle.

function divide(a, b) {
  if (b === 0) throw new Error("Division by zero");
  return a / b;
}

The throw statement (raise in Python) creates an error and transfers control to the nearest catch block. You throw errors to signal that something invalid happened — bad input, violated preconditions, impossible state. Callers use try/catch to handle thrown errors. Throwing is how functions communicate failure to their callers.

Template Literalprogramming foundations

A string using backticks that supports embedded expressions with ${...}.

const name = "Alice";
console.log(`Hello, ${name}!`);
// Python: f"Hello, {name}!"

Template literals (JS) or f-strings (Python) allow embedding expressions directly inside strings. In JavaScript, they use backticks and ${expression} syntax. In Python, f-strings use f"text {expression}". They support multi-line strings and make string interpolation much cleaner than concatenation.

Time Complexitydata structures algorithms

A measure of how an algorithm's runtime grows as input size increases.

// O(n) — linear
for (let i = 0; i < n; i++) { }

// O(n²) — quadratic
for (let i = 0; i < n; i++)
  for (let j = 0; j < n; j++) { }

Time complexity describes the relationship between input size (n) and the number of operations an algorithm performs. Expressed using Big O notation, it abstracts away constants and lower-order terms to focus on growth rate. Common complexities: O(1) constant, O(log n) logarithmic, O(n) linear, O(n log n) linearithmic, O(n²) quadratic.

Two-Pointer Techniquedata structures algorithms

Using two indices that move through an array to solve problems efficiently.

function twoSum(arr, target) {
  let l = 0, r = arr.length - 1;
  while (l < r) {
    const sum = arr[l] + arr[r];
    if (sum === target) return [l, r];
    sum < target ? l++ : r--;
  }
}

The two-pointer technique uses two indices (often starting at opposite ends) that move toward each other based on conditions. It reduces O(n²) brute-force to O(n). Common uses: finding pairs that sum to a target in a sorted array, removing duplicates, and palindrome checking.

Treedata structures algorithms

A hierarchical data structure with a root node and child nodes forming branches.

       A        ← root
      / \
     B   C      ← children of A
    / \
   D   E        ← leaves

A tree is a connected, acyclic graph with a designated root node. Each node has zero or more children. Trees model hierarchical data: file systems, DOM, organization charts, and decision trees. Key terms: root (top), leaf (no children), depth (distance from root), height (longest path to leaf).

Tree Traversaldata structures algorithms

Visiting every node in a tree in a specific order.

// In-order: 1, 3, 6, 8, 10, 14
// Pre-order: 8, 3, 1, 6, 10, 14
// Post-order: 1, 6, 3, 14, 10, 8

Tree traversal visits all nodes systematically. In-order (left, root, right): gives sorted order for BSTs. Pre-order (root, left, right): useful for copying trees. Post-order (left, right, root): useful for deletion. Level-order (BFS): visits nodes level by level using a queue.

Threadoperating systems

A lightweight unit of execution within a process that shares memory with other threads.

// JavaScript Web Worker (thread-like)
const worker = new Worker('task.js');
worker.postMessage(data);
worker.onmessage = (e) => console.log(e.data);

A thread is a sequence of instructions within a process. Multiple threads in the same process share memory, file handles, and code. Threads are lighter than processes — creating and switching between threads is faster. However, shared memory requires synchronization to avoid race conditions.

Thread Safetyoperating systems

Code that works correctly when called from multiple threads simultaneously.

// NOT thread-safe: count++ is read-modify-write
// Thread-safe: use atomic or mutex
let count = 0;
mutex.lock();
count++;
mutex.unlock();

Thread-safe code produces correct results regardless of how threads are scheduled. Achieved through: immutable data, synchronization (locks/mutexes), atomic operations, or thread-local storage. Race conditions occur when thread-unsafe code is accessed concurrently.

TCPnetworking

A reliable, ordered, connection-oriented transport protocol.

// TCP three-way handshake
Client → SYN → Server
Client ← SYN-ACK ← Server
Client → ACK → Server
// Connection established

TCP (Transmission Control Protocol) guarantees reliable, ordered delivery of data. It establishes a connection via three-way handshake (SYN, SYN-ACK, ACK), detects lost packets and retransmits them, and controls flow to prevent overwhelming receivers. Used for HTTP, email, file transfer — anything requiring reliable delivery.

TLSnetworking

A protocol that encrypts communication between client and server.

https://example.com  ← TLS encrypted
http://example.com   ← NOT encrypted

// TLS handshake: ~1-2 round trips
// Then all data is encrypted

TLS (Transport Layer Security) encrypts data in transit. HTTPS = HTTP + TLS. The TLS handshake: client hello → server certificate → key exchange → encrypted session. TLS uses asymmetric encryption (public/private keys) for key exchange and symmetric encryption (AES) for data transfer. Certificates are issued by Certificate Authorities (CAs).

Throughputnetworking

The number of operations or amount of data processed per unit of time.

// A server handling 10,000 requests/second
// Each with 50ms latency
// Throughput: 10,000 rps
// Latency: 50ms p50

Throughput measures volume over time: requests per second, transactions per minute, or megabytes per second. High throughput ≠ low latency — a batch system can have high throughput but high latency. Throughput is often the key metric for server capacity planning.

Transactiondatabases

A group of database operations that succeed or fail as a single unit.

BEGIN;
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
COMMIT;  -- both succeed or both fail

A transaction groups multiple operations into one atomic unit. Either all operations succeed (COMMIT) or none do (ROLLBACK). The classic example: transferring money requires debiting one account and crediting another — both must happen or neither. Transactions ensure data consistency even during crashes or concurrent access.

Transformerdeep learning llms

A neural network architecture based on self-attention, powering modern LLMs.

# Transformer block
x → Multi-Head Attention → Add & Norm
  → Feed-Forward Network → Add & Norm
  → output

# GPT-4: ~100+ transformer blocks

The transformer architecture (2017) uses self-attention to process all input tokens in parallel rather than sequentially (like RNNs). Each transformer block has multi-head attention + feed-forward network + residual connections + layer normalization. GPT, BERT, and all modern LLMs are built on transformers.

Table Relationdatabases

A table in the relational model, representing a set of related data as rows and columns.

CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT UNIQUE NOT NULL
);

In relational database theory, a relation is a table — a set of tuples (rows) sharing the same attributes (columns). The term 'relation' is why we call them relational databases.

Table Relationshipdatabases

A connection between two tables established through foreign keys.

CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT);
CREATE TABLE orders (
  id SERIAL PRIMARY KEY,
  user_id INT REFERENCES users(id),
  total DECIMAL
);

Table relationships link data across tables using foreign keys. The three types are: one-to-one, one-to-many, and many-to-many (via a junction table).

Token Bucketdistributed systems

A rate-limiting algorithm that allows bursts by accumulating tokens over time.

class TokenBucket {
  constructor(rate, capacity) {
    this.tokens = capacity;
    setInterval(() => {
      this.tokens = Math.min(capacity, this.tokens + rate);
    }, 1000);
  }
  allow() { return this.tokens-- > 0; }
}

The token bucket algorithm controls request rate by maintaining a bucket that fills with tokens at a fixed rate. Each request consumes one token; if empty, the request is rejected. The bucket capacity allows short bursts.

Transport Protocolnetworking

A protocol governing how data is transmitted between hosts across a network.

// TCP: reliable (HTTP, email, files)
const net = require('net');
// UDP: fast (DNS, gaming, streaming)
const dgram = require('dgram');

Transport protocols manage end-to-end data delivery. TCP provides reliable, ordered delivery. UDP provides fast, unordered delivery with no guarantees.

Train-Test Splitmachine learning

Dividing a dataset into separate portions for training and evaluating a model.

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, random_state=42
)

A train-test split partitions data so the model trains on one portion and is evaluated on a held-out portion. Typical: 80% train / 20% test.

Tokenizationdeep learning llms

Splitting text into smaller units (tokens) that a model can process numerically.

text = 'Hello world!'
tokens = tokenizer.encode(text)  # [15496, 995, 0]
tokenizer.decode([15496, 995, 0])  # 'Hello world!'

Tokenization converts raw text into integer token IDs from a fixed vocabulary. Modern LLMs use subword tokenization (BPE or SentencePiece).

Transfer Learningdeep learning llms

Reusing a model trained on one task as the starting point for a different task.

model = load_pretrained('gpt-base')
model.train(medical_qa_dataset)  # only 10K examples

Transfer learning leverages knowledge from pretraining and applies it to a smaller, specific dataset. Foundation models transfer general knowledge to specialized applications.

Transistorcomputer hardware

A tiny electronic switch that is the fundamental building block of all digital circuits.

// A transistor is either on (1) or off (0)
// Billions of them form logic gates
// Logic gates form arithmetic circuits
// Arithmetic circuits form a CPU

A transistor is a semiconductor device that acts as a switch or amplifier. In digital circuits, it represents a binary state: on (1) or off (0). Modern CPUs contain billions of transistors.

Translationgeometry

A transformation that slides every point of a figure the same distance in the same direction.

const translate = (point, dx, dy) => ({
  x: point.x + dx,
  y: point.y + dy
});
translate({ x: 1, y: 2 }, 3, -1); // { x: 4, y: 1 }

A translation is a rigid transformation that moves every point of a figure by the same displacement vector (dx, dy). It preserves size, shape, and orientation. A point (x, y) translated by vector (dx, dy) maps to (x + dx, y + dy). Translations can be combined: applying translation (a, b) followed by (c, d) equals a single translation (a + c, b + d).

Trianglegeometry

A polygon with exactly three sides and three angles.

const triangleArea = (base, height) => 0.5 * base * height;
triangleArea(6, 4); // 12

A triangle is the simplest polygon, consisting of three sides and three interior angles that always sum to 180 degrees. Triangles are classified by sides (equilateral, isosceles, scalene) and by angles (acute, right, obtuse). The area is A = (1/2) * base * height. Key theorems include the Pythagorean theorem (for right triangles), the triangle inequality, and the law of sines and cosines.

Triangle Inequalitygeometry

The rule that the sum of any two sides of a triangle must be greater than the third side.

const canFormTriangle = (a, b, c) =>
  a + b > c && a + c > b && b + c > a;
canFormTriangle(3, 4, 5); // true
canFormTriangle(1, 2, 10); // false

The triangle inequality theorem states that for any triangle with sides a, b, and c, all three conditions must hold: a + b > c, a + c > b, and b + c > a. Equivalently, the longest side must be less than the sum of the other two. This is both a necessary and sufficient condition: three positive lengths can form a triangle if and only if they satisfy the triangle inequality.

Tautologylogic proofs

A compound proposition that is true under every possible truth assignment.

// P OR (NOT P) is always true
const tautology = (p) => p || !p;
tautology(true);  // true
tautology(false); // true

A tautology is a logical statement that is true regardless of the truth values of its component propositions. The simplest example is P OR NOT P (the law of excluded middle). Tautologies are important because they represent universally valid logical principles. Two propositions are logically equivalent if and only if their biconditional is a tautology.

Theoremlogic proofs

A mathematical statement that has been proven true by logical deduction from axioms and previously established results.

A theorem is a statement that has been rigorously proven to be true using logical reasoning from axioms, definitions, and previously established theorems. The proof constitutes a finite sequence of logical steps, each justified by an axiom, definition, or inference rule. Related terms include lemma (a helper theorem used to prove a larger result) and corollary (a theorem that follows easily from another).

Truth Tablelogic proofs

A table listing all possible combinations of truth values for a proposition's variables and the resulting truth value.

// Truth table for P AND Q
const truthTable = [
  { P: true,  Q: true,  result: true },
  { P: true,  Q: false, result: false },
  { P: false, Q: true,  result: false },
  { P: false, Q: false, result: false }
];

A truth table systematically enumerates every possible combination of truth values for the input variables of a logical expression and shows the resulting truth value for each combination. For n variables, the table has 2^n rows. Truth tables can determine whether a proposition is a tautology, contradiction, or contingency, and whether two propositions are logically equivalent.

Tangenttrigonometry

A trigonometric function equal to the ratio of sine to cosine.

Math.tan(0);            // 0
Math.tan(Math.PI / 4);  // ~1
Math.tan(Math.PI / 3);  // ~1.732

Tangent is a trigonometric function defined as tan(theta) = sin(theta) / cos(theta). In a right triangle, it is the ratio of the opposite side to the adjacent side. Tangent is periodic with period pi, is an odd function, and is undefined at angles where cos(theta) = 0 (i.e., at pi/2 + n*pi for integer n). Its range is all real numbers, and it has vertical asymptotes at the points of discontinuity.

Trigonometric Identitytrigonometry

An equation involving trigonometric functions that is true for all values in its domain.

// Verify: tan(x) = sin(x) / cos(x)
const x = 0.8;
const lhs = Math.tan(x);
const rhs = Math.sin(x) / Math.cos(x);
Math.abs(lhs - rhs) < 1e-10; // true

A trigonometric identity is an equation that holds true for every value of the variable for which both sides are defined. Key categories include Pythagorean identities (sin^2 + cos^2 = 1), reciprocal identities (csc = 1/sin), quotient identities (tan = sin/cos), angle addition formulas, double angle formulas, and half-angle formulas. Identities are used to simplify expressions, solve equations, and prove other mathematical results.

Tangent Linecalculus

A straight line that touches a curve at a single point and matches its slope there.

// Tangent line to f(x) = x^2 at x = 3
// f(3) = 9, f'(3) = 6
// y = 9 + 6(x - 3) = 6x - 9
function tangentLine(x) {
  return 6 * x - 9;
}
console.log(tangentLine(3));   // 9 (touches curve)
console.log(tangentLine(3.1)); // 9.6 (approximates f(3.1)=9.61)

The tangent line to the graph of f at x = a is the line passing through (a, f(a)) with slope f'(a). Its equation is y = f(a) + f'(a)(x - a). The tangent line represents the best linear approximation of the function near that point, and its slope is the instantaneous rate of change of the function at x = a.

Taylor Polynomialcalculus 2

A finite-degree polynomial that approximates a function near a given point using its derivatives.

// Taylor polynomial for cos(x) centered at 0, degree 8
function cosTaylor(x, degree) {
  let sum = 0, factorial = 1;
  for (let n = 0; n <= degree; n += 2) {
    if (n > 0) factorial *= n * (n - 1);
    sum += ((-1) ** (n / 2)) * Math.pow(x, n) / factorial;
  }
  return sum;
}
console.log(cosTaylor(1, 8));  // ~0.5403
console.log(Math.cos(1));       // 0.5403...

The nth-degree Taylor polynomial of f(x) centered at x = a is T_n(x) = sum of f^(k)(a)/k! * (x - a)^k for k = 0 to n. It provides the best polynomial approximation of degree n near x = a in the sense that it matches f and its first n derivatives at that point. The Taylor remainder theorem gives bounds on the error |f(x) - T_n(x)| in terms of the (n+1)th derivative.

Taylor Seriescalculus 2

An infinite series representation of a function using its derivatives at a single point.

// Taylor series for sin(x) centered at 0
function sinTaylor(x, terms) {
  let sum = 0, factorial = 1;
  for (let n = 0; n < terms; n++) {
    const k = 2 * n + 1;
    if (n > 0) factorial *= k * (k - 1);
    sum += ((-1) ** n) * Math.pow(x, k) / factorial;
  }
  return sum;
}
console.log(sinTaylor(Math.PI / 4, 10)); // ~0.7071
console.log(Math.sin(Math.PI / 4));       // 0.7071...

The Taylor series of a function f(x) centered at x = a is the power series sum of f^(n)(a)/n! * (x - a)^n for n = 0 to infinity. If f is infinitely differentiable and the remainder term approaches zero, the Taylor series converges to f(x) within some radius of convergence. Taylor series unify polynomial approximation, providing exact representations of functions like e^x, sin(x), and cos(x) on their entire domains.

Trigonometric Substitutioncalculus 2

An integration technique that uses trigonometric identities to simplify integrals involving square roots of quadratic expressions.

// Integral of sqrt(1 - x^2) from 0 to 1 = pi/4 (quarter circle)
// Trig sub: x = sin(t), dx = cos(t)dt, sqrt(1-x^2) = cos(t)
function integrate(f, a, b, n) {
  const dx = (b - a) / n;
  let sum = 0;
  for (let i = 0; i < n; i++) sum += f(a + (i + 0.5) * dx) * dx;
  return sum;
}
console.log(integrate(x => Math.sqrt(1 - x*x), 0, 1, 10000));
// ~ 0.7854 = pi/4

Trigonometric substitution replaces the variable x with a trigonometric expression to eliminate square roots of quadratic forms: for sqrt(a^2 - x^2), use x = a*sin(theta); for sqrt(a^2 + x^2), use x = a*tan(theta); for sqrt(x^2 - a^2), use x = a*sec(theta). These substitutions exploit Pythagorean identities to transform the integral into a trigonometric integral, which is then evaluated using standard techniques.

Total Derivativemultivariable calc

The best linear approximation to a multivariable function at a point, encoded as a linear map (or its matrix, the Jacobian).

// Total derivative of f(x,y) at a point is [∂f/∂x, ∂f/∂y]
const Df = [df_dx, df_dy];

The total derivative of f at a point a is the linear map Df(a) such that f(a + h) = f(a) + Df(a)h + o(|h|). For scalar-valued functions, it is represented by the gradient row vector. Unlike partial derivatives, the total derivative captures the function's full infinitesimal behavior in all directions simultaneously and is the key concept for the multivariable chain rule.

Triple Integralmultivariable calc

An integral that computes the accumulated value of a function over a three-dimensional region.

// Approximate triple integral via Riemann sum
let sum = 0;
for (let i = 0; i < n; i++)
  for (let j = 0; j < n; j++)
    for (let k = 0; k < n; k++)
      sum += f(x[i], y[j], z[k]) * dx * dy * dz;

The triple integral ∭_E f(x, y, z) dV sums the values of f over a solid region E in three-dimensional space. It can represent volume, mass, charge, or other quantities depending on the integrand. Evaluation uses iterated integrals, and changing to cylindrical or spherical coordinates often simplifies the computation when the region has appropriate symmetry.

Transfer Functiondifferential equations

The ratio of the Laplace transform of a system's output to its input, assuming zero initial conditions.

// Transfer function H(s) = 1/(s^2 + 3s + 2) = 1/((s+1)(s+2))
// Poles at s = -1 and s = -2 (stable system)
const poles = [-1, -2];
console.log('Poles:', poles);
console.log('System is stable:', poles.every(p => p < 0));

The transfer function H(s) = Y(s)/X(s) characterizes a linear time-invariant system entirely in the frequency domain, encapsulating its input-output relationship as a rational function of s. Poles of H(s) determine stability and natural response modes, while zeros shape the frequency response and transient behavior. Transfer functions are central to control theory, signal processing, and the design of feedback systems.

Tabular Methodcalculus 2

A systematic shortcut for repeated integration by parts using alternating signs.

The tabular method (also known as the tabular integration or DI method) organizes repeated integration by parts into a table with columns for derivatives, integrals, and alternating signs. It is especially useful when one factor eventually differentiates to zero, such as integrating a polynomial times an exponential or trigonometric function.

Transposelinear algebra

Flipping a matrix over its diagonal, so rows become columns: (A^T)_{ij} = A_{ji}.

// Transpose a 2x3 matrix to a 3x2 matrix
const A = [[1, 2, 3], [4, 5, 6]];
const T = A[0].map((_, j) => A.map(row => row[j]));
console.log('Transpose:', T); // [[1,4],[2,5],[3,6]]

The transpose of a matrix A, written A^T, is obtained by interchanging its rows and columns so that the entry in row i, column j of A becomes the entry in row j, column i of A^T. Transposition is fundamental to many operations: a matrix is symmetric when A^T = A, and orthogonal when A^T*A = I. The transpose also appears in the definition of the dot product as a matrix multiplication.

U
Uniqueness Constraintdata structures algorithms

A requirement that no duplicate values exist in a collection.

// Deduplicate with Set
const unique = [...new Set([1,1,2,2,3])];
// [1, 2, 3]

A uniqueness constraint ensures all elements in a collection are distinct. Sets enforce uniqueness automatically. In databases, UNIQUE constraints prevent duplicate values in a column. Checking uniqueness with an array is O(n²); with a set it's O(n).

UDPnetworking

A fast, unreliable, connectionless transport protocol.

// UDP: fire and forget
Client → [packet 1] → Server
Client → [packet 2] → Server (may arrive first!)
Client → [packet 3] → ??? (may be lost!)

UDP (User Datagram Protocol) sends packets without establishing a connection. No guarantees of delivery, ordering, or duplicate protection. Much faster and lower overhead than TCP. Used for video streaming, online gaming, DNS lookups, and VoIP — where speed matters more than reliability.

Underfittingmachine learning

When a model is too simple to capture the underlying patterns in the data.

# Training accuracy: 55%, Test accuracy: 52%
# Both low = underfitting!
model = RandomForestClassifier(n_estimators=100)

An underfit model performs poorly on both training and test data. Fixes: use a more complex model, add more features, train longer, reduce regularization.

Unsupervised Learningmachine learning

Training a model on data without labels to discover hidden patterns or structure.

from sklearn.cluster import KMeans
kmeans = KMeans(n_clusters=3)
kmeans.fit(customer_data)
groups = kmeans.labels_

Unsupervised learning finds patterns without predefined labels. Clustering groups similar data. Dimensionality reduction compresses data. Anomaly detection finds outliers.

Universal Quantifierlogic proofs

A logical symbol asserting that a predicate holds for every element in the domain.

const numbers = [2, 4, 6, 8];
// "For all n in numbers, n is even"
numbers.every(n => n % 2 === 0); // true

The universal quantifier (denoted by the symbol 'for all') asserts that a predicate P(x) is true for every element x in the domain of discourse. The statement 'for all x, P(x)' is true only if P(x) holds for every single x. To disprove a universally quantified statement, a single counterexample suffices. The negation of a universal statement is existential: NOT(for all x, P(x)) = there exists x such that NOT P(x).

Unit Circletrigonometry

A circle with radius 1 centered at the origin, used to define trigonometric functions for all angles.

// Point on unit circle at angle theta
const unitCirclePoint = (theta) => ({
  x: Math.cos(theta),
  y: Math.sin(theta)
});
unitCirclePoint(Math.PI / 4); // { x: ~0.707, y: ~0.707 }

The unit circle is a circle of radius 1 centered at the origin (0, 0) in the coordinate plane, described by the equation x^2 + y^2 = 1. For any angle theta measured counterclockwise from the positive x-axis, the point (cos(theta), sin(theta)) lies on the unit circle. This construction extends the definition of sine and cosine beyond acute angles to all real numbers and directly yields the Pythagorean identity.

U-Substitutioncalculus

An integration technique that reverses the chain rule by substituting a new variable.

// Integral of 2x * e^(x^2) dx
// Let u = x^2, du = 2x dx
// Integral becomes e^u du = e^u + C = e^(x^2) + C
function antiderivative(x) {
  return Math.exp(x * x);
}
console.log(antiderivative(1)); // e^1 = 2.718...

U-substitution simplifies an integral by letting u = g(x), so du = g'(x) dx. The integral of f(g(x)) * g'(x) dx becomes the integral of f(u) du, which is often easier to evaluate. After integrating with respect to u, you substitute back to express the result in terms of x. It is the most commonly used integration technique.

Upper and Lower Functionscalculus

In an area-between-curves problem, the function on top and the function on bottom over a given interval.

// Between f(x)=4-x^2 and g(x)=x^2 on [-sqrt(2), sqrt(2)]
// f is upper, g is lower in this interval
const a = -Math.SQRT2, b = Math.SQRT2;
const n = 10000, dx = (b - a) / n;
let area = 0;
for (let i = 0; i < n; i++) {
  const x = a + (i + 0.5) * dx;
  area += ((4 - x*x) - (x*x)) * dx; // upper - lower
}
console.log(area.toFixed(4)); // ~7.5425

When computing the area between two curves, the upper function is the one with greater y-values and the lower function has lesser y-values on the interval. The area equals the integral of (upper - lower). Which function is upper vs. lower may switch at intersection points, requiring the integral to be split into separate pieces at those points.

Uniform Continuityreal analysis

Continuity where a single delta works for all points simultaneously, not just at each individual point.

// f(x) = x^2 is NOT uniformly continuous on R
// but IS uniformly continuous on [0, 1]
function testUniformCont(f, a, b, epsilon) {
  // Find delta that works for all points in [a,b]
  const delta = epsilon / (2 * Math.max(Math.abs(a), Math.abs(b)));
  let works = true;
  for (let x = a; x <= b; x += 0.01)
    for (let y = x; y <= Math.min(x+delta, b); y += 0.001)
      if (Math.abs(f(x)-f(y)) >= epsilon) works = false;
  return { delta, works };
}
console.log(testUniformCont(x => x*x, 0, 1, 0.1));

A function f on a set S is uniformly continuous if for every epsilon > 0, there exists a delta > 0 such that for all x, y in S with |x - y| < delta, |f(x) - f(y)| < epsilon. Unlike pointwise continuity, delta depends only on epsilon, not on the particular point. By the Heine-Cantor theorem, every continuous function on a closed bounded interval is uniformly continuous.

Upper and Lower Sumsreal analysis

Sums using supremum and infimum of a function on partition subintervals, bounding the integral from above and below.

// Upper and lower sums for f(x) = x on [0, 1]
function darbouxSums(f, a, b, n) {
  const dx = (b - a) / n;
  let upper = 0, lower = 0;
  for (let i = 0; i < n; i++) {
    const left = f(a + i * dx);
    const right = f(a + (i+1) * dx);
    upper += Math.max(left, right) * dx;
    lower += Math.min(left, right) * dx;
  }
  return { upper, lower, diff: upper - lower };
}
console.log(darbouxSums(x => x, 0, 1, 100)); // both ~0.5

For a bounded function f on [a, b] and a partition P = {x_0, ..., x_n}, the upper sum is U(f, P) = sum of sup{f(x) : x in [x_{i-1}, x_i]} * (x_i - x_{i-1}), and the lower sum is L(f, P) = sum of inf{f(x) : x in [x_{i-1}, x_i]} * (x_i - x_{i-1}). The upper sum overestimates and the lower sum underestimates the true integral. A function is Riemann integrable precisely when the infimum of upper sums equals the supremum of lower sums.

UV Formulacalculus 2

The integration by parts formula: integral of u dv = uv - integral of v du.

// Integration by parts: integral of x*e^x dx
// Let u = x, dv = e^x dx
// Then du = dx, v = e^x
// Result: x*e^x - integral(e^x dx) = x*e^x - e^x + C

The UV formula, or integration by parts, is derived from the product rule for differentiation. It states that the integral of u dv equals uv minus the integral of v du. Choosing u and dv strategically (often guided by the LIATE rule) simplifies the resulting integral. This technique is essential for integrating products of functions.

V
Variableprogramming foundations

A named storage location that holds a value.

let name = "Alice";
let age = 30;

A variable is a named reference to a location in memory where a value is stored. Variables allow programs to remember and manipulate data. In JavaScript, variables are declared with `let`, `const`, or `var`. In Python, variables are created by assignment.

Variable Shadowingprogramming foundations

When an inner scope declares a variable with the same name as one in an outer scope.

let x = 10; // outer
function foo() {
  let x = 20; // shadows outer x
  console.log(x); // 20
}
foo();
console.log(x); // 10 (unchanged)

Variable shadowing occurs when a variable in an inner scope has the same name as a variable in an outer scope. The inner variable 'shadows' the outer one — within the inner scope, the inner variable is used. The outer variable is not modified or affected. This can be intentional but often indicates a naming problem.

Vertex & Edgedata structures algorithms

Vertices are nodes in a graph; edges are connections between them.

// Vertices: A, B, C
// Edges: A-B, B-C, A-C
// Directed edge: A → B (one way)
// Weighted edge: A →(5)→ B

A vertex (node) represents an entity. An edge represents a relationship between two vertices. In a directed graph, edges have direction (A→B). In an undirected graph, edges go both ways. Edges can have weights (costs/distances). The degree of a vertex is the number of edges connected to it.

Virtual Memoryoperating systems

An abstraction giving each process the illusion of a large, contiguous address space.

// Each process sees addresses 0x0000 to 0xFFFF...
// OS maps virtual → physical via page table
// Virtual 0x1000 → Physical 0x5000

Virtual memory maps each process's virtual addresses to physical memory through page tables. Each process thinks it has the entire address space. The OS loads pages on demand and can swap unused pages to disk. This provides isolation (processes can't access each other's memory) and allows running programs larger than physical RAM.

Vector (Math)mathematics

An ordered list of numbers representing a point or direction in space.

import numpy as np
v1 = np.array([1, 2, 3])
v2 = np.array([4, 5, 6])
v1 + v2        # [5, 7, 9]
np.dot(v1, v2) # 32

A vector is an array of numbers with mathematical operations: addition, scalar multiplication, dot product. In ML, feature vectors represent data points. In NLP, word embeddings are vectors. Vector dimensions can be 2D (x,y), 3D (x,y,z), or high-dimensional (768D embeddings).

Vertical Scalingsystem design

Adding more CPU, RAM, or storage to a single machine to handle more load.

// 2 CPU, 4 GB RAM -> 1,000 rps
// 8 CPU, 32 GB RAM -> 5,000 rps
// 64 CPU, 256 GB RAM -> 20,000 rps (ceiling)

Vertical scaling increases the power of one server. Simple — no code changes needed. But it has a ceiling and creates a single point of failure.

Validation Setmachine learning

A held-out data portion used to tune hyperparameters during model development.

X_train, X_temp, y_train, y_temp = train_test_split(X, y, test_size=0.4)
X_val, X_test, y_val, y_test = train_test_split(X_temp, y_temp, test_size=0.5)

A validation set is separate from both training and test sets, used for hyperparameter tuning. Typical split: 60% train / 20% validation / 20% test.

Vector Databasedeep learning llms

A database optimized for storing and searching high-dimensional embedding vectors.

db.insert(id='doc1', vector=embed('Python tutorial'))
results = db.search(query=embed('programming intro'), top_k=5)

A vector database indexes embedding vectors for fast nearest-neighbor search. Algorithms like HNSW enable approximate search across millions of entries. Examples: Pinecone, Weaviate, pgvector.

Vector Spacedeep learning llms

A mathematical space where data points are represented as vectors with distance and direction.

# 'king' -> [0.9, 0.1], 'queen' -> [0.8, 0.2]
# cosine_sim(king, queen) = 0.98

A vector space is a multi-dimensional coordinate system where each point is a vector. In ML, embeddings map items into a vector space where geometric relationships encode semantic meaning.

Variancemathematics

The average of squared differences from the mean, measuring data spread.

const data = [2, 4, 4, 4, 5, 5, 7, 9];
const mean = 5;
const variance = data.reduce((s, x) => s + (x - mean) ** 2, 0) / data.length;

Variance = sum((xi - mean)^2) / n. Squaring ensures negative and positive deviations don't cancel out. Square root of variance gives standard deviation.

Variable (Mathematics)algebra

A symbol, usually a letter, that represents an unknown or changeable quantity in a mathematical expression.

// In algebra, x is a variable to solve for:
// 2x + 3 = 11 => x = 4
let x = 4;
console.log(2 * x + 3 === 11);  // true

In mathematics, a variable is a letter (such as x, y, or n) used to represent an unknown value that can change or that you need to solve for. Variables allow generalizing mathematical relationships: the equation A = l × w uses variables to express that area equals length times width for any rectangle. Variables can represent a single unknown value (in equations) or a range of values (in functions).

Volumegeometry

The measure of the three-dimensional space enclosed by a solid.

const boxVolume = (l, w, h) => l * w * h;
const sphereVolume = (r) => (4/3) * Math.PI * r ** 3;

Volume quantifies the amount of three-dimensional space inside a solid, measured in cubic units. Common formulas include: rectangular prism V = l * w * h, cylinder V = pi * r^2 * h, sphere V = (4/3) * pi * r^3, and cone V = (1/3) * pi * r^2 * h. Volume scales with the cube of the linear scale factor: doubling all dimensions multiplies volume by 8.

Vertical and Horizontal Asymptoteprecalculus

Vertical asymptotes occur where the function diverges to infinity; horizontal asymptotes describe the value the function approaches as x → ±∞.

// f(x) = (2x + 1) / (x - 3)
// Vertical asymptote: x = 3, Horizontal asymptote: y = 2
const f = x => (2*x + 1) / (x - 3);
console.log(f(3.001));   // ≈ 2001 — near vertical asymptote
console.log(f(1000000)); // ≈ 2    — approaching horizontal asymptote
console.log('VA: x = 3, HA: y = 2');

A vertical asymptote is a vertical line x = a where the function grows without bound (approaches +∞ or −∞) because the denominator approaches zero while the numerator does not. A horizontal asymptote is a horizontal line y = L that the function approaches as x → +∞ or x → −∞. For a rational function p(x)/q(x), vertical asymptotes occur at zeros of q(x) not canceled by p(x), and the horizontal asymptote depends on the degrees of p and q: if deg(p) < deg(q), y = 0; if deg(p) = deg(q), y = leading coefficient ratio; if deg(p) > deg(q), there is no horizontal asymptote.

Vector Fieldmultivariable calc

A function that assigns a vector to every point in a region of space.

// A 2D vector field F(x, y) = (-y, x)
function F(x, y) {
  return [-y, x];
}

A vector field F: Rⁿ → Rⁿ associates a vector with each point in its domain, such as F(x, y) = (P(x,y), Q(x,y)) in two dimensions. Vector fields model velocity, force, electric and magnetic fields, and many other physical quantities. Key properties include divergence (source/sink behavior), curl (rotational behavior), and whether the field is conservative (gradient of a scalar potential).

Volume Integralmultivariable calc

A triple integral used specifically to compute the volume of a three-dimensional solid or to integrate a density over a volume.

// Volume of a sphere via integration concept
// V = ∫∫∫ ρ² sin(φ) dρ dφ dθ
const V = (4/3) * Math.PI * R**3;

A volume integral is a triple integral where the integrand represents a volumetric quantity such as density, energy density, or simply 1 (to compute volume). When using cylindrical coordinates, the volume element becomes r dr dθ dz; in spherical coordinates, it becomes ρ² sin(φ) dρ dφ dθ. The Jacobian determinant of the coordinate transformation accounts for the distortion of volume elements.

Varianceprobability stats

A measure of how spread out the values of a random variable are around the expected value.

// Calculate population and sample variance
const data = [4, 8, 6, 5, 3, 7, 9, 5];
const n = data.length;
const mean = data.reduce((a, b) => a + b) / n;
const popVar = data.reduce((s, x) => s + (x - mean) ** 2, 0) / n;
const samVar = data.reduce((s, x) => s + (x - mean) ** 2, 0) / (n - 1);
console.log(`Population variance: ${popVar.toFixed(3)}`);
console.log(`Sample variance: ${samVar.toFixed(3)}`);
console.log(`Std deviation: ${Math.sqrt(samVar).toFixed(3)}`);

The variance Var(X) = E[(X - μ)²] = E[X²] - (E[X])² measures the average squared deviation from the mean. For a sample, the unbiased estimate uses n-1 in the denominator: s² = Σ(xᵢ - x̄)²/(n-1). The standard deviation σ = √Var(X) is expressed in the same units as the data. Variance is additive for independent random variables: Var(X+Y) = Var(X) + Var(Y), a property critical to the Central Limit Theorem.

Vertex (Graph Theory)discrete math

A fundamental unit (node) in a graph that can be connected to other vertices by edges.

// Vertices with their degrees
const adjList = { A: ['B','C'], B: ['A','C','D'], C: ['A','B'], D: ['B'] };
for (const [v, neighbors] of Object.entries(adjList)) {
  console.log(`${v}: degree ${neighbors.length}`);
}

A vertex (plural: vertices) is a fundamental element of a graph, representing an entity or point. The set of all vertices in a graph G is denoted V(G). The degree of a vertex is the number of edges incident to it. Vertices and edges together define the structure of a graph, and properties like connectivity, paths, and cycles are all expressed in terms of vertex relationships.

Vectorlinear algebra

An ordered list of numbers representing a point or direction in n-dimensional space.

// Create and add two 3D vectors
const a = [1, 2, 3];
const b = [4, 5, 6];
const sum = a.map((val, i) => val + b[i]);
console.log('Sum:', sum); // [5, 7, 9]

In linear algebra, a vector is an ordered list of numbers (components) that can represent a point, a direction, or a displacement in n-dimensional space. Vectors can be added together and scaled by real numbers, and these two operations define a vector space. Vectors are the primary objects of study in linear algebra, serving as inputs and outputs of linear transformations.

W
While Loopprogramming foundations

A loop that runs as long as its condition is true.

let n = 3;
while (n > 0) {
  n--; // 2, 1, 0
}

A while loop continues executing its body as long as its boolean condition evaluates to true. It's used when the number of iterations isn't known in advance. Caution: if the condition never becomes false, the loop runs forever (infinite loop).

WebSocketnetworking

A protocol for full-duplex, persistent communication between client and server.

const ws = new WebSocket('wss://example.com');
ws.onopen = () => ws.send('hello');
ws.onmessage = (e) => console.log(e.data);

WebSockets upgrade an HTTP connection to a persistent, bidirectional channel. Unlike HTTP request/response, either side can send data at any time. Used for real-time applications: chat, live sports scores, collaborative editing, online gaming. Lower overhead than HTTP polling.

Word Embeddingdeep learning llms

A dense vector representation that captures the semantic meaning of a word.

# embed('king') - embed('man') + embed('woman')
# = embed('queen')
# embed('Paris') - embed('France') + embed('Japan')
# = embed('Tokyo')

Word embeddings map each word to a fixed-size vector where similar words have similar vectors. king - man + woman = queen. Modern contextual embeddings produce different vectors based on context.

Working Directorygit version control

The folder on your computer where you edit files before staging them.

// Edit -> working directory (modified)
// git add -> staging area (staged)
// git commit -> repository (committed)

The working directory is where you view and edit project files. Changes are unstaged until you git add them. Git compares your working directory against the last commit.

Work Integralmultivariable calc

A line integral of a force vector field along a path, measuring the total work done by the force on a moving object.

// Work done by constant force F along displacement d
const work = F[0]*d[0] + F[1]*d[1] + F[2]*d[2];

The work integral W = ∫_C F · dr computes the work done by force field F along path C by summing the tangential component of the force times the infinitesimal displacement. If F is conservative (F = ∇f), the work depends only on the endpoints: W = f(b) − f(a). This path independence is a hallmark of conservative fields and connects to the fundamental theorem of line integrals.

Y
Y-Interceptalgebra

The point where a graph crosses the y-axis, occurring when x = 0.

// For y = 3x + 7, the y-intercept is 7
let m = 3, b = 7;
let yIntercept = m * 0 + b;  // 7
// The line crosses the y-axis at (0, 7)

The y-intercept is the point at which a graph intersects the y-axis, found by setting x = 0 in the equation. In slope-intercept form y = mx + b, the y-intercept is the value b, giving the point (0, b). Every non-vertical line has exactly one y-intercept. It represents the initial value or starting point in many real-world applications.