COMPREHENSIVE
Mathematics, Statistics &
Programming
Complete Reference Book
From Algebra to Real Analysis · Python for Data Science · Basic Accounting
26 Chapters · Fully Worked Examples · Practice Problems
Designed for students, self-learners, and aspiring data scientists.
Covers high school through university-level mathematics, statistics,
Python programming, and an introduction to accounting principles.
Table of Contents
PART I: FOUNDATIONS OF MATHEMATICS
Ch. 1 — Algebra
Ch. 2 — Geometry
Ch. 3 — Analytical Geometry
Ch. 4 — Probability
Ch. 5 — Permutation
Ch. 6 — Combination
Ch. 7 — Graphing Equations
Ch. 8 — Vectors
PART II: ADVANCED MATHEMATICS
Ch. 9 — Trigonometry
Ch. 10 — Pre-Calculus ★
Ch. 11 — Basic Calculus ★
Ch. 12 — Calculus II ★
Ch. 13 — Logic and Basic Proofs
Ch. 14 — Linear Algebra
Ch. 15 — Multivariable Calculus
PART III: ANALYSIS
Ch. 16 — Elementary Analysis I
Ch. 17 — Elementary Analysis II
Ch. 18 — Elementary Analysis III
PART IV: STATISTICS
Ch. 19 — Elementary Statistics
Ch. 20 — Descriptive Statistics
Ch. 21 — Basic Statistical Methods
Ch. 22 — Probability Theories
PART V: PROGRAMMING
Ch. 23 — Introduction to Programming (Python)
Ch. 24 — Python for Data Scientists
Ch. 25 — Problems to Solve
PART VI: ACCOUNTING
Ch. 26 — Basic Accounting
PART I
Foundations of Mathematics
Chapters 1–8: Algebra · Geometry · Probability · Vectors
Chapter 1: Algebra
Algebra is the branch of mathematics dealing with symbols and the rules for manipulating those symbols.
It forms the foundation of all higher mathematics.
1.1 Algebraic Manipulation
The basic operations of algebra involve simplifying expressions using properties of real numbers.
• Commutative: a + b = b + a, a · b = b · a
• Associative: (a+b)+c = a+(b+c), (ab)c = a(bc)
• Distributive: a(b+c) = ab + ac
• Identity: a + 0 = a, a · 1 = a
• Inverse: a + (−a) = 0, a · (1/a) = 1 (a ≠ 0)
Example: Simplify 3(x + 2) − 2(x − 1). Solution: 3x + 6 − 2x + 2 = x + 8
1.2 Word Problems
Age Problems
Set up equations based on relationships between ages at different times.
Example: Maria is 3 times as old as her son. In 12 years, she will be twice his age. Find their current
ages. Let son = x, Maria = 3x. Then 3x+12 = 2(x+12) → 3x+12 = 2x+24 → x = 12. Son is 12, Maria is
36.
Work Problems
Combined rate = 1/t_A + 1/t_B → Time together = 1 / (1/t_A + 1/t_B)
Example: A can finish a job in 6 hrs, B in 4 hrs. Together: 1/(1/6 + 1/4) = 1/(5/12) = 12/5 = 2.4 hrs.
Mixture Problems
amount■ · conc■ + amount■ · conc■ = total · conc_final
Example: Mix 30% and 60% acid to get 40 L of 50% acid. Let x = liters of 60%. 0.3(40−x) + 0.6x =
0.5(40) → 12 + 0.3x = 20 → x = 26.67 L.
Distance Problems
distance = rate × time (d = rt)
Example: Two cars start 300 km apart, driving toward each other at 60 and 90 km/h. They meet in t =
300/(60+90) = 2 hrs.
1.3 Exponents
• a^m · a^n = a^(m+n)
• a^m / a^n = a^(m−n)
• (a^m)^n = a^(mn)
• (ab)^n = a^n · b^n
• a^0 = 1 (a ≠ 0)
• a^(−n) = 1/a^n
• a^(1/n) = n-th root of a
Example: Simplify (x^3 · x^(-1))^2 = (x^2)^2 = x^4
1.4 Radicals
n-th root of a = a^(1/n); sqrt(a) · sqrt(b) = sqrt(ab); sqrt(a)/sqrt(b)
= sqrt(a/b)
To rationalize the denominator, multiply numerator and denominator by the conjugate.
Example: Rationalize 1/sqrt(3): multiply by sqrt(3)/sqrt(3) = sqrt(3)/3.
1.5 Rational Equations
Equations involving fractions with variables in the denominator. Always check for extraneous solutions.
Example: Solve 1/x + 1/(x+2) = 5/6. Multiply through by 6x(x+2): 6(x+2) + 6x = 5x(x+2) → 12x+12 =
5x²+10x → 5x²−2x−12=0 → x = (2±sqrt(4+240))/10.
1.6 Linear Equations
ax + b = c → x = (c − b)/a
Systems of linear equations can be solved by substitution, elimination, or matrix methods.
Example: Solve: 2x + 3y = 12, x − y = 1. From eq2: x = y+1. Sub: 2(y+1)+3y=12 → 5y=10 → y=2, x=3.
1.7 Quadratic Equations
ax² + bx + c = 0 → x = (−b ± sqrt(b²−4ac)) / 2a
• Discriminant D = b²−4ac: D>0 two real roots, D=0 one real root, D<0 two complex roots
• Factoring: find two numbers that multiply to ac and add to b
• Completing the square: x² + bx = (x + b/2)² − (b/2)²
Example: Solve x²−5x+6=0. Factor: (x−2)(x−3)=0, x=2 or x=3.
Example: Solve 2x²+3x−2=0 by formula: x=(−3±sqrt(9+16))/4=(−3±5)/4. x=1/2 or x=−2.
1.8 Inequalities
Rules: adding/subtracting preserves direction; multiplying/dividing by a NEGATIVE reverses inequality.
ax + b > c → x > (c−b)/a if a>0, x < (c−b)/a if a<0
Example: Solve 3x − 4 < 11: 3x < 15, x < 5. Solution: (−∞, 5).
1.9 Absolute Values
|x| = a → x = a or x = −a (a ≥ 0)
|x| < a → −a < x < a; |x| > a → x < −a or x > a
Example: Solve |2x−3| ≤ 5: −5 ≤ 2x−3 ≤ 5 → −1 ≤ x ≤ 4.
Chapter 2: Geometry
Geometry studies shapes, sizes, distances, and properties of figures in space.
2.1 Key Formulas: 2D Shapes
<b>Shape</b> <b>Area</b> <b>Perimeter</b>
Rectangle l×w 2(l + w)
Square s² 4s
Triangle (1/2)bh a+b+c
Circle πr² 2πr
Trapezoid (1/2)(b■+b■)h a+b■+c+b■
Parallelogram bh 2(a+b)
Ellipse πab ≈ π[3(a+b)−sqrt((3a+b)(a+3b))]
2.2 Key Formulas: 3D Shapes
<b>Shape</b> <b>Volume</b> <b>Surface Area</b>
Cube s³ 6s²
Rectangular Box lwh 2(lw+lh+wh)
Sphere (4/3)πr³ 4πr²
Cylinder πr²h 2πr²+2πrh
Cone (1/3)πr²h πr²+πrl (l=slant)
Pyramid (1/3)Bh B + lateral faces
2.3 Angles
• Acute: 0° < θ < 90°
• Right: θ = 90°
• Obtuse: 90° < θ < 180°
• Straight: θ = 180°
• Complementary: two angles summing to 90°
• Supplementary: two angles summing to 180°
• Vertical angles (opposite): equal
• Corresponding angles (parallel lines cut by transversal): equal
2.4 Triangle Theorems
Sum of interior angles = 180°
Pythagorean Theorem: a² + b² = c² (right triangle, c = hypotenuse)
• Similar triangles: corresponding sides proportional, angles equal
• Congruent triangles: SSS, SAS, ASA, AAS, HL
• Exterior angle = sum of two non-adjacent interior angles
Example: A right triangle has legs 3 and 4. Hypotenuse = sqrt(9+16) = 5.
Chapter 3: Analytical Geometry
Analytical Geometry (Coordinate Geometry) uses algebra to describe geometric shapes via coordinates.
3.1 The Coordinate Plane
Distance: d = sqrt((x■−x■)² + (y■−y■)²)
Midpoint: M = ((x■+x■)/2, (y■+y■)/2)
Slope: m = (y■−y■)/(x■−x■)
3.2 Lines
• Slope-intercept form: y = mx + b
• Point-slope form: y − y■ = m(x − x■)
• Standard form: Ax + By + C = 0
• Parallel lines: same slope (m■ = m■)
• Perpendicular lines: slopes are negative reciprocals (m■ · m■ = −1)
• Distance from point (x■,y■) to line Ax+By+C=0: |Ax■+By■+C|/sqrt(A²+B²)
3.3 Circles
Center (h,k), radius r: (x−h)² + (y−k)² = r²
General form: x²+y²+Dx+Ey+F=0 → center=(−D/2, −E/2),
r=sqrt(D²/4+E²/4−F)
Example: Circle: x²+y²−4x+6y−3=0. Complete squares: (x−2)²+(y+3)²=16. Center=(2,−3), r=4.
3.4 Conic Sections Overview
• Parabola: y = ax² + bx + c or x = ay² + by + c
• Ellipse: (x−h)²/a² + (y−k)²/b² = 1
• Hyperbola: (x−h)²/a² − (y−k)²/b² = 1
• Circle: special case of ellipse with a = b = r
Note: Conic sections are covered in depth in Chapter 10 (Pre-Calculus).
Chapter 4: Probability
Probability measures the likelihood of an event occurring, ranging from 0 (impossible) to 1 (certain).
4.1 Basic Definitions
P(A) = (Number of favorable outcomes) / (Total outcomes)
• Sample space S: set of all possible outcomes
• Event A: a subset of S
• P(S) = 1; P(∅) = 0; 0 ≤ P(A) ≤ 1
• Complement: P(A') = 1 − P(A)
4.2 Rules of Probability
Addition Rule: P(A∪B) = P(A) + P(B) − P(A∩B)
Mutually Exclusive: P(A∪B) = P(A) + P(B)
Conditional: P(A|B) = P(A∩B)/P(B)
Multiplication Rule: P(A∩B) = P(A|B)·P(B) = P(B|A)·P(A)
Independent events: P(A∩B) = P(A)·P(B)
4.3 Bayes' Theorem
P(A|B) = P(B|A)·P(A) / P(B)
Example: A test is 99% accurate. Disease affects 1% of population. Test is positive —
P(disease|positive)? P(B|A)=0.99, P(A)=0.01, P(B)=0.99×0.01+0.01×0.99=0.0198. P(A|B)≈0.5 (50%)!
Shows importance of base rate.
4.4 Common Distributions
• Binomial: P(X=k) = C(n,k)·p^k·(1−p)^(n−k); mean=np; var=np(1−p)
• Geometric: P(X=k) = (1−p)^(k−1)·p; mean=1/p
• Poisson: P(X=k) = e^(−λ)·λ^k/k!; mean=λ; var=λ
• Hypergeometric: sampling without replacement from finite population
Chapter 5: Permutation
A permutation is an arrangement of objects where ORDER MATTERS.
5.1 Fundamental Counting Principle
If event A has m ways and event B has n ways, together they have m × n
ways.
5.2 Permutation Formulas
P(n,r) = n! / (n−r)! — arranging r objects from n distinct objects
n! = n × (n−1) × (n−2) × ... × 2 × 1; 0! = 1
Permutations with repetition: n^r
Permutations with identical objects: n! / (n■!·n■!·...·n■!)
Circular permutations: (n−1)!
5.3 Examples
Example: How many 3-letter arrangements from {A,B,C,D,E}? P(5,3)=5!/2!=60.
Example: How many ways arrange letters in MISSISSIPPI? 11!/(4!4!2!1!) = 34,650.
Example: How many ways seat 6 people around a round table? (6−1)! = 120.
5.4 Applications
• Passwords and PIN codes (with/without repetition)
• Scheduling tasks in a specific order
• Race finishing orders (1st, 2nd, 3rd place)
• Seating arrangements at a dinner table
Chapter 6: Combination
A combination is a selection of objects where ORDER DOES NOT MATTER.
6.1 Combination Formula
C(n,r) = n! / (r!(n−r)!) also written as C(n,r) or 'n choose r'
C(n,0) = C(n,n) = 1; C(n,1) = n; C(n,r) = C(n,n−r)
6.2 Pascal's Triangle
Each entry = sum of two entries above it. Row n gives coefficients of (a+b)^n.
Row 0: 1 Row 1: 1 1 Row 2: 1 2 1 Row 3: 1 3 3 1 Row 4: 1 4 6 4 1
6.3 Binomial Theorem
(a+b)^n = SUM[k=0 to n] C(n,k)·a^(n−k)·b^k
Example: Expand (x+2)^3 = x^3 + 3·x^2·2 + 3·x·4 + 8 = x^3+6x^2+12x+8.
6.4 Examples
Example: Choose 3 students from 10 for a committee: C(10,3) = 120.
Example: A hand of 5 cards from 52: C(52,5) = 2,598,960.
Example: Probability of exactly 2 heads in 4 flips: C(4,2)/2^4 = 6/16 = 3/8.
Chapter 7: Graphing Equations
Graphing translates algebraic equations into visual curves on the coordinate plane.
7.1 Linear Graphs
• y = mx + b: slope m, y-intercept b
• x-intercept: set y=0, solve for x
• Graph by plotting two points or using slope-intercept method
7.2 Parabolas (Quadratics)
y = ax² + bx + c; vertex at x = −b/(2a)
• a > 0: opens upward; a < 0: opens downward
• Vertex form: y = a(x−h)² + k, vertex = (h,k)
• Axis of symmetry: x = −b/(2a)
• Roots: x-intercepts found by quadratic formula
7.3 Other Common Functions
<b>Function</b> <b>Key Features</b>
y = |x| V-shape, vertex at origin
y = sqrt(x) Domain: x≥0, starts at origin
y = 1/x Hyperbola, asymptotes at x=0, y=0
y = e^x Exponential growth, y-intercept=1
y = ln(x) Domain: x>0, passes through (1,0)
y = sin(x) Period 2π, range [−1,1]
y = cos(x) Period 2π, range [−1,1]
7.4 Transformations
• f(x) + k: vertical shift up k
• f(x) − k: vertical shift down k
• f(x−h): horizontal shift right h
• f(x+h): horizontal shift left h
• −f(x): reflect over x-axis
• f(−x): reflect over y-axis
• af(x): vertical stretch/compress by factor a
• f(bx): horizontal compress/stretch by factor 1/b
Chapter 8: Vectors — Unifying Algebra and
Geometry
Vectors are mathematical objects with both magnitude and direction, bridging algebra and geometry.
8.1 Vector Basics
Vector v = (v■, v■) or v■i + v■j; Magnitude |v| = sqrt(v■²+v■²)
• Addition: u + v = (u■+v■, u■+v■)
• Scalar multiplication: cv = (cv■, cv■)
• Unit vector: v■ = v / |v|
• Zero vector: 0 = (0, 0)
• Negative: −v = (−v■, −v■)
8.2 Dot Product
u · v = u■v■ + u■v■ = |u||v|cos(θ)
• u · v = 0 ↔ u ⊥ v (perpendicular)
• Projection of u onto v: proj_v(u) = (u·v/|v|²)·v
• Angle between vectors: cos(θ) = (u·v)/(|u||v|)
8.3 Cross Product (3D)
u × v = (u■v■−u■v■, u■v■−u■v■, u■v■−u■v■)
|u × v| = |u||v|sin(θ) = area of parallelogram spanned by u,v
• u × v is perpendicular to both u and v
• u × v = −(v × u) (anticommutative)
•u×u=0
8.4 Applications
• Physics: force, velocity, acceleration as vectors
• Work done: W = F · d (dot product)
• Torque: τ = r × F (cross product)
• Computer graphics: normals, lighting calculations
• Navigation: displacement and velocity
Example: Force F=(3,4) N acts over displacement d=(5,0) m. Work = F·d = 15 J.
PART II
Advanced Mathematics
Chapters 9–15: Trig · Pre-Calc · Calculus I & II · Linear Algebra · Multivariable
Chapter 9: Trigonometry
Trigonometry studies relationships between angles and sides of triangles, extended to circular functions.
9.1 Right Triangle Trigonometry
sin θ = opposite/hypotenuse cos θ = adjacent/hypotenuse tan θ =
opposite/adjacent
csc θ = 1/sin θ sec θ = 1/cos θ cot θ = 1/tan θ
Note: SOH-CAH-TOA: Sin=Opp/Hyp, Cos=Adj/Hyp, Tan=Opp/Adj
9.2 The Unit Circle
The unit circle has radius 1 centered at the origin. For angle θ: point = (cos θ, sin θ).
<b>θ (deg)</b> <b>θ (rad)</b> <b>sin θ</b> <b>cos θ</b> <b>tan θ</b>
0° 0 0 1 0
30° π/6 1/2 √3/2 1/√3
45° π/4 √2/2 √2/2 1
60° π/3 √3/2 1/2 √3
90° π/2 1 0 undef
120° 2π/3 √3/2 −1/2 −√3
180° π 0 −1 0
270° 3π/2 −1 0 undef
360° 2π 0 1 0
9.3 Identities
Pythagorean: sin²θ + cos²θ = 1; 1+tan²θ = sec²θ; 1+cot²θ = csc²θ
Double angle: sin(2θ) = 2sinθcosθ; cos(2θ) = cos²θ−sin²θ = 1−2sin²θ =
2cos²θ−1
Sum/Diff: sin(A±B)=sinAcosB±cosAsinB; cos(A±B)=cosAcosB■sinAsinB
Half angle: sin(θ/2)=±sqrt((1−cosθ)/2); cos(θ/2)=±sqrt((1+cosθ)/2)
Product-to-sum: sinAsinB=(1/2)[cos(A−B)−cos(A+B)]
9.4 Law of Sines and Cosines
Law of Sines: a/sinA = b/sinB = c/sinC
Law of Cosines: c² = a²+b² − 2ab·cosC
Area = (1/2)ab·sinC
Example: Triangle with a=7, b=5, C=60°. c²=49+25−2(35)(0.5)=39, c=sqrt(39)≈6.24.
9.5 Graphs of Trig Functions
• y = A·sin(Bx + C) + D: Amplitude=|A|, Period=2π/B, Phase shift=−C/B, Vertical shift=D
• y = sin(x): period 2π, amplitude 1, zero at 0, π, 2π
• y = cos(x): period 2π, amplitude 1, max at 0, min at π
• y = tan(x): period π, vertical asymptotes at π/2 + nπ
Chapter 10: Pre-Calculus ★
Pre-Calculus bridges algebra/trigonometry with calculus. Master these topics for a solid calculus
foundation.
10.1 Functions
A function f: A→B assigns each input x∈A exactly one output f(x)∈B
• Domain: set of valid inputs; Range: set of outputs
• Vertical line test: a graph is a function if no vertical line crosses it twice
• One-to-one (injective): f(x■)=f(x■) → x■=x■
• Onto (surjective): every y in range is achieved
• Bijective: both one-to-one and onto — has an inverse
Composition: (f■g)(x) = f(g(x)); Inverse: f■¹(f(x)) = x
Example: f(x)=2x+3, g(x)=x². (f■g)(x)=f(x²)=2x²+3. g■f=(2x+3)².
10.2 Exponential and Logarithmic Functions
f(x) = a^x (a>0, a≠1); f■¹(x) = log_a(x)
Natural: e^x and ln(x) = log_e(x); e ≈ 2.71828...
• log(AB) = log A + log B
• log(A/B) = log A − log B
• log(A^n) = n·log A
• Change of base: log_a(x) = ln(x)/ln(a)
• log_a(a^x) = x; a^(log_a x) = x
Example: Solve 2^x = 32: 2^x = 2^5 → x=5. Or: x = log■(32) = 5.
Example: Solve ln(x²) = 4: x² = e^4, x = ±e² ≈ ±7.389.
10.3 Polynomial Functions and Theorems
Polynomial: p(x) = a■x■ + a■■■x■■¹ + ... + a■x + a■
• Fundamental Theorem of Algebra: degree-n polynomial has exactly n roots (counting multiplicity, in
■)
• Remainder Theorem: p(c) = remainder when p(x) is divided by (x−c)
• Factor Theorem: (x−c) is a factor ↔ p(c)=0
• Rational Root Theorem: rational roots of p(x) have form ±p/q where p|a■, q|a■
• Descartes' Rule of Signs: counts positive/negative roots by sign changes
Example: Find roots of p(x)=x³−6x²+11x−6. Try x=1: 1−6+11−6=0 ✓. Factor out (x−1):
p(x)=(x−1)(x−3)(x−2). Roots: 1,2,3.
10.4 Rational Functions
f(x) = p(x)/q(x); undefined where q(x)=0
• Vertical asymptote: x=a where q(a)=0 and p(a)≠0
• Horizontal asymptote: compare degrees of p and q
• deg(p) < deg(q) → y=0
• deg(p) = deg(q) → y = leading coeff ratio
• deg(p) > deg(q) → slant (oblique) asymptote
• Holes: common factors in p(x) and q(x)
Example: f(x)=(x+1)/(x²−1)=(x+1)/((x+1)(x−1)). Hole at x=−1, vertical asymptote x=1, horizontal y=0.
10.5 Sequences and Series
Arithmetic: a■ = a■ + (n−1)d; S■ = n(a■+a■)/2 = n(2a■+(n−1)d)/2
Geometric: a■ = a■·r^(n−1); S■ = a■(1−r■)/(1−r) (r≠1)
Infinite geometric series: S∞ = a■/(1−r) (|r|<1)
Example: Sum 1+1/2+1/4+1/8+... = 1/(1−1/2) = 2.
10.6 Conic Sections (Detailed)
10.6.1 Parabola
Vertical: (x−h)² = 4p(y−k); focus: (h,k+p); directrix: y=k−p
Horizontal: (y−k)² = 4p(x−h); focus: (h+p,k); directrix: x=h−p
The parabola is the set of all points equidistant from the focus and directrix.
10.6.2 Ellipse
(x−h)²/a² + (y−k)²/b² = 1 (a>b>0, horizontal major axis)
Foci: c² = a²−b²; located at (h±c, k) for horizontal
Eccentricity: e = c/a (0 < e < 1 for ellipse)
Example: Ellipse (x/5)²+(y/3)²=1: a=5,b=3,c=sqrt(25−9)=4. Foci at (±4,0).
10.6.3 Hyperbola
Horizontal: (x−h)²/a² − (y−k)²/b² = 1; Foci: c²=a²+b²
Vertical: (y−k)²/a² − (x−h)²/b² = 1
Asymptotes: y−k = ±(b/a)(x−h) (horizontal case)
Eccentricity: e = c/a > 1
10.7 Polar Coordinates
Cartesian ↔ Polar: x=r·cosθ, y=r·sinθ; r=sqrt(x²+y²), θ=arctan(y/x)
• r = a: circle of radius a
• θ = α: ray at angle α
• r = 2a·cosθ: circle passing through origin
• r = 1+e·cosθ: conic with eccentricity e and focus at origin
Chapter 11: Basic Calculus (Calculus I) ★
Calculus studies continuous change. The two main operations are differentiation (rates of change) and
integration (accumulation).
11.1 Limits
lim[x→a] f(x) = L means f(x) can be made arbitrarily close to L as x→a
Limit Laws
• lim[c·f(x)] = c·lim[f(x)]
• lim[f(x)±g(x)] = lim[f(x)] ± lim[g(x)]
• lim[f(x)·g(x)] = lim[f(x)] · lim[g(x)]
• lim[f(x)/g(x)] = lim[f(x)]/lim[g(x)] (if denom ≠ 0)
Special Limits
lim[x→0] sin(x)/x = 1; lim[x→0] (1−cos x)/x = 0; lim[x→∞] (1+1/x)^x =
e
L'Hôpital's Rule (0/0 or ∞/∞ forms)
lim[x→a] f(x)/g(x) = lim[x→a] f'(x)/g'(x)
Example: lim[x→0] sin(x)/x → L'Hôpital: lim cos(x)/1 = 1 ✓
Continuity
f is continuous at x=a if: f(a) is defined, lim[x→a]f(x) exists, and lim[x→a]f(x)=f(a).
11.2 Derivatives
f'(x) = lim[h→0] (f(x+h)−f(x))/h = dy/dx
Differentiation Rules
<b>Rule</b> <b>Formula</b>
Power Rule d/dx[x■] = nx■■¹
Constant d/dx[c] = 0
Sum/Diff d/dx[f±g] = f'±g'
Product Rule (fg)' = f'g + fg'
Quotient Rule (f/g)' = (f'g−fg')/g²
Chain Rule d/dx[f(g(x))] = f'(g(x))·g'(x)
Exponential d/dx[e■] = e■; d/dx[a■] = a■·ln(a)
Logarithm d/dx[ln x] = 1/x; d/dx[log_a x] = 1/(x·ln a)
sin / cos d/dx[sin x]=cos x; d/dx[cos x]=−sin x
tan / sec d/dx[tan x]=sec²x; d/dx[sec x]=sec x·tan x
Example: Find d/dx[x³·sin(x)] = 3x²·sin(x) + x³·cos(x) (Product Rule).
Example: Find d/dx[sin(x²)] = cos(x²)·2x = 2x·cos(x²) (Chain Rule).
11.3 Applications of Derivatives
• Tangent line at (a, f(a)): y − f(a) = f'(a)(x−a)
• Critical points: f'(x) = 0 or f'(x) undefined
• First Derivative Test: f' changes + to − → local max; − to + → local min
• Second Derivative Test: f''(c)>0 → local min; f''(c)<0 → local max
• Concavity: f''>0 concave up; f''<0 concave down
• Inflection point: f'' changes sign
• Optimization: find critical points, check endpoints on closed interval
Related Rates: differentiate both sides w.r.t. time t using Chain Rule
Example: Maximize area of rectangle with perimeter 40: 2x+2y=40 → y=20−x. A=xy=x(20−x).
dA/dx=20−2x=0 → x=10, y=10. Square gives max area.
11.4 Integration
Antiderivative: if F'(x)=f(x), then ∫f(x)dx = F(x)+C
Basic Integration Rules
<b>Integral</b> <b>Result</b>
∫x■ dx x■■¹/(n+1)+C (n≠−1)
∫1/x dx ln|x|+C
∫e■ dx e■+C
∫a■ dx a■/ln(a)+C
∫sin x dx −cos x+C
∫cos x dx sin x+C
∫sec²x dx tan x+C
∫1/sqrt(1−x²) dx arcsin x+C
∫1/(1+x²) dx arctan x+C
Fundamental Theorem of Calculus
Part 1: d/dx[∫[a to x] f(t)dt] = f(x)
Part 2: ∫[a to b] f(x)dx = F(b)−F(a) where F'=f
Example: ∫[0 to 2] x² dx = [x³/3]■² = 8/3 − 0 = 8/3 ≈ 2.667
u-Substitution
Let u=g(x), du=g'(x)dx: ∫f(g(x))g'(x)dx = ∫f(u)du
Example: ∫2x·(x²+1)^5 dx: let u=x²+1, du=2x dx. = ∫u^5 du = u^6/6+C = (x²+1)^6/6+C.
11.5 Area and Geometric Applications
Area between curves: ∫[a to b] |f(x)−g(x)| dx
Average value of f on [a,b]: f_avg = (1/(b−a))·∫[a to b]f(x)dx
Example: Area between y=x² and y=x: set x²=x → x=0,1. Area=∫[0 to 1](x−x²)dx=[x²/2−x³/3]■¹=1/6.
Chapter 12: Calculus II ★
Calculus II extends integration techniques, introduces sequences and series, and lays groundwork for
multivariable calculus.
12.1 Advanced Integration Techniques
Integration by Parts
∫u·dv = uv − ∫v·du (Choose u: LIATE order: Log, Inverse trig, Algebraic,
Trig, Exponential)
Example: ∫x·e■ dx: u=x, dv=e■dx, du=dx, v=e■. = xe■ − ∫e■dx = xe■ − e■ + C = e■(x−1)+C.
Example: ∫ln(x) dx: u=ln x, dv=dx, du=1/x dx, v=x. = x·ln(x) − ∫1 dx = x·ln(x) − x + C.
Trigonometric Integrals
• ∫sin■x·cos■x dx: use reduction formulas or half-angle identities
• ∫sin²x dx = x/2 − sin(2x)/4 + C
• ∫cos²x dx = x/2 + sin(2x)/4 + C
• ∫tan²x dx = tan x − x + C
• ∫sec³x dx = (sec x·tan x + ln|sec x+tan x|)/2 + C
Trigonometric Substitution
<b>Expression</b> <b>Substitution</b> <b>Identity Used</b>
sqrt(a²−x²) x=a·sin θ 1−sin²=cos²
sqrt(a²+x²) x=a·tan θ 1+tan²=sec²
sqrt(x²−a²) x=a·sec θ sec²−1=tan²
Partial Fractions
Decompose rational function into simpler fractions before integrating
Example: ∫(2x+1)/((x−1)(x+2)) dx. Write (2x+1)/((x−1)(x+2))=A/(x−1)+B/(x+2). Solve: A=1, B=1.
Integral = ln|x−1| + ln|x+2| + C.
12.2 Improper Integrals
∫[a to ∞] f(x)dx = lim[b→∞] ∫[a to b] f(x)dx
∫[-∞ to ∞] f(x)dx = ∫[-∞ to 0] + ∫[0 to ∞] (both must converge)
Example: ∫[1 to ∞] 1/x² dx = lim[b→∞][−1/x]■■ = 0−(−1) = 1. Converges!
Example: ∫[1 to ∞] 1/x dx = lim[b→∞][ln x]■■ → ∞. Diverges!
12.3 Sequences and Series
Sequences
Sequence {a■}: converges to L if lim[n→∞] a■ = L
• Bounded and monotone sequences converge
• lim[n→∞] r■ = 0 if |r|<1; diverges if |r|>1
• lim[n→∞] n^(1/n) = 1; lim[n→∞] (1+x/n)^n = e■
Series Convergence Tests
<b>Test</b> <b>Condition for Convergence</b>
Divergence Test If lim a■ ≠ 0, series DIVERGES
Geometric |r|<1: converges to a/(1−r)
p-series ∑1/n■ converges iff p>1
Integral Test ∑a■ and ∫f(x)dx converge together
Comparison Test 0 ≤ a■ ≤ b■; if ∑b■ conv → ∑a■ conv
Limit Comparison lim a■/b■ = L>0 → same behavior
Alternating Series b■ decreasing, b■→0 → converges
Ratio Test lim|a■■■/a■|<1 converges; >1 diverges
Root Test lim|a■|^(1/n)<1 converges; >1 diverges
Power Series and Taylor/Maclaurin Series
Power series: ∑[n=0 to ∞] c■(x−a)■; radius of convergence R =
1/lim|c■■■/c■|
Taylor series: f(x) = ∑[n=0 to ∞] f^(n)(a)/n! · (x−a)■
<b>Function</b> <b>Maclaurin Series</b>
e■ ∑x■/n! = 1+x+x²/2!+x³/3!+...
sin x ∑(−1)■x^(2n+1)/(2n+1)! = x−x³/6+x■/120−...
cos x ∑(−1)■x^(2n)/(2n)! = 1−x²/2+x■/24−...
ln(1+x) ∑(−1)■■¹x■/n = x−x²/2+x³/3−... (|x|≤1)
1/(1−x) ∑x■ = 1+x+x²+x³+... (|x|<1)
arctan x ∑(−1)■x^(2n+1)/(2n+1) = x−x³/3+x■/5−...
12.4 Applications of Integration
Arc length: L = ∫[a to b] sqrt(1+(dy/dx)²) dx
Surface area (revolution about x-axis): SA = 2π∫[a to b]
f(x)·sqrt(1+[f'(x)]²) dx
Volume (disk method): V = π∫[a to b] [f(x)]² dx
Volume (washer method): V = π∫[a to b] ([f(x)]²−[g(x)]²) dx
Volume (shell method): V = 2π∫[a to b] x·f(x) dx
Example: Volume of sphere radius r: V = π∫[−r to r](r²−x²)dx = (4/3)πr³.
12.5 Differential Equations (Intro)
A differential equation relates a function with its derivatives.
Separable: dy/dx = f(x)g(y) → ∫dy/g(y) = ∫f(x)dx
Linear first-order: dy/dx + P(x)y = Q(x); Integrating factor: µ=e^(∫P
dx)
Example: Solve dy/dx = ky (exponential growth/decay): y = Ce^(kx).
Example: Solve dy/dx = y/x: dy/y = dx/x → ln|y| = ln|x|+C → y=Ax.
Chapter 13: Logic and Basic Proofs
Mathematical logic provides the foundation for rigorous mathematical reasoning and proof.
13.1 Propositional Logic
• Proposition: statement that is true or false (not both)
• Negation ¬p: true when p is false
• Conjunction p∧q: true only when both are true
• Disjunction p∨q: true when at least one is true
• Implication p→q: false only when p is true and q is false
• Biconditional p↔q: true when both have same truth value
Logical Equivalences
• De Morgan: ¬(p∧q) ≡ ¬p∨¬q; ¬(p∨q) ≡ ¬p∧¬q
• Contrapositive: p→q ≡ ¬q→¬p
• Double negation: ¬¬p ≡ p
• Absorption: p∨(p∧q) ≡ p; p∧(p∨q) ≡ p
13.2 Proof Techniques
• Direct proof: assume hypothesis, derive conclusion step by step
• Proof by contrapositive: prove ¬q→¬p instead of p→q
• Proof by contradiction: assume ¬conclusion leads to contradiction
• Proof by cases: divide into exhaustive cases, prove each
• Mathematical induction: base case + inductive step
• Constructive proof: explicitly construct the required object
Mathematical Induction
Step 1 (Base): Prove P(1) is true. Step 2 (Inductive): Assume P(k),
prove P(k+1).
Example: Prove 1+2+...+n = n(n+1)/2. Base: n=1: 1=1(2)/2=1 ✓. Inductive: assume sum up to k =
k(k+1)/2. Sum up to k+1 = k(k+1)/2 + (k+1) = (k+1)(k+2)/2 ✓.
13.3 Set Theory
A∪B: union; A∩B: intersection; A\B: difference; A': complement; A⊆B:
subset
Power set P(A): all subsets of A. |A|=n → |P(A)|=2■
Cartesian product A×B = {(a,b): a∈A, b∈B}
Chapter 14: Linear Algebra
Linear algebra studies vector spaces and linear transformations, essential for data science and
engineering.
14.1 Matrices
Matrix A: m×n array. Entry a■■ in row i, column j.
• Addition: (A+B)■■ = a■■+b■■ (same dimensions)
• Scalar multiplication: (cA)■■ = c·a■■
• Matrix multiply: (AB)■■ = ∑■ a■■·b■■ (m×n times n×p = m×p)
• Transpose: (A■)■■ = a■■
• Identity matrix I: I■ is n×n with 1s on diagonal, 0s elsewhere
• Inverse: A·A■¹ = A■¹·A = I (exists iff det(A) ≠ 0)
14.2 Determinants
2×2: det([a b; c d]) = ad − bc
3×3 (cofactor expansion along row 1):
det(A) = a■■(a■■a■■−a■■a■■) − a■■(a■■a■■−a■■a■■) +
a■■(a■■a■■−a■■a■■)
• det(AB) = det(A)·det(B)
• det(A■) = det(A)
• Row operation (swap) flips sign of determinant
• det(A■¹) = 1/det(A)
• Geometric meaning: |det(A)| = volume scaling factor
14.3 Systems of Linear Equations
Ax = b (matrix form)
• Gaussian elimination: row reduce augmented matrix [A|b]
• Row operations: swap rows, multiply row by scalar, add multiple of one row to another
• Reduced row echelon form (RREF): leading 1s, zeros above and below each pivot
• Unique solution: rank(A) = rank([A|b]) = n
• Infinitely many solutions: rank(A) = rank([A|b]) < n
• No solution: rank(A) < rank([A|b])
• Cramer's Rule: x■ = det(A■)/det(A)
14.4 Vector Spaces
• Vector space V: set with addition and scalar multiplication satisfying 8 axioms
• Subspace: closed under addition and scalar multiplication
• Span: all linear combinations of a set of vectors
• Linear independence: c■v■+...+c■v■=0 only when all c■=0
• Basis: linearly independent spanning set
• Dimension: number of vectors in any basis
• Column space, row space, null space of a matrix
• Rank-Nullity Theorem: rank(A) + nullity(A) = n (number of columns)
14.5 Eigenvalues and Eigenvectors
Av = λv → (A−λI)v = 0 → det(A−λI) = 0 (characteristic equation)
Characteristic polynomial: p(λ) = det(A−λI)
• Eigenvalues: roots of characteristic polynomial
• Eigenvectors: nonzero solutions to (A−λI)v=0 for each λ
• Eigenspace: null space of (A−λI)
• Diagonalization: A = PDP■¹ where D diagonal, P columns are eigenvectors
• Symmetric matrices: real eigenvalues, orthogonal eigenvectors
Example: A = [3 1; 0 2]. det(A−λI) = (3−λ)(2−λ) = 0. λ■=3, λ■=2. For λ=3: (A−3I)v=0 → [0 1;0 -1]v=0
→ v=(1,0). For λ=2: v=(1,−1).
14.6 Inner Products and Orthogonality
Inner product in R■: ■u,v■ = u·v = u■v■+...+u■v■
Gram-Schmidt: orthogonalize {v■,...,v■} into {u■,...,u■}
u1=v1; uk = vk - SUM[j<k] ([Link]/|uj|^2)uj
Chapter 15: Multivariable Calculus
Multivariable calculus extends calculus to functions of several variables, essential in physics, engineering,
and data science.
15.1 Partial Derivatives
∂f/∂x: derivative of f(x,y,...) treating all other variables as
constants
Example: f(x,y)=x²y+3xy². ∂f/∂x = 2xy+3y². ∂f/∂y = x²+6xy.
Gradient: ∇f = (∂f/∂x, ∂f/∂y, ∂f/∂z) — points in direction of steepest
ascent
Directional derivative: D_u f = ∇f · u (u unit vector)
15.2 Critical Points and Optimization
Critical point: ∇f = 0 (all partial derivatives = 0)
Second Derivative Test (2 vars): D = f■■f■■ − (f■■)²
• D > 0 and f■■ > 0: local minimum
• D > 0 and f■■ < 0: local maximum
• D < 0: saddle point
• D = 0: inconclusive
Lagrange Multipliers: ∇f = λ∇g (optimize f subject to g=0)
15.3 Multiple Integrals
Double integral: ■_R f(x,y) dA — computed as iterated integral
∫[a to b]∫[c to d] f(x,y) dy dx or ∫[c to d]∫[a to b] f(x,y) dx dy
(Fubini's Theorem)
Triple integral: ■_E f(x,y,z) dV
Change of variables (polar): x=r·cosθ, y=r·sinθ; dA=r·dr·dθ
Spherical coordinates: x=ρsinφcosθ, y=ρsinφsinθ, z=ρcosφ; dV=ρ²sinφ dρ
dφ dθ
15.4 Vector Calculus
Line integral: ∫_C F·dr = ∫[a to b] F(r(t))·r'(t) dt
Green's Theorem: ■_C (P dx+Q dy) = ■_D (∂Q/∂x−∂P/∂y) dA
Stokes' Theorem: ■_C F·dr = ■_S (∇×F)·dS
Divergence Theorem: ■_S F·dS = ■_E (∇·F) dV
• Curl: ∇×F = (∂F■/∂y−∂F■/∂z, ∂F■/∂z−∂F■/∂x, ∂F■/∂x−∂F■/∂y)
• Divergence: ∇·F = ∂F■/∂x+∂F■/∂y+∂F■/∂z
• Conservative field: F=∇φ ↔ ∇×F=0 ↔ line integral path-independent
PART III
Real Analysis
Chapters 16–18: Elementary Analysis I, II, III
Chapter 16: Elementary Analysis I
Real analysis provides rigorous foundations for calculus: precise definitions of limits, continuity, and
convergence.
16.1 The Real Number System
• Completeness axiom: every nonempty bounded-above subset of ■ has a least upper bound
(supremum)
• Archimedean property: for any x∈■, there exists n∈■ with n>x
• Density of ■: between any two reals, there is a rational
• Field axioms: ■ is a complete ordered field
• Absolute value: |x| = x if x≥0, −x if x<0
16.2 Sequences and Limits (Rigorous)
ε-N definition: lim[n→∞]a■=L iff ∀ε>0 ∃N: n>N → |a■−L|<ε
• Squeeze Theorem: a■≤b■≤c■ and lim a■=lim c■=L → lim b■=L
• Monotone Convergence Theorem: bounded monotone sequence converges
• Bolzano-Weierstrass: every bounded sequence has a convergent subsequence
• Cauchy sequence: |a■−a■|→0; in ■, Cauchy ↔ convergent
16.3 Continuity (Rigorous)
ε-δ definition: f continuous at a iff ∀ε>0 ∃δ>0: |x−a|<δ → |f(x)−f(a)|<ε
• Intermediate Value Theorem: f continuous on [a,b], f(a)<k<f(b) → ∃c: f(c)=k
• Extreme Value Theorem: f continuous on [a,b] attains its max and min
• Uniform continuity: δ depends only on ε, not on a
• Lipschitz continuity: |f(x)−f(y)| ≤ K|x−y| → uniformly continuous
16.4 Differentiation (Rigorous)
Mean Value Theorem: f continuous on [a,b], differentiable on (a,b) →
∃c: f'(c)=(f(b)−f(a))/(b−a)
• Rolle's Theorem: f(a)=f(b) → ∃c∈(a,b): f'(c)=0
• Taylor's Theorem with remainder: f(x) = T■(x) + R■(x)
• Lagrange remainder: R■(x) = f^(n+1)(c)/(n+1)! · (x−a)^(n+1)
• L'Hôpital's Rule (rigorous version via MVT)
Chapter 17: Elementary Analysis II
Analysis II deepens the study of integration, series of functions, and metric spaces.
17.1 The Riemann Integral
Partition P = {a=x■<x■<...<x■=b}; mesh ||P|| = max(x■−x■■■)
Upper sum U(P,f) = ∑M■(x■−x■■■); Lower sum L(P,f) = ∑m■(x■−x■■■)
f is Riemann integrable: inf U(P,f) = sup L(P,f) = ∫f
• Every continuous function on [a,b] is Riemann integrable
• Every monotone function on [a,b] is Riemann integrable
• Lebesgue's criterion: f integrable iff set of discontinuities has measure zero
17.2 Uniform Convergence
f■→f uniformly: ∀ε>0 ∃N: n>N → |f■(x)−f(x)|<ε for ALL x
• Uniform convergence preserves continuity
• Uniform convergence allows passing limits under integral
• Weierstrass M-test: if |f■(x)|≤M■ and ∑M■ converges → ∑f■ converges uniformly
• Power series converge uniformly on closed sub-intervals of their radius of convergence
17.3 Series of Functions
Pointwise: ∑f■(x) converges if partial sums converge for each x
Term-by-term integration: ∫∑f■ dx = ∑∫f■ dx (if uniform convergence)
Term-by-term differentiation: (∑f■)' = ∑f■' (if derivatives converge
uniformly)
17.4 Metric Spaces
Metric space (X,d): d(x,y)≥0, d(x,y)=0↔x=y, d(x,y)=d(y,x),
d(x,z)≤d(x,y)+d(y,z)
• Open ball: B(x,r) = {y: d(x,y)<r}
• Open set: contains an open ball around each of its points
• Complete metric space: every Cauchy sequence converges
• Contraction Mapping Theorem (Banach Fixed Point): strict contraction on complete metric space
has unique fixed point
• Compact set: every open cover has a finite subcover ↔ (in ■■) closed and bounded
Chapter 18: Elementary Analysis III
Analysis III covers measure theory, Lebesgue integration, and Fourier analysis — the tools of modern
analysis.
18.1 Measure Theory Basics
• σ-algebra: collection closed under complement and countable unions
• Measure µ: countably additive function from σ-algebra to [0,∞]
• Lebesgue measure: generalizes length/area/volume; measurable sets
• Almost everywhere (a.e.): property holds except on a set of measure zero
• Lebesgue measurable sets include all open, closed, Borel sets
18.2 Lebesgue Integration
Simple function: φ = ∑a■·1_{A■}; ∫φ dµ = ∑a■·µ(A■)
Lebesgue integral: ∫f dµ = sup{∫φ dµ: 0≤φ≤f, φ simple}
• Monotone Convergence Theorem: f■↑f a.e. → ∫f■ dµ → ∫f dµ
• Dominated Convergence Theorem: |f■|≤g (integrable), f■→f a.e. → ∫f■→∫f
• Fatou's Lemma: ∫lim inf f■ ≤ lim inf ∫f■
• L■ spaces: functions with ∫|f|■ < ∞
18.3 Fourier Analysis
Fourier series: f(x) = a■/2 + ∑[n=1 to ∞](a■cos(nπx/L)+b■sin(nπx/L))
Coefficients: a■=(1/L)∫[-L to L]f(x)cos(nπx/L)dx; b■=(1/L)∫[-L to
L]f(x)sin(nπx/L)dx
Fourier transform: F■(ξ) = ∫_{-∞}^{∞} f(x)e^{-2πiξx} dx
• Parseval's theorem: ∑|c■|² = (1/2L)∫|f|² (energy conservation)
• Convolution theorem: F(f*g) = F(f)·F(g)
• Applications: signal processing, partial differential equations, quantum mechanics
PART IV
Statistics
Chapters 19–22: Elementary Stats · Descriptive · Methods · Probability
Theories
Chapter 19: Elementary Statistics
Statistics is the science of collecting, analyzing, interpreting, and presenting data.
19.1 Types of Data
• Qualitative (categorical): nominal (no order), ordinal (ordered)
• Quantitative: discrete (countable), continuous (measurable)
• Levels of measurement: nominal < ordinal < interval < ratio
19.2 Sampling Methods
• Simple random sampling: every member equally likely
• Stratified sampling: divide into strata, sample from each
• Cluster sampling: divide into clusters, randomly select clusters
• Systematic sampling: every kth element
• Convenience sampling: easily accessible (often biased)
19.3 Measures of Central Tendency
Mean: x■ = (∑x■)/n
Median: middle value when sorted; Mode: most frequent value
Weighted mean: x■_w = ∑(w■x■)/∑w■
Geometric mean: GM = (x■·x■·...·x■)^(1/n)
19.4 Measures of Dispersion
Range = max − min
Variance: s² = ∑(x■−x■)²/(n−1) (sample); σ² = ∑(x■−µ)²/N (population)
Standard deviation: s = sqrt(s²)
Coefficient of variation: CV = (s/x■)·100%
IQR = Q3 − Q1 (Q1=25th percentile, Q3=75th percentile)
19.5 Normal Distribution
f(x) = (1/(σ√(2π)))·e^{−(x−µ)²/(2σ²)}
Z-score: z = (x−µ)/σ (standard normal: µ=0, σ=1)
• 68-95-99.7 Rule: 68% within 1σ, 95% within 2σ, 99.7% within 3σ
• Central Limit Theorem: sample mean x■ ≈ N(µ, σ²/n) for large n
Chapter 20: Descriptive Statistics
Descriptive statistics summarizes and describes the features of a dataset.
20.1 Frequency Distributions
• Frequency table: count of occurrences in each class
• Relative frequency: count/total
• Cumulative frequency: running total
• Class width = (max−min)/number of classes
20.2 Graphical Displays
• Histogram: bars for frequency distribution of continuous data
• Bar chart: bars for categorical data
• Pie chart: proportions shown as sectors
• Box plot (box-and-whisker): shows min, Q1, median, Q3, max
• Scatter plot: shows relationship between two quantitative variables
• Stem-and-leaf plot: shows distribution while preserving data
• Line graph: trends over time
20.3 Correlation and Regression
Pearson correlation: r = ∑(x■−x■)(y■−■) / sqrt[∑(x■−x■)²·∑(y■−■)²]
Interpretation: r∈[−1,1]; r=1 perfect positive, r=−1 perfect negative,
r=0 no linear relationship
Simple linear regression: ■ = b■ + b■x
b■ = r·(s■/s■); b■ = ■ − b■x■
Coefficient of determination: R² = r² (proportion of variance
explained)
Example: Hours studied vs exam score. r=0.85, R²=0.72: 72% of score variation explained by study
hours.
20.4 Percentiles and z-scores
Percentile rank of x = (number of values ≤ x)/n × 100
Pth percentile: value below which P% of data falls
z-score: z = (x−µ)/σ measures standard deviations from mean
Chapter 21: Basic Statistical Methods
Statistical methods allow us to make inferences about populations from samples.
21.1 Confidence Intervals
CI for population mean (σ known): x■ ± z_{α/2}·(σ/√n)
CI for population mean (σ unknown): x■ ± t_{α/2, n-1}·(s/√n)
CI for proportion: p■ ± z_{α/2}·√(p■(1−p■)/n)
Common z-values: 90% CI → z=1.645; 95% → z=1.96; 99% → z=2.576
21.2 Hypothesis Testing
• Step 1: State H■ (null) and H■ (alternative hypothesis)
• Step 2: Choose significance level α (often 0.05)
• Step 3: Compute test statistic
• Step 4: Find p-value or critical value
• Step 5: Decision — if p < α, reject H■
• Step 6: Interpret in context
t-test: t = (x■−µ■)/(s/√n); Two-sample: t = (x■■−x■■)/SE_diff
z-test for proportion: z = (p■−p■)/√(p■(1−p■)/n)
Chi-square test: χ² = ∑(O−E)²/E (goodness of fit / independence)
Note: Type I error (α): reject true H■. Type II error (β): fail to reject false H■. Power = 1−β.
21.3 ANOVA
Analysis of Variance (ANOVA) compares means across 3+ groups.
F = (variance between groups)/(variance within groups) = MSB/MSW
MSB = SSB/(k−1); MSW = SSW/(N−k); where k=groups, N=total sample size
SST = SSB + SSW (total variation = between + within)
21.4 Non-parametric Tests
• Mann-Whitney U test: non-parametric alternative to two-sample t-test
• Wilcoxon signed-rank test: paired data, non-normal distribution
• Kruskal-Wallis test: non-parametric ANOVA alternative
• Spearman rank correlation: non-parametric version of Pearson r
Chapter 22: Probability Theories
Probability theory provides the mathematical foundation for randomness and uncertainty.
22.1 Kolmogorov Axioms
Axiom 1: P(A) ≥ 0 for any event A
Axiom 2: P(Ω) = 1 (sample space has probability 1)
Axiom 3: P(A∪B) = P(A)+P(B) for mutually exclusive A,B
22.2 Random Variables
• Discrete RV: P(X=x) = probability mass function (PMF)
• Continuous RV: f(x) = probability density function (PDF); P(a≤X≤b)=∫[a to b]f(x)dx
• CDF: F(x) = P(X≤x)
• Expected value: E[X] = ∑x·P(X=x) or ∫x·f(x)dx
• Variance: Var(X) = E[X²]−(E[X])²
• Moment generating function: M_X(t) = E[e^{tX}]
22.3 Important Distributions
<b>Distribution</b> <b>PMF/PDF</b> <b>Mean</b> <b>Variance</b>
Bernoulli(p) P(X=1)=p, P(X=0)=1−p p p(1−p)
Binomial(n,p) C(n,k)p^k(1−p)^(n−k) np np(1−p)
Poisson(λ) e^{−λ}λ^k/k! λ λ
Geometric(p) (1−p)^{k−1}p 1/p (1−p)/p²
Normal(µ,σ²) (1/σ√2π)e^{−(x−µ)²/2σ²} µ σ²
Exponential(λ) λe^{−λx} 1/λ 1/λ²
Uniform(a,b) 1/(b−a) (a+b)/2 (b−a)²/12
Chi-square(k) Complex k 2k
t-distribution(ν) Complex 0 (ν>1) ν/(ν−2) (ν>2)
22.4 Law of Large Numbers and CLT
Weak LLN: x■■ →(probability) µ as n→∞
Strong LLN: x■■ →(almost surely) µ as n→∞
Central Limit Theorem: (x■■−µ)/(σ/√n) → N(0,1) in distribution as n→∞
PART V
Programming with Python
Chapters 23–25: Intro Python · Python for Data Science · Problems
Chapter 23: Introduction to Programming (Python)
Python is a high-level, readable, versatile programming language. It is the top language for data science,
AI, and scientific computing.
23.1 Variables and Data Types
# Variables
x = 10 # int
pi = 3.14159 # float
name = "Alice" # str
is_ok = True # bool
nums = [1,2,3] # list
coords = (3,4) # tuple (immutable)
info = {"age":21} # dict
unique = {1,2,3} # set
# Type conversion
int("42") # 42
float(5) # 5.0
str(100) # "100"
23.2 Control Flow
# Conditionals
x = 15
if x > 10:
print("Big")
elif x == 10:
print("Ten")
else:
print("Small")
# Loops
for i in range(5): # 0,1,2,3,4
print(i)
while x > 0:
x -= 3
# List comprehension
squares = [i**2 for i in range(10)]
evens = [x for x in range(20) if x % 2 == 0]
23.3 Functions
# Basic function
def greet(name, greeting="Hello"):
return f"{greeting}, {name}!"
print(greet("Maria")) # Hello, Maria!
print(greet("Bob", "Hi")) # Hi, Bob!
# Lambda (anonymous function)
square = lambda x: x**2
print(square(5)) # 25
# *args and **kwargs
def total(*args):
return sum(args)
def display(**kwargs):
for k, v in [Link]():
print(f"{k}: {v}")
23.4 Data Structures
# Lists
lst = [3,1,4,1,5]
[Link](9) # [3,1,4,1,5,9]
[Link]() # [1,1,3,4,5,9]
[Link]() # [9,5,4,3,1,1]
lst[0] # 9 (indexing)
lst[1:4] # [5,4,3] (slicing)
# Dictionaries
d = {"name": "Ana", "age": 20}
d["grade"] = "A" # add key
[Link]("age", 0) # 20
list([Link]()) # ["name","age","grade"]
list([Link]()) # ["Ana",20,"A"]
for k,v in [Link]():
print(k, "->", v)
23.5 Object-Oriented Programming
class Student:
def __init__(self, name, grade):
[Link] = name
[Link] = grade
def describe(self):
return f"{[Link]}: {[Link]}"
def __repr__(self):
return f"Student({[Link]!r})"
class HonorsStudent(Student):
def __init__(self, name, grade, scholarship):
super().__init__(name, grade)
[Link] = scholarship
def describe(self):
base = super().describe()
return base + f" | Scholarship: {[Link]}"
s = HonorsStudent("Ana", "A", True)
print([Link]())
23.6 File I/O and Exception Handling
# File writing and reading
with open("[Link]", "w") as f:
[Link]("Line 1\nLine 2\n")
with open("[Link]", "r") as f:
for line in f:
print([Link]())
# Exception handling
try:
result = 10 / 0
except ZeroDivisionError as e:
print("Error:", e)
except Exception as e:
print("Unexpected:", e)
finally:
print("Always runs")
# raise custom error
def divide(a, b):
if b == 0:
raise ValueError("Denominator cannot be zero")
return a / b
Chapter 24: Python for Data Scientists
Python's ecosystem makes it the de facto standard for data science. Master these libraries to analyze,
visualize, and model data.
24.1 NumPy — Numerical Computing
import numpy as np
# Arrays
a = [Link]([1, 2, 3, 4, 5])
b = [Link]((3, 4)) # 3x4 zeros
c = [Link]((2, 2)) # 2x2 ones
d = [Link](0, 10, 2) # [0,2,4,6,8]
e = [Link](0, 1, 5) # [0,.25,.5,.75,1]
# Operations (element-wise)
a * 2 # [2,4,6,8,10]
[Link](a) # element-wise sqrt
[Link](a, a) # dot product = 55
# Matrix operations
A = [Link]([[1,2],[3,4]])
[Link](A) # determinant
[Link](A) # inverse
eigenvalues, eigenvectors = [Link](A)
# Statistics
[Link](a), [Link](a), [Link](a)
[Link](a, 75) # 75th percentile
[Link](a, a*2) # correlation matrix
24.2 Pandas — Data Analysis
import pandas as pd
# Create DataFrame
df = [Link]({
"name": ["Ana","Bob","Cara"],
"score": [92, 85, 91],
"passed": [True, True, True]
})
# Basic exploration
[Link]() # first 5 rows
[Link]() # dtypes, nulls
[Link]() # summary statistics
[Link] # (3, 3)
# Selection
df["score"] # Series
df[["name","score"]] # DataFrame
[Link][0] # row by label
[Link][1:3] # rows by position
df[df["score"] > 90] # filter
# Manipulation
df["grade"] = df["score"].apply(lambda x: "A" if x>=90 else "B")
df.sort_values("score", ascending=False, inplace=True)
[Link]("grade")["score"].mean()
# Missing values
[Link]().sum()
[Link](0)
[Link]()
# Reading files
df = pd.read_csv("[Link]")
df = pd.read_excel("[Link]")
df.to_csv("[Link]", index=False)
24.3 Matplotlib and Seaborn — Visualization
import [Link] as plt
import seaborn as sns
# Line plot
x = [1,2,3,4,5]
y = [2,4,1,8,5]
[Link](figsize=(8,4))
[Link](x, y, 'b-o', linewidth=2, label="Series A")
[Link]("X"), [Link]("Y")
[Link]("Line Plot"), [Link](), [Link](True)
plt.tight_layout(), [Link]()
# Histogram and box plot
data = [Link](100, 15, 500)
fig, (ax1, ax2) = [Link](1, 2, figsize=(10,4))
[Link](data, bins=30, color='steelblue', edgecolor='white')
ax1.set_title("Histogram")
[Link](data)
ax2.set_title("Box Plot")
# Seaborn (statistical)
tips = sns.load_dataset("tips")
[Link](data=tips, x="total_bill", y="tip", hue="sex")
[Link]([Link](numeric_only=True), annot=True, cmap="coolwarm")
24.4 Scikit-learn — Machine Learning
from sklearn.model_selection import train_test_split
from [Link] import StandardScaler
from sklearn.linear_model import LinearRegression, LogisticRegression
from [Link] import RandomForestClassifier
from [Link] import accuracy_score, r2_score, confusion_matrix
# Workflow
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,
random_state=42)
scaler = StandardScaler()
X_train = scaler.fit_transform(X_train)
X_test = [Link](X_test)
# Linear Regression
model = LinearRegression()
[Link](X_train, y_train)
y_pred = [Link](X_test)
print("R²:", r2_score(y_test, y_pred))
print("Coefficients:", model.coef_)
# Classification
clf = RandomForestClassifier(n_estimators=100, random_state=42)
[Link](X_train, y_train)
y_pred = [Link](X_test)
print("Accuracy:", accuracy_score(y_test, y_pred))
print("Confusion Matrix:\n", confusion_matrix(y_test, y_pred))
# Cross-validation
from sklearn.model_selection import cross_val_score
scores = cross_val_score(clf, X, y, cv=5)
print("CV Mean:", [Link](), "±", [Link]())
24.5 SciPy — Scientific Computing
from scipy import stats, optimize, integrate
# Statistical tests
t_stat, p_value = stats.ttest_ind(group1, group2)
chi2, p, dof, expected = stats.chi2_contingency(table)
# Optimization
result = [Link](lambda x: (x-3)**2, x0=0)
print("Minimum at:", result.x)
# Integration
result, error = [Link](lambda x: x**2, 0, 1)
print("Integral:", result) # 0.3333...
# Interpolation
from [Link] import interp1d
f = interp1d([1,2,3,4], [1,4,9,16], kind='cubic')
print(f(2.5)) # ~6.25
Chapter 25: Problems to Solve
Practice is essential. The following problems span all topics covered in this book. Solutions available upon
working through them carefully.
Part A: Algebra
1. Solve: 2x² − 7x + 3 = 0 using both factoring and the quadratic formula.
2. A train travels 120 km at speed v, then another 80 km at v+20. Total time: 3 hours. Find v.
3. Solve the inequality: |3x − 2| ≥ 7. Express in interval notation.
4. Simplify: (x³ − 8)/(x − 2). What value does this approach as x→2?
5. A 40% salt solution and a 10% salt solution are mixed to get 30 L of 25% solution. How much of each?
Part B: Calculus
1. Find all critical points of f(x) = x■ − 4x³ + 6x² and classify each.
2. Evaluate: ∫■^π x·sin(x) dx using integration by parts.
3. Find the Taylor series for f(x) = e^{2x} centered at x=0 up to the x■ term.
4. Find the volume of the solid formed by rotating y = √x, 0≤x≤4, about the x-axis.
5. Using L'Hôpital's Rule: lim[x→0] (e■−1−x)/x².
6. Determine if ∑[n=1 to ∞] n/(n²+1) converges or diverges. Show your work.
Part C: Linear Algebra
1. Find det(A) and A■¹ for A = [[2,1],[5,3]].
2. Solve the system: 3x+2y−z=7, x−y+2z=−1, 2x+3y+z=11.
3. Find eigenvalues and eigenvectors of A = [[4,1],[2,3]].
4. Determine if {(1,2,3),(0,1,2),(1,1,1)} is linearly independent.
Part D: Statistics
1. A sample of 36 has mean 52 and std dev 8. Construct a 95% confidence interval for the population
mean.
2. Test H■: µ=50 vs H■: µ≠50 with x■=53, s=6, n=25, α=0.05.
3. If X ~ Poisson(3), find P(X=2) and P(X≤2).
4. Five cards drawn from a deck. What is P(three-of-a-kind)?
5. Find the correlation coefficient for: x=[1,2,3,4,5], y=[2,4,5,4,5]. Interpret.
Part E: Python
1. Write a function that takes a list of numbers and returns mean, median, and standard deviation.
2. Using NumPy, solve the linear system Ax=b where A=[[2,1],[5,3]], b=[7,2].
3. Load a CSV, compute group-level statistics using groupby, and plot a bar chart.
4. Implement gradient descent from scratch to minimize f(x)=(x−3)².
5. Build a simple linear regression model with scikit-learn. Report R² and plot residuals.
PART VI
Basic Accounting
Chapter 26: For the Future Accountant
Chapter 26: Basic Accounting
Accounting is the language of business. This chapter introduces the fundamental concepts your
accountancy-track partner will encounter.
26.1 The Accounting Equation
ASSETS = LIABILITIES + OWNER'S EQUITY
• Assets: resources owned by the business (cash, inventory, equipment)
• Liabilities: amounts owed to others (loans, accounts payable)
• Owner's Equity: owner's claim on assets = Assets − Liabilities
• Expanded: Assets = Liabilities + Capital + Revenue − Expenses − Drawings
Example: A business has P500,000 in assets and P200,000 in liabilities. Owner's equity = P300,000.
26.2 Types of Accounts
<b>Account Type</b> <b>Normal Balance</b>
<b>Increases with</b><b>Examples</b>
Asset Debit Debit Cash, Accounts Receivable, Equipment
Liability Credit Credit Loans Payable, Accounts Payable
Equity Credit Credit Capital, Retained Earnings
Revenue Credit Credit Sales, Service Income
Expense Debit Debit Rent, Salaries, Utilities
26.3 The Accounting Cycle
1. Identify and analyze transactions
2. Record in the Journal (General Journal entries)
3. Post to the Ledger (T-accounts)
4. Prepare Trial Balance
5. Make Adjusting Entries
6. Prepare Adjusted Trial Balance
7. Prepare Financial Statements
8. Make Closing Entries
9. Post-Closing Trial Balance
26.4 Journal Entries (Double-Entry Bookkeeping)
Every transaction affects at least TWO accounts. Debits must equal Credits.
Example: Owner invests P100,000 cash: DEBIT Cash 100,000 | CREDIT Owner's Capital 100,000.
Example: Purchased equipment for P50,000 cash: DEBIT Equipment 50,000 | CREDIT Cash 50,000.
Example: Provided services for P20,000 on credit: DEBIT Accounts Receivable 20,000 | CREDIT
Service Revenue 20,000.
Example: Paid salaries P8,000: DEBIT Salaries Expense 8,000 | CREDIT Cash 8,000.
Example: Collected P10,000 from customers: DEBIT Cash 10,000 | CREDIT Accounts Receivable
10,000.
26.5 Financial Statements
Income Statement (Statement of Profit or Loss)
Net Income = Revenue − Expenses
Shows financial performance over a period (month, quarter, year).
Balance Sheet (Statement of Financial Position)
Assets = Liabilities + Owner's Equity (at a specific date)
Statement of Cash Flows
• Operating activities: day-to-day business (cash from customers, paid to suppliers)
• Investing activities: buying/selling long-term assets
• Financing activities: owner contributions, loans, withdrawals
26.6 Key Accounting Concepts
• Accrual basis: record revenue when earned, expenses when incurred (not when cash moves)
• Matching principle: match expenses to the revenues they helped generate
• Going concern: assume business will continue operating indefinitely
• Conservatism: recognize losses when probable, gains only when realized
• Consistency: use same accounting methods across periods
• Materiality: disclose information that could influence decisions
• Historical cost: record assets at their original purchase price
26.7 Basic Ratios
<b>Ratio</b> <b>Formula</b> <b>Interpretation</b>
Current Ratio Current Assets / Current Liabilities Liquidity; >1 = can pay short-term debts
Quick Ratio (Cash+AR) / Current Liabilities Stricter liquidity test
Debt-to-Equity Total Liabilities / Equity Financial leverage
Gross Profit Margin Gross Profit / Revenue × 100% Profitability before overhead
Net Profit Margin Net Income / Revenue × 100% Overall profitability
Return on Assets Net Income / Total Assets × 100% Asset efficiency
Accounts Receivable Turnover Revenue / Average AR Collection efficiency
Note: For your girlfriend: focus on understanding the accounting equation and journal entries first —
everything else flows from those two concepts!