Quant Sandbox
DerivativesPortfolio & RiskFixed IncomeCorporate FinanceProbability & MeasureStochastic ModelsMarket MicrostructureGuide
Probability & Measure
Probability Space
σ-Algebras
InformationFiltration
Lebesgue Measure
Random Variables
SpinnerDistribution function
Lebesgue Integral
Riemann vs LebesgueExpectation by sorting
Convergence
Escaping massModes of convergence
Conditional Expectation
Best guessChange of measure
Connected Guides
  • The Lebesgue integral
  • Expectation, variance and inequalities
  • Probability spaces, σ-algebras and random variables
  • Monte Carlo option pricing

© 2026 Quant Sandbox · A study aid for quantitative finance

Privacy & dataNo cookies

This site does not use cookies and asks for no personal data. It keeps a few small settings in your browser's local storage — your chosen theme and language, the sidebar layout, and your progress and answers in the Guides — so it remembers them on your next visit. This data never leaves your device; clearing your browser storage removes it. Inputs you change can also be captured in the page URL, so you can share or bookmark a specific setup. The site uses Vercel Web Analytics, a privacy-friendly, cookieless service that records only anonymous, aggregated usage (such as page views) without identifying you or tracking you across other sites.

Lebesgue integral

Controls

Integrand f on [0, 1]
Slices
8
164
8
164
Level under the cursor
y = 0.50λ{f > y} = 0.707

Hover the right-hand chart to pick a level.

Two ways to add up the same area
Riemann · slice the outcomes0.671900.51Lebesgue · slice the values0.595600.510.250.50.75{f > 0.5}: length 0.7072/3101248163264both sums approach 2/3 as the slices get finer
Riemann, 8 midpoints
0.6719
Lebesgue, 8 levels
0.5956
exact ∫ f dλ
0.6667
the Lebesgue sum only needs
λ{f > y} for each level y

About this tool

The Riemann integral adds up height times width as you walk along the x-axis. The Lebesgue integral slices the y-axis instead: it adds each level times the length of the set where the function reaches that level. For nice functions the two agree. The Lebesgue version keeps working when a function jumps everywhere and needs no order of the points at all, which is why expectations are Lebesgue integrals. These pages compare the two ways on one area and compute an expected score by sorting.

Frequently asked questions

What is the difference between Riemann and Lebesgue integrals?

Riemann cuts the domain into thin strips and adds strip width times a height. Lebesgue cuts the range into levels and adds each level times the measure of the set where the function takes about that value. The Lebesgue sum only needs the size of such sets, not a left-to-right order, so it also works on boards, path spaces and any other measure space. On continuous functions both give the same number.

Why does expectation sort by value?

The expected value of X is the sum over values of value times the probability of getting it. That is already a Lebesgue sum: you group outcomes by the value X takes and weigh each group by its probability. For a dart board, sort the board into regions that score 10, 5, 2, 1 and 0 and add score times area. No coordinates are needed, and the same recipe works for a random price path.

What should I try on the pages?

On the first page choose an integrand and refine the Riemann strips and the Lebesgue levels: both sums approach the same area on a smooth function. Then pick the Dirichlet function, one on the rationals and zero elsewhere. Riemann strips never settle, while the Lebesgue sum is exactly 0. On the second page, switch the thrower from uniform to aimed: the scores stay put and only the measure changes.

Is the Lebesgue integral just a fancier way to get the same number?

For functions both methods can handle, yes. The gain is reach and good behaviour: more functions are integrable, and limits of functions pass through the integral under clear conditions, the convergence theorems. That is what lets you swap a limit and an expectation in proofs and in Monte Carlo arguments. The Riemann integral cannot give that, which is why modern probability is stated in Lebesgue terms.

Learn the theory

  • The Lebesgue integral — Integrals built from simple functions by slicing the range: the layer-cake formula, integrable functions, sums as integrals, and Riemann versus Lebesgue.
  • Expectation, variance and inequalities — Expectation as an integral, computed from the distribution or from tails; linearity, variance and moments; the Markov, Chebyshev and Jensen inequalities.
  • Probability spaces, σ-algebras and random variables — Sample space, σ-algebra, probability measure, measurable maps and the σ-algebra generated by a variable.
  • Monte Carlo option pricing — Estimating option prices by simulation: standard error, confidence intervals and convergence to Black–Scholes.