Movement III: Two Random Variables
EE 520: Random Processes (Fall 2026). Instructor: John Lipor.
A lidar range gate either contains the reflected return of a target or it does not. Over the gate’s integration window a photon counter reports a single number: today it reads . Target, or no target? The honest news is that you have known everything needed to answer this since Session 2. There are two hypotheses, a prior over them, and a measurement whose distribution depends on which hypothesis is true; Bayes’ rule turns that into a posterior, and a decision is the posterior handed to an . Today we do not learn new probability. We organize what we have into the standard vocabulary of detection: likelihood ratios, thresholds, and the two ways a detector can be wrong. The one genuinely new idea is small and powerful, that a broad family of these rules collapses to a single comparison “is the raw reading big enough?”
Let be the latent state: means the target is present (the alternative hypothesis ), means it is absent (the null hypothesis ). Write the prior We observe , whose distribution depends on through the two likelihoods and (densities for continuous , PMFs for discrete ; the theory is identical). A decision rule is any function that reads the data and declares a hypothesis. A rule can fail in exactly two ways:
a false alarm: but ;
a missed detection: but .
These are not symmetric in general, neither in how often they happen nor in what they cost, and keeping them apart is half of detection.
Once is in hand, the posterior over is Session 2’s Bayes’ rule: and likewise for . The most defensible single guess is the more probable state.
Definition 1 (MAP rule). The maximum a posteriori rule declares iff .
The two posteriors share the same denominator (the evidence), so the comparison is between the numerators, . Divide by and the prior collects on one side: read: declare when the top inequality holds. The single quantity , the likelihood ratio, carries the entire evidentiary content of the observation; this is the object Session 2 promised would return as the detection statistic. Everything the data say about enters through , and the prior enters only through the threshold .
When the two states are equally likely a priori, and the rule keeps only the likelihoods.
Definition 2 (ML rule). The maximum likelihood rule is the equal-prior special case of MAP: declare iff , equivalently .
Both rules are the estimators of Session 9 pointed at a two-valued unknown: and , now written as a threshold on .
Remark 1 (Work with the log-likelihood ratio). When is a vector of conditionally independent readings the likelihoods multiply, and it is cleaner to take logarithms: the rule becomes . Products become sums, underflow disappears, and the threshold is a single additive constant. We use the log form in the energy-detector example.
Proposition 1 (MAP minimizes the probability of error). Among all decision rules , the MAP rule minimizes the total error probability .
Proof. Both and are random here: is drawn from the prior and then from , while the rule is a fixed function. Write the error probability as the expectation of an indicator and condition on the observation, using the tower property of Session 9: For the inner expectation, freeze , so that is a fixed or and only remains random. Splitting on the two possible decisions, . Since and are dependent, the condition cannot be dropped, and the posterior appears: with equality exactly when the rule declares whichever state has the larger posterior, which is the MAP rule. Averaging over , and the MAP rule attains the lower bound at every , hence in the average. Choosing the larger posterior pointwise is optimal pointwise, and an average of pointwise-optimal choices is optimal. ◻
Two conditional probabilities summarize any fixed rule: and the total error weights them by the prior, The MAP threshold minimizes this particular weighted sum, the one in which both mistakes count equally per unit prior probability. When the two errors carry different costs, a miss more expensive than a false alarm, the threshold moves off the MAP point: this is precisely Session 7’s expected-utility calculation and the payoff matrix of HW3, and it is why the MAP threshold is only the equal-cost corner of a whole family. We do not develop the cost-weighted rule further here.
Remark 2 (Scope). This is a first course’s detection: MAP and ML, one likelihood ratio, one threshold. The Neyman–Pearson framework (fix , minimize ), the receiver operating characteristic that traces against detection probability as the threshold sweeps, and composite hypotheses with unknown parameters all live in the detection-and-estimation course downstream.
The rule [eq:maplrt] is a comparison on , which can be an awkward function of . Very often it need not be computed at all.
Proposition 2 (Monotone likelihood ratio threshold on the raw data). Suppose is nondecreasing in . Then every MAP or ML rule has the form “declare iff ” for a threshold determined by the prior.
Proof. The rule declares exactly on the set . If is nondecreasing and at some , then for every , so the acceptance set is an upper interval with the smallest value clearing the threshold. Comparing the likelihood ratio to a number has become comparing the reading itself to a number. ◻
This is the practical payoff of the whole session: for the standard sensor models, a detector is one number and one comparison. The next section shows it on the photon counter, and then shows what happens when is not monotone in the raw reading.
A single-photon detector observes the gate for a fixed window. Dark counts alone (no target, ) produce ; a target return adds signal photons, so with a target present (), .
With , the factorials cancel: Since increases in , is monotone, so by the previous section every MAP or ML rule for this sensor is a threshold on the raw count.
Now the Launch’s reading. Seven photons give seven photons are about twice as likely with a target as without. That number is the entire contribution of the data; what we declare depends on the prior. By Session 2’s odds form, the posterior odds are times the prior odds .
If targets and empty gates are equally likely, the posterior odds are , so and MAP declares a target.
If targets are rare, , the prior odds are , the posterior odds are , so and MAP declares no target.
The same seven photons lead to opposite declarations. Nothing about the measurement changed: the skeptical prior raised the bar that must clear from to , and falls between the two. (Sanity check on the direction, which is exactly the pitfall below: a prior leaning toward demands more evidence, a larger , before declaring a target.)
Posterior Action. Detection is the whole course in one gesture: the prior and the likelihoods form the posterior , and the decision is that posterior handed to an . In the photon counter the data fixed once and for all; the prior alone decided which side of the threshold it landed on.
A receiver listens for a weak signal of unknown sign: a zero-mean random waveform that adds power but has no preferred direction. A single sample reads with noise alone () and when the signal is present (), the signal contributing independent variance . The priors are equal.
The tempting answer: “the signal adds energy, so large readings are suspicious; declare a target iff .” This borrows the conclusion of the monotone-likelihood-ratio proposition without checking its hypothesis. Build the likelihood ratio instead, in log form: depends on only through . It is not monotone in : it decreases for and increases for , so the proposition does not apply to , and a reading of is exactly as much evidence for the signal as a reading of . It does apply to , in which is increasing. The ML rule is a threshold on the magnitude (equivalently on the energy ), which is why this is called an energy detector. Standardizing with and , its errors are for a total error of .
The best rule of the tempting one-sided form happens to use the same cut, (where the two densities cross, ), but it ignores the negative half of the line: , , total . MAP optimality guaranteed the two-sided rule would win; the numbers show by how much. Two lessons. First, a threshold on the raw reading needs a monotone , so check monotonicity before reaching for the shortcut, and when it fails, look for the statistic (here ) in which is monotone. Second, equal priors do not make the two errors equal: here is nearly three times , because the two likelihoods differ in shape, not just in location.
(Mechanical.) Let under and under (), with equal priors. Show that , find the ML threshold, and give both error probabilities. (Answers: threshold , the midpoint; both errors .)
(Conceptual.) In the photon example, targets become more common, say . Without computing any tails, use the total-error formula [eq:toterr] to argue whether the MAP rule’s and should be larger or smaller than the ML rule’s, and explain in one sentence why a detector that is told targets are common should tolerate more false alarms. (Answer: now carries weight in the total error and only , so the MAP rule buys a smaller at the price of a larger .)
(Conceptual.) A colleague reports a detector’s “error rate” as a single number. Why is that report incomplete, and what two numbers, plus what third ingredient, would you ask for before trusting it? (Point to , , and the prior weighting of [eq:toterr].)
A probability model answers three questions: what is uncertain, what is observed, and how should observation change belief and action? Detection is the tightest possible instance of all three at once. The uncertain thing is a single bit ; the observation is one reading ; and belief becomes action through a posterior comparison that, for every standard sensor, reduces to a threshold on a single statistic: the raw reading when is monotone in it, and otherwise the quantity in which is monotone, as the energy detector’s showed. The likelihood ratio promised in Session 2 turned out to be the whole story, carrying all the evidence and meeting a threshold set by the prior (and, silently, by costs). Nothing here was new probability; it was Bayes’ rule plus a tie-breaker, organized so that a machine can execute it.
Write the MAP rule as a comparison of to a number. Which number, and what happens to it as the prior grows?
A detector compares to instead of . Using the direction-of-prior sanity check, explain how you would catch the error without redoing the algebra.
Why does the “monotone likelihood ratio” property matter in practice, and what does it let you avoid computing?
Pitfall. Three errors recur, and each has a cheap sanity check. (i) Inverting the likelihood ratio. , signal over noise; writing it upside down flips every declaration. Check that is large where the target hypothesis fits the data better. (ii) Comparing to instead of . The threshold is the prior odds against a target. Sanity check by direction: a prior that leans toward should raise the bar on , so the skeptical prior must sit in the numerator of the threshold, not the denominator. (iii) Computing under the wrong hypothesis. A false alarm is an event of the noise world, so is a probability under ; if you find yourself integrating the target likelihood to get a false-alarm rate, you have swapped the hypotheses.