Frontend Labs
⋯

Part 4 — Putting It Together

Nothing new to learn from here on — this Part is the reference layer: a formula cheat sheet, an index of every named theorem, hands-on practice labs ordered by difficulty, a role-based further-reading map back into the 29 chapters, and an honest table of what this guide deliberately left out and where it actually lives.

Formula cheat sheet

NUMBER SYSTEMS
  bits needed for n values         = ceil(log2(n))
  n-bit signed integer range       = [-2^(n-1), 2^(n-1) - 1]

PROBABILITY & STATISTICS
  P(A ∪ B)                          = P(A) + P(B) - P(A ∩ B)
  P(A|B)  [Bayes]                   = P(B|A)·P(A) / P(B)
  variance                          = (1/n)·Σ(xi - mean)²
  std dev                           = sqrt(variance)
  binomial P(k successes of n)      = C(n,k)·p^k·(1-p)^(n-k)
  poisson P(k events, rate λ)       = (λ^k · e^-λ) / k!

COMBINATORICS
  permutations                      = n! / (n-k)!
  combinations                      = n! / (k!(n-k)!)
  keyspace size                     = alphabet_size ^ length

INFORMATION THEORY
  entropy (bits)                    = -Σ p(x)·log2(p(x))
  password entropy                  = log2(keyspace_size) = length · log2(alphabet_size)
  KL divergence                     = Σ p(x)·log2(p(x)/q(x))
  Shannon channel capacity          = B · log2(1 + S/N)

NUMBER THEORY (Ch. 19)
  Bézout / extended Euclid          a·x + b·y = gcd(a, b)
  Fermat's little theorem           a^(p-1) ≡ 1 (mod p)
  Euler's theorem                   a^φ(n) ≡ 1 (mod n),  gcd(a,n) = 1
  prime density                     ≈ 1 / ln N
  Miller-Rabin error after k rounds ≤ 4^(-k)
  RSA-CRT fault attack              gcd(s'^e - m, n) = q

CRYPTOGRAPHY
  RSA: n = p·q, φ(n) = (p-1)(q-1), d = e^-1 mod φ(n)
  RSA correctness                   m^(ed) = m^(1 + kφ(n)) ≡ m (mod n)
  EC point add slope                λ = (y₂-y₁)/(x₂-x₁),  doubling λ = (3x₁²+a)/(2y₁)
  EC sum                            x₃ = λ² - x₁ - x₂,  y₃ = λ(x₁ - x₃) - y₁
  ECDSA nonce reuse                 k = (z₁-z₂)/(s₁-s₂),  d = (s·k - z)/r   (mod n)
  birthday, 50% collision           k ≈ 1.18 · √N
  LWE                               b = A·s + e (mod q)
  Diffie-Hellman shared secret      = g^(a·b) mod p   (computed as (g^b)^a = (g^a)^b)
  birthday-bound collision attempts ≈ 2^(hash_bits / 2)
  brute-force expected time         = 2^(entropy_bits) / (2 · guesses_per_second)

NETWORKING
  M/M/1 queue length distribution   P(n) = (1-ρ)·ρⁿ,  P(n ≥ k) = ρᵏ,  L = ρ/(1-ρ)
  Kingman (G/G/1 wait)              W_q ≈ (ρ/(1-ρ)) · ((c_a² + c_s²)/2) · τ
  Erlang C                          P(wait) for c servers at load a = λ/μ
  router buffer (many flows)        BDP / √n
  max-flow = min-cut                (Ford-Fulkerson)
  spanning trees                    det(Laplacian minus one row and column)
  DFT                               X_k = Σ x_n · e^(-2πi·kn/N)
  Nyquist                           f_s > 2·f_max
  decibels                          10·log₁₀(P₁/P₂);  +3 dB ≈ ×2
  free-space path loss (dB)         20·log₁₀(d) + 20·log₁₀(f) - 147.55
  QAM SNR floor                     2^(bits/symbol) - 1
  subnet addresses                  = 2^(32 - cidr_bits)
  bandwidth-delay product           = bandwidth × RTT
  Little's Law                      = L (items in system) = λ (arrival rate) · W (time in system)
  M/M/1 average wait                = 1 / (service_rate - arrival_rate)

PROBABILITY DEEPER (Ch. 8, 14)
  conditional probability           P(A|B) = P(A ∩ B) / P(B)
  total probability                 P(A) = Σ P(A|Bᵢ)·P(Bᵢ)
  expectation                       E[X] = Σ x·P(X=x)   or   ∫ x·f(x) dx
  linearity (always holds)          E[X + Y] = E[X] + E[Y]
  variance shortcut                 Var(X) = E[X²] - (E[X])²
  normal density                    f(x) = 1/(σ√(2π)) · e^(-(x-μ)²/(2σ²))
  standard error (CLT)              σ / √n
  Hoeffding sample size             n ≥ ln(2/δ) / (2ε²)
  zero failures in n trials         95% upper bound ≈ 3/n
  Beta update                       Beta(α, β) + k of n  ->  Beta(α+k, β+n-k)

STATISTICS DEEPER (Ch. 9, 22)
  z-score                           z = (x - μ) / σ
  correlation                       r = Cov(X,Y) / (s_X · s_Y)
  EWMA                              S = (1-α)·S + α·x
  TCP RTO (RFC 6298)                RTO = SRTT + 4·RTTVAR
  CI for a proportion               p̂ ± 1.96·√(p̂(1-p̂)/n)
  A/B sample size per group         (z_(α/2) + z_β)² · [p₁(1-p₁) + p₂(1-p₂)] / δ²

LINEAR ALGEBRA (Ch. 10, 11, 20)
  dot product, geometric            A·B = ‖A‖‖B‖cos θ
  dense layer                       h = ReLU(W·x + b)
  least squares                     w = (XᵀX)⁻¹ Xᵀ y
  eigen-equation                    A·v = λ·v,  solve det(A - λI) = 0
  matrix powers                     Aᵏ = P·Dᵏ·P⁻¹
  PageRank                          PR = (1-d)/N + d·M·PR
  Markov steady state               π·P = π
  graph Laplacian                   L = D - A   (λ₂ = algebraic connectivity)
  SVD                               A = U·Σ·Vᵀ,  ‖A - Aₖ‖²_F = Σ_{i>k} σᵢ²
  attention                         softmax(Q·Kᵀ / √d_k)·V

CALCULUS / ML
  derivative                        f'(x) = lim(h→0) [f(x+h) - f(x)] / h
  sigmoid derivative                σ'(x) = σ(x)·(1 - σ(x))
  Taylor (2nd order)                f(x+Δ) ≈ f(x) + ∇fᵀΔ + ½ΔᵀHΔ
  Newton's method                   x_{n+1} = x_n - f(x_n)/f'(x_n)
  Fundamental Theorem               ∫ₐᵇ f(x) dx = F(b) - F(a)
  Gaussian integral                 ∫ e^(-x²) dx = √π
  gradient descent update           = w_new = w_old - learning_rate · ∇Loss(w_old)
  chain rule                        = dy/dx = f'(g(x)) · g'(x)
  linear layer backprop             ∂L/∂W = δ·xᵀ,   ∂L/∂x = Wᵀ·δ
  softmax + cross-entropy gradient  ∂L/∂z = p - y
  stable learning rate              η < 2 / λ_max(Hessian)
  Adam step                         w -= η · m̂ / (√v̂ + ε)
  Mathis TCP throughput             ≈ (MSS/RTT) · 1.22/√p

SECURITY (Ch. 23, 26, 28)
  min-entropy                       H∞ = -log₂(max p(x))
  precision from base rate π        TPR·π / (TPR·π + FPR·(1-π))
  cost-optimal alert threshold      P(attack|evidence) > C_FP / (C_FP + C_FN)
  AUC                               P(score(attack) > score(benign))
  differential privacy              P[M(D)∈S] ≤ e^ε · P[M(D')∈S],  Laplace scale Δf/ε
  slow-hash bonus bits              log₂(slowdown factor)
  FGSM                              δ = ε · sign(∇ₓ Loss)
  P(breach) with n weaknesses       1 - (1-p)ⁿ

CONTROL THEORY
  PID output = Kp·error + Ki·∫error·dt + Kd·(d(error)/dt)
  P-loop stability                  0 < K < 2   (one tick of delay: K < 1)
  P-only steady-state error         D / (1 + K)
  Kubernetes HPA                    ceil(replicas · current / target)

Generated from real-life-maths-guide.md · 8 Oct 2026 16:36