How do you read the median and the p90 latency off a theoretical CDF F(t)?
answer
- y-axis probability, x-axis value
- invert the curve, do not read heights
- smallest t with F(t) at least 0.9
- S(t) = 1 - F(t)
- flat stretches make quantiles non-unique
basics
~10 sInvert the CDF rather than reading heights: the median is the smallest t with F(t) at least 0.5, and the p90 the smallest t with F(t) at least 0.9.
solid answer
~50 sThe CDF is `F(t) = P(X <= t)`, so quantiles are found by inverting it rather than by reading heights. The median is the smallest t with `F(t) >= 0.5` and the p90 is the smallest t with `F(t) >= 0.9`; graphically you start on the vertical axis at 0.5 or 0.9, move right to the curve, and drop down to the time axis. The same curve answers threshold questions in the other direction through the survival function `S(t) = 1 - F(t) = P(X > t)`, so the fraction of requests slower than 500 ms is `S(500)`, and the p90 is equivalently the t where `S(t)` first drops to 0.1. Two edge cases matter: where F is flat there is no mass, so the quantile is non-unique and the convention takes the smallest such t; where F jumps, some probability levels are never attained exactly.
go deeper
Be ready to state that F(t) is the probability of being at or below t, and that a percentile is found by entering the plot on the probability axis and reading a value off the horizontal axis, not the other way round.
An interviewer expects the exact definitions: median is the smallest t with F(t) at least 0.5, p90 the smallest t with F(t) at least 0.9, and the survival function S(t) = 1 - F(t) answers threshold questions. Interval probabilities are F(b) - F(a).
Demonstrate the edge cases in operational terms: flat regions make a quantile non-unique, jumps mean a probability level may never be attained exactly, and heavy tails are far easier to reason about on the survival curve than on a CDF pinned near 1.
Own which summary the organisation reports. Decide when a threshold breach rate is the better service objective than a percentile, given that percentiles invert a curve that may be flat or jumpy, and set one convention so teams do not quote incompatible tail numbers.
## What the CDF is For any random variable X — discrete, continuous or a mixture — the cumulative distribution function is ``` F(t) = P(X <= t) ``` Unlike a PMF or a PDF, it always exists and always means the same thing: the probability accumulated at or below t. Its required properties follow directly: - **Non-decreasing.** For `a < b`, `F(b) - F(a) = P(a < X <= b) >= 0`, so the curve can never go down. - **Limits 0 and 1.** `F(t) -> 0` as t goes to negative infinity and `F(t) -> 1` as t goes to positive infinity. - **Right-continuous.** This is a consequence of defining F with `<=` rather than `<`; at a jump, the value at the jump point is the upper one. - **Interval probabilities by subtraction.** `P(a < X <= b) = F(b) - F(a)` — the single most useful line in practice. ## Reading quantiles: invert, do not read heights A quantile is a value on the x-axis, so you enter the plot from the y-axis. Formally the quantile function is ``` Q(p) = the smallest t such that F(t) >= p ``` - **Median** = `Q(0.5)`: the smallest t with `F(t) >= 0.5`. Half the probability sits at or below it. - **p90** = `Q(0.9)`: the smallest t with `F(t) >= 0.9`. Nine tenths of requests are at or faster than it. Graphically: find 0.9 on the vertical axis, travel horizontally until you meet the curve, then drop straight down to the time axis and read the latency. The classic error is doing it the other way round — reading `F(t)` at some t and calling that a percentile. `F(t)` is a probability; a percentile is a value of t. A second classic error is direction: p90 is where `F(t)` first reaches **0.9**, not 0.1. The 0.1 level gives the p10, the fast end. ## The survival function Many operational questions are naturally phrased about the tail, and the survival function is the same information mirrored: ``` S(t) = 1 - F(t) = P(X > t) ``` It starts at 1, is non-increasing, and tends to 0. Uses: - "What share of requests breach a 500 ms threshold?" is `S(500)`. - "What is the p90?" is equivalently "the smallest t where `S(t)` first falls to 0.1". - "What share of requests land between 200 ms and 500 ms?" is `S(200) - S(500)`, which equals `F(500) - F(200)`. When a distribution is heavy-tailed, the survival curve is the more legible of the two, because the interesting behaviour is where F is crawling from 0.99 to 1 and visually flat. ## The two edge cases interviewers probe **Flat stretches.** If F is constant across an interval, no probability lives there. If it happens to be flat at exactly the level 0.5, then every t across that whole flat run satisfies `F(t) >= 0.5` at its right end and the median is not unique; the "smallest t" convention picks a single representative. This is why the definition uses an inequality and a smallest-value rule rather than solving `F(t) = 0.5`. **Jumps.** Discrete or mixed variables have jumps in F, and then a level like 0.9 may be skipped over entirely: F leaps from 0.85 to 0.93 at some t, and no value satisfies `F(t) = 0.9`. The `F(t) >= p` formulation still returns that jump point, which is why it is stated as an inequality. It is also why quantiles of discrete variables can look coarse — several probability levels map to the same value. ## Why the CDF is the object worth reasoning in Densities are shape-friendly but their heights are not probabilities; PMFs only exist for discrete variables. The CDF gives you probabilities directly, in `[0, 1]`, for any variable, and it supports the operations you actually want: threshold probabilities by evaluation, interval probabilities by subtraction, quantiles by inversion, tails through `S(t)`. ## How to say it in an interview "F(t) is `P(X <= t)`, so I invert it: the median is the smallest t with `F(t) >= 0.5`, the p90 the smallest t with `F(t) >= 0.9`. On a plot, enter at 0.9 on the y-axis, go across to the curve, drop to the x-axis. For SLO questions I flip to `S(t) = 1 - F(t)`, so the breach rate at 500 ms is `S(500)`. Watch for flat stretches, where the quantile is non-unique, and jumps, where a level is never hit exactly."
- What does a flat stretch in a CDF tell you about the quantile there?A flat region carries no probability mass — nothing lands in that range. If the flat level coincides with the probability you are inverting, the quantile is not unique: a whole interval of values satisfies the condition. The standard convention resolves it by taking the smallest such t, which is why the quantile is defined with `F(t) >= p` rather than an equality.
- How do you express the tail beyond 500 ms using F?As `S(500) = 1 - F(500) = P(X > 500)`. The survival function is the CDF mirrored, starting at 1 and decreasing to 0, and it makes threshold questions read directly. A share between two thresholds is `S(200) - S(500)`, which is the same as `F(500) - F(200)`.
- Why must a CDF be non-decreasing and right-continuous?Non-decreasing because `F(b) - F(a) = P(a < X <= b)` is a probability and therefore never negative. Right-continuous because F is defined with `<=`: at a jump point the mass sitting exactly at t is already included, so the function takes the upper value there. A decreasing CDF would imply a negative interval probability.
- If a CDF jumps from 0.85 to 0.93 at t = 300, what is the p90?It is 300. No value satisfies `F(t) = 0.9` exactly, because the level 0.9 is skipped by the jump. The definition "smallest t with `F(t) >= 0.9`" still returns 300, which is exactly why quantiles are defined with an inequality rather than by solving an equation.
saying these in an interview costs you the question
- Reads the CDF's height at some t as the percentile
- Says the p90 is where F(t) equals 0.1
- Treats the CDF curve as if it were a density
- Claims a CDF can decrease over some range
- Writes the survival function as 1 divided by F(t)