This paper presents and illustrates the formula used by the Oracle(TM) Cost Based Optimizer to estimate
the cardinality of an equijoin, when both the columns referenced in the join predicate have histograms collected.

Practical implications (and possible pitfalls) are illustrated as well.

The supporting material is here.

------------

A distilled version of the full paper can be found in this short article, originally published in the IOUG SELECT Journal.
The first section is also a quick introduction to Histograms in general.