Chapter 6 — Calculus II
Lesson map
Lesson 06 published. Map, example, EX016.
flowchart TD
N0["Learning outcomes"]
N1["6.1 Accumulating rates"]
N2["6.2 Exposure windows"]
N3["Lab — Exposure under two update intervals"]
N4["6.3 Series and repeated small risks"]
N5["Synthesis"]
N0 --> N1 --> N2 --> N3 --> N4 --> N5
N5 --> EX["Worked example"]
EX --> Q["Exercise EX016"]
Logical drawing
flowchart LR
N0["Learning outcomes"]
N1["6.1 Accumulating rates"]
N2["6.2 Exposure windows"]
N3["Lab — Exposure under two update intervals"]
N4["6.3 Series and repeated small risks"]
N5["Synthesis"]
N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> Q["EX016"]
[Learning outcomes]
|
v
[6.1 Accumulating rates]
|
v
[6.2 Exposure windows]
|
v
[Lab — Exposure under two update intervals]
|
v
[6.3 Series and repeated small risks]
|
v
[Synthesis]
|
v
[Worked example] --> [Exercise EX016]
Learning outcomes
You will (1) use integrals to accumulate rates over time; (2) estimate exposure windows from changing rates; (3) apply series approximations to reason about repeated small risks.
6.1 Accumulating rates
Calculus II introduces integration: summing a rate over time to get a total. Daniel gives Sofia a synthetic curve of fraudulent tap attempts per hour across a day, rising at rush hour and falling at night. The total number of attempts is the area under the curve. She approximates the integral with the trapezoid rule using hourly samples. Integration appears whenever a security quantity is a rate: bytes per second of exfiltration, failed logins per minute or exposure per day. Totals, not peaks alone, often determine the business impact that architects must explain.
6.2 Exposure windows
Corvia's deny lists update hourly, so a stolen card remains usable until the next update. If thefts happen at a varying rate through the day, the expected misuse depends on the rate integrated over each exposure window. Sofia computes expected misuse for hourly and quarter-hourly updates by integrating the synthetic theft-use rate multiplied by the average remaining window. The lab below compares the two update intervals. Quarter-hourly updates cut expected misuse substantially, and the result gives the finance director a number to weigh against the data cost discussed in chapter 5.
Lab — Exposure under two update intervals
# Expected misuse of stolen cards before deny-list update; synthetic hourly theft-use rate.
rate = [0.2]*6 + [1.5, 3.0, 2.5, 1.0, 0.8, 0.9, 1.2, 0.9, 0.8, 1.0, 2.0, 3.2, 2.6, 1.1, 0.6, 0.4] + [0.2]*2
assert len(rate) == 24
def misuse(update_h): # each use happens on average update_h/2 hours before the list catches up
return sum(r * update_h / 2 for r in rate) * 1.0
print(f"daily theft-use events: {sum(rate):.1f}")
for h in (1.0, 0.25):
print(f"update every {h*60:.0f} min -> expected misuse {misuse(h):.1f} uses/day")
import math
p, n = 0.001, 800
print(f"P(at least one error) exact {1 - (1 - p)**n:.2f}, n*p approx {n*p:.2f}")
Run with python3 lab_exposure.py. Verified output:
daily theft-use events: 25.1
update every 60 min -> expected misuse 12.6 uses/day
update every 15 min -> expected misuse 3.1 uses/day
P(at least one error) exact 0.55, n*p approx 0.80
6.3 Series and repeated small risks
Small risks repeated many times add up. If each of many independent fare validators has a small probability p of a configuration error in a month, the probability that at least one has an error is 1 minus (1 minus p) to the power n. For small p, a series approximation gives roughly n times p, which is easy to compute mentally. Sofia uses this to show that a one-in-a-thousand error rate across eight hundred validators means a high chance of at least one error each month, an argument for automated configuration checking rather than hoping each device is right.
Worked example
Sofia integrates a synthetic fraud-rate curve, compares expected misuse under hourly and quarter-hourly updates and uses a series approximation to argue for automated validator checks.
Synthetic case. Rates, validator counts and costs are synthetic.
Errors and limits
Integrals of estimated rates inherit the estimates' errors. The n times p approximation breaks down when n times p is not small.
Exercises
- EX016 — Area meaning. What does the area under the fraud-attempt curve represent? Rubric: 3 = the total number of attempts over the day;; 2 = total;; 1 = peak;; 0 = none.
- EX017 — Update comparison. According to the lab, how does expected misuse change from hourly to quarter-hourly updates? Rubric: 3 = falls to about a quarter, from 12.6 to 3.1 uses;; 2 = falls;; 1 = rises;; 0 = none.
- EX018 — At least one error. With p = 0.001 and n = 800, what is the approximate chance of at least one error? Rubric: 3 = about 0.55 (exact) or 0.8 by n p, which overestimates here;; 2 = approx;; 1 = 0.001;; 0 = none.
Synthesis
Integration and series turn rates and repeated small risks into totals that justify architecture choices.
Continue studying — chapter 06 of 50
← Chapter 05 (draft) · Course chapter index · Chapter 07 (draft) →