01Agreeing on a secret in public
Both sides need the same symmetric key, but everything they send can be observed. Diffie–Hellman solves this: each side picks a private value, sends a corresponding public value, and combines its own private value with the other's public value. Both arrive at the same shared secret — and an observer, who sees only the public values, cannot compute it.
Real implementations use elliptic curves (ECDHE) or finite-field groups (DHE). The mathematics differs; the shape of the exchange is the same.