Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two discrete uniform distributions over same support:

Dx = DiscreteUniformDistribution[{-8, 8}];  
Dy = DiscreteUniformDistribution[{-8, 8}];

I use random variables X $\sim$ Dx, Y $\sim$ Dy to model condition in some if-else clause in C code. For example,

if (3 * x + 1 > y) {

So, I model this condition by random event 3*X + 1 > Y. Then probability I look for is:

  x > y, 
  {Distributed[x, TransformedDistribution[3 * x + 1, Distributed[x, Dx]]],
   Distributed[y, Dy]}

Unfortunately, Mathematica produces nothing. As for me, this is very strange behavior because Mathematica also cannot compute mean for the product distribution of {X, Y}. Maybe, this problem is caused by different support of X and Y.

How can I compute this probability?

share|improve this question
up vote 8 down vote accepted

The following computes the probability you asked for, but I'm at a loss to understand why your notation won't work. It seems correct to me.

 3 x + 1 > y, {Distributed[x, Dx], Distributed[y, Dy]}]

==> 147/289

The Probability / Distribution functions are quite young and hence not fully bulletproofed and I have encountered a number of bugs myself. I suppose/hope that in the next release they will be solved. I suggest you contact Wolfram support ( But perhaps someone else here may find out what's wrong.

A few of mine:

No random variates from PDFs that stem from multivariate distributions:

dist = ProbabilityDistribution[
   PDF[BinormalDistribution[{0, 0}, {1, 1}, 0]][{x, 
     y}], {x, -Infinity, Infinity}, {y, -Infinity, Infinity}];

This works for 3, but not for 5 (and higher):

Expectation[x,x\[Distributed] OrderDistribution[{GeometricDistribution[0.1], 3}, 3]]
Expectation[x,x\[Distributed] OrderDistribution[{GeometricDistribution[0.1], 5}, 5]]

The following crashes the kernel after a minute or so (so, DO NOT EXECUTE):

PDF[TransformedDistribution[Sin[u], u \[Distributed] NormalDistribution[0, 1]], 0]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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