Is it possible to define a generic probability distribution function (pdf) so Mathematica can use its properties to simplify expressions?

For example:


How to tell to Mathematica that f[x] is a PDF so it can simplify (in this case) to 1?

This is easy for a PDF from a given distribution, but my question is about the case of a generic PDF f[x]


2 Answers 2


ProbabilityDistribution does precisely that.


  • $\begingroup$ Yes, it's true that you can use something like ProbabilityDistribution[f[y], {y, -Infinity, Infinity}] for a generic f[x], and it works. I didn't see that on the examples, so I assumed that was not possible. Do you know if is it possible to assume further conditions, for example, that f[x] is a continuous distribution? So it can simplify even further (for example, Simplify[ Integrate[f[y], {y, -Infinity, 10}] + Integrate[f[y], {y, 10, Infinity}]]) $\endgroup$
    – Borelian
    Nov 24, 2022 at 12:17
  • $\begingroup$ Just define your f(x) to be continuous. $\endgroup$ Nov 24, 2022 at 18:04

(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)


Use TagSet or TagSetDelayed to associate the integral to the symbol f, e.g.,

f /: Integrate[f[x_], {x_, -Infinity, Infinity}] = 1;


Integrate[f[y], {y, -Infinity, Infinity}]

(* 1 *)


Mathematica doesn't combine integrals unless explicitly told to do so. Define a rule

intRule = Integrate[expr_, {t_, a_, b_}] +
    Integrate[expr_, {t_, b_, c_}] :>
   Integrate[expr, {t, a, c}];

Applying the rule,

Integrate[f[y], {y, -Infinity, 10}] + 
  Integrate[f[y], {y, 10, Infinity}] /. intRule

(* 1 *)
  • $\begingroup$ It works for that integration, but not for other. For example, Simplify[ Integrate[f[y], {y, -Infinity, 10}] + Integrate[f[y], {y, 10, Infinity}]] does not simplify to 1. $\endgroup$
    – Borelian
    Nov 24, 2022 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.