# Probability density function #

This file defines the probability density function of random variables, by which we mean measurable functions taking values in a Borel space. The probability density function is defined as the Radon–Nikodym derivative of the law of X. In particular, a measurable function f is said to the probability density function of a random variable X if for all measurable sets S, ℙ(X ∈ S) = ∫ x in S, f x dx. Probability density functions are one way of describing the distribution of a random variable, and are useful for calculating probabilities and finding moments (although the latter is better achieved with moment generating functions).

This file also defines the continuous uniform distribution and proves some properties about random variables with this distribution.

## Main definitions #

• MeasureTheory.HasPDF : A random variable X : Ω → E is said to HasPDF with respect to the measure ℙ on Ω and μ on E if the push-forward measure of ℙ along X is absolutely continuous with respect to μ and they HaveLebesgueDecomposition.
• MeasureTheory.pdf : If X is a random variable that HasPDF X ℙ μ, then pdf X is the Radon–Nikodym derivative of the push-forward measure of ℙ along X with respect to μ.
• MeasureTheory.pdf.IsUniform : A random variable X is said to follow the uniform distribution if it has a constant probability density function with a compact, non-null support.

## Main results #

• MeasureTheory.pdf.integral_pdf_smul : Law of the unconscious statistician, i.e. if a random variable X : Ω → E has pdf f, then 𝔼(g(X)) = ∫ x, f x • g x dx for all measurable g : E → F.
• MeasureTheory.pdf.integral_mul_eq_integral : A real-valued random variable X with pdf f has expectation ∫ x, x * f x dx.
• MeasureTheory.pdf.IsUniform.integral_eq : If X follows the uniform distribution with its pdf having support s, then X has expectation (λ s)⁻¹ * ∫ x in s, x dx where λ is the Lebesgue measure.

## TODO #

Ultimately, we would also like to define characteristic functions to describe distributions as it exists for all random variables. However, to define this, we will need Fourier transforms which we currently do not have.

class MeasureTheory.HasPDF {Ω : Type u_1} {E : Type u_2} [] {m : } (X : ΩE) (ℙ : ) (μ : ) :

A random variable X : Ω → E is said to HasPDF with respect to the measure ℙ on Ω and μ on E if the push-forward measure of ℙ along X is absolutely continuous with respect to μ and they HaveLebesgueDecomposition.

• pdf' : .HaveLebesgueDecomposition μ .AbsolutelyContinuous μ
Instances
theorem MeasureTheory.HasPDF.pdf' {Ω : Type u_1} {E : Type u_2} [] {m : } {X : ΩE} {ℙ : } {μ : } [self : ] :
.HaveLebesgueDecomposition μ .AbsolutelyContinuous μ
theorem MeasureTheory.hasPDF_iff {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } {X : ΩE} { : } {μ : }, .HaveLebesgueDecomposition μ .AbsolutelyContinuous μ
theorem MeasureTheory.hasPDF_iff_of_aemeasurable {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } {X : ΩE} { : } {μ : }, ( .HaveLebesgueDecomposition μ .AbsolutelyContinuous μ)
theorem MeasureTheory.HasPDF.aemeasurable {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } (X : ΩE) ( : ) (μ : ) [hX : ],
instance MeasureTheory.HasPDF.haveLebesgueDecomposition {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } {X : ΩE} { : } {μ : } [hX : ], .HaveLebesgueDecomposition μ
Equations
• =
theorem MeasureTheory.HasPDF.absolutelyContinuous {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } {X : ΩE} { : } {μ : } [hX : ], .AbsolutelyContinuous μ
theorem MeasureTheory.HasPDF.quasiMeasurePreserving_of_measurable {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } (X : ΩE) ( : ) (μ : ) [inst : ],

A random variable that HasPDF is quasi-measure preserving.

theorem MeasureTheory.HasPDF.congr {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } {X Y : ΩE} { : } {μ : }, X =ᵐ[] Y∀ [hX : ],
theorem MeasureTheory.HasPDF.congr' {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } {X Y : ΩE} { : } {μ : }, X =ᵐ[] Y( )
theorem MeasureTheory.hasPDF_of_map_eq_withDensity {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } {X : ΩE} { : } {μ : }, ∀ (f : EENNReal), = μ.withDensity f

X HasPDF if there is a pdf f such that map X ℙ = μ.withDensity f.

def MeasureTheory.pdf {Ω : Type u_1} {E : Type u_2} [] :
{x : } → (ΩE)EENNReal

If X is a random variable, then pdf X is the Radon–Nikodym derivative of the push-forward measure of ℙ along X with respect to μ.

Equations
• = .rnDeriv μ
Instances For
theorem MeasureTheory.pdf_def {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } { : } {μ : } {X : ΩE}, = .rnDeriv μ
theorem MeasureTheory.pdf_of_not_aemeasurable {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } { : } {μ : } {X : ΩE}, ¬ =ᵐ[μ] 0
theorem MeasureTheory.pdf_of_not_haveLebesgueDecomposition {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } { : } {μ : } {X : ΩE}, ¬.HaveLebesgueDecomposition μ = 0
theorem MeasureTheory.aemeasurable_of_pdf_ne_zero {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } (X : ΩE) (h : ¬ =ᵐ[μ] 0) :
theorem MeasureTheory.hasPDF_of_pdf_ne_zero {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {X : ΩE} (hac : .AbsolutelyContinuous μ) (hpdf : ¬ =ᵐ[μ] 0) :
theorem MeasureTheory.measurable_pdf {Ω : Type u_1} {E : Type u_2} [] {m : } (X : ΩE) (ℙ : ) (μ : ) :
theorem MeasureTheory.withDensity_pdf_le_map {Ω : Type u_1} {E : Type u_2} [] :
∀ {x : } (X : ΩE) ( : ) (μ : ),
theorem MeasureTheory.setLIntegral_pdf_le_map {Ω : Type u_1} {E : Type u_2} [] {m : } (X : ΩE) (ℙ : ) (μ : ) (s : Set E) :
∫⁻ (x : E) in s, μ s
@[deprecated MeasureTheory.setLIntegral_pdf_le_map]
theorem MeasureTheory.set_lintegral_pdf_le_map {Ω : Type u_1} {E : Type u_2} [] {m : } (X : ΩE) (ℙ : ) (μ : ) (s : Set E) :
∫⁻ (x : E) in s, μ s

Alias of MeasureTheory.setLIntegral_pdf_le_map.

theorem MeasureTheory.map_eq_withDensity_pdf {Ω : Type u_1} {E : Type u_2} [] {m : } (X : ΩE) (ℙ : ) (μ : ) [hX : ] :
theorem MeasureTheory.map_eq_setLIntegral_pdf {Ω : Type u_1} {E : Type u_2} [] {m : } (X : ΩE) (ℙ : ) (μ : ) [hX : ] {s : Set E} (hs : ) :
s = ∫⁻ (x : E) in s, μ
@[deprecated MeasureTheory.map_eq_setLIntegral_pdf]
theorem MeasureTheory.map_eq_set_lintegral_pdf {Ω : Type u_1} {E : Type u_2} [] {m : } (X : ΩE) (ℙ : ) (μ : ) [hX : ] {s : Set E} (hs : ) :
s = ∫⁻ (x : E) in s, μ

Alias of MeasureTheory.map_eq_setLIntegral_pdf.

theorem MeasureTheory.pdf.congr {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {X : ΩE} {Y : ΩE} (hXY : X =ᵐ[] Y) :
=
theorem MeasureTheory.pdf.lintegral_eq_measure_univ {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {X : ΩE} [] :
∫⁻ (x : E), μ = Set.univ
theorem MeasureTheory.pdf.eq_of_map_eq_withDensity {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {X : ΩE} [] (f : EENNReal) (hmf : ) :
= μ.withDensity f =ᵐ[μ] f
theorem MeasureTheory.pdf.eq_of_map_eq_withDensity' {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {X : ΩE} [] (f : EENNReal) (hmf : ) :
= μ.withDensity f =ᵐ[μ] f
theorem MeasureTheory.pdf.ae_lt_top {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {X : ΩE} :
∀ᵐ (x : E) ∂μ, <
theorem MeasureTheory.pdf.ofReal_toReal_ae_eq {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {X : ΩE} :
(fun (x : E) => ENNReal.ofReal ().toReal) =ᵐ[μ]
theorem MeasureTheory.pdf.lintegral_pdf_mul {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {X : ΩE} [] {f : EENNReal} (hf : ) :
∫⁻ (x : E), * f xμ = ∫⁻ (x : Ω), f (X x)

The Law of the Unconscious Statistician for nonnegative random variables.

theorem MeasureTheory.pdf.integrable_pdf_smul_iff {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {F : Type u_3} [] {X : ΩE} [] {f : EF} (hf : ) :
MeasureTheory.Integrable (fun (x : E) => ().toReal f x) μ MeasureTheory.Integrable (fun (x : Ω) => f (X x))
theorem MeasureTheory.pdf.integral_pdf_smul {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {F : Type u_3} [] {X : ΩE} [] {f : EF} (hf : ) :
∫ (x : E), ().toReal f xμ = ∫ (x : Ω), f (X x)

The Law of the Unconscious Statistician: Given a random variable X and a measurable function f, f ∘ X is a random variable with expectation ∫ x, pdf X x • f x ∂μ where μ is a measure on the codomain of X.

theorem MeasureTheory.pdf.quasiMeasurePreserving_hasPDF {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {F : Type u_3} [] {ν : } {X : ΩE} [] (hX : ) {g : EF} (hg : ) (hmap : .HaveLebesgueDecomposition ν) :

A random variable that HasPDF transformed under a QuasiMeasurePreserving map also HasPDF if (map g (map X ℙ)).HaveLebesgueDecomposition μ.

quasiMeasurePreserving_hasPDF is more useful in the case we are working with a probability measure and a real-valued random variable.

theorem MeasureTheory.pdf.quasiMeasurePreserving_hasPDF' {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {F : Type u_3} [] {ν : } {X : ΩE} [] (hX : ) {g : EF} (hg : ) :
theorem Real.hasPDF_iff_of_aemeasurable {Ω : Type u_1} {m : } {ℙ : } {X : Ω} (hX : ) :
MeasureTheory.HasPDF X MeasureTheory.volume .AbsolutelyContinuous MeasureTheory.volume

A real-valued random variable X HasPDF X ℙ λ (where λ is the Lebesgue measure) if and only if the push-forward measure of ℙ along X is absolutely continuous with respect to λ.

theorem Real.hasPDF_iff {Ω : Type u_1} {m : } {ℙ : } {X : Ω} :
MeasureTheory.HasPDF X MeasureTheory.volume .AbsolutelyContinuous MeasureTheory.volume
theorem MeasureTheory.pdf.integral_mul_eq_integral {Ω : Type u_1} {m : } {ℙ : } {X : Ω} [MeasureTheory.HasPDF X MeasureTheory.volume] :
∫ (x : ), x * (MeasureTheory.pdf X MeasureTheory.volume x).toReal = ∫ (x : Ω), X x

If X is a real-valued random variable that has pdf f, then the expectation of X equals ∫ x, x * f x ∂λ where λ is the Lebesgue measure.

theorem MeasureTheory.pdf.hasFiniteIntegral_mul {Ω : Type u_1} {m : } {ℙ : } {X : Ω} {f : } {g : } (hg : MeasureTheory.pdf X MeasureTheory.volume =ᵐ[MeasureTheory.volume] g) (hgi : ∫⁻ (x : ), f x‖₊ * g x ) :
MeasureTheory.HasFiniteIntegral (fun (x : ) => f x * (MeasureTheory.pdf X MeasureTheory.volume x).toReal) MeasureTheory.volume
theorem MeasureTheory.pdf.indepFun_iff_pdf_prod_eq_pdf_mul_pdf {Ω : Type u_1} {E : Type u_2} [] {m : } {ℙ : } {μ : } {F : Type u_3} [] {ν : } {X : ΩE} {Y : ΩF} [MeasureTheory.HasPDF (fun (ω : Ω) => (X ω, Y ω)) (μ.prod ν)] :
MeasureTheory.pdf (fun (ω : Ω) => (X ω, Y ω)) (μ.prod ν) =ᵐ[μ.prod ν] fun (z : E × F) => MeasureTheory.pdf X μ z.1 * MeasureTheory.pdf Y ν z.2

Random variables are independent iff their joint density is a product of marginal densities.