Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Problem: Given an integer $x\in\left[\text{min},\text{max}\right]$

A user comes and choose a number $\left\{ n \in \mathbb{R} : \text{min}\leq\ n \leq \text{max}\right\}$. Calculate the probability that $n > x$. I tried using following


But I am not getting correct answer. My book tells me that when $\text{min}=8156$, $\text{max}=15225$ and $x=12910$, then $P(n\gt x)=0.22474$, but this is not the answer I am getting.

share|improve this question
Is the distribution uniform, i.e., every number has an equal probability of getting chosen? If yes, then your answer is correct. Otherwise you need to specify the distribution. –  ZeroG Jul 14 '12 at 12:43
1. What does b/w mean? 2. How do you know you are not getting the correct answer? –  Gerry Myerson Jul 14 '12 at 12:46
@GerryMyerson : I would expect b/w to mean between. –  ZeroG Jul 14 '12 at 12:49
@GerryMyerson According to answer book when min=8156 , max=15255 and x =12910 answer should 0.22474. But my answer is not matching with that. –  Vivek Goel Jul 14 '12 at 12:50
@Vivek: If the distribution is uniform, that answer ($0.22474$) is wrong; the correct answer is about $0.33$. –  joriki Jul 14 '12 at 13:06

2 Answers 2

Just to add a bit to what has already been said in the comments above.

First I don't know if you have heard about a probability density function (pdf)? If not, you can read a bit about it on this Wikipedia page. A pdf is a non-negative function defined on the real numbers (lets just go with the real numbers here) satisfying that if we take the area under the graph of $f$ from $-\infty$ to $\infty$ we get $1$. We use $f$ to calculate the probabilities that an outcome is in a certain interval. So for example the probability that a outcome is any real number is $1$ because of the area condition from above. If I want to find the probability that an outcome is in an interval $[a,b]$ I would find the area under the graph from $x=a$ to $x = b$.

The the pdf $f$ tells us something about the likelihood of finding an outcome in a certain interval. If the function is constant on an interval and zero out side, like:

$$ f(x) =\begin{cases} 0 & \text{if } x < a \\ \frac{1}{b-a} & \text{if } x \in [a,b] \\ 0 & \text{if } x > b \end{cases} $$ then we say that the pdf is a uniform density function. This just means/assumes that the only possible outcomes are in the interval $[a,b]$. (So for example $b$ would be the maximum of the possible outcomes, i.e. $b = max$ in your case).

So in your case with $a = min$ and $b = max$ our expression:

$$ \frac{max - x}{b - a} $$

is exactly the area under the graph of the pdf from x to max. Hence it gives you the probability that an outcome (the number chosen) is in the interval $[x,max]$.

But this of course assumes that the outcomes are uniformly distributed. In that case you, in you specific example, indeed get (as mentioned in the comments):

$$ \frac{15255 - 12910}{15255 - 8156} \simeq 0.3303 = 33.03 \% $$

share|improve this answer
Does line x can be rational number don't have any effect ? –  Vivek Goel Jul 15 '12 at 9:39
@VivekGoel: I am not sure that I understand your question? However, if you are asking whether saying that $x$ is rational should change the probability I would say that it doesn't (I am not sure however). But, if you assumed that $x$ should be an integer, then the only change is that the denominator is $max - min + 1$ (as mentioned in other comments and the other answer. –  Thomas Jul 15 '12 at 13:40

Actually the denominator should be max-min+1 as that is the total number of integer n such that min<=n<=max.

share|improve this answer
I think we have the real numbers here. –  Thomas Jul 14 '12 at 13:50
The Op starts by saying let x be an integer which made me think min and max were integers plus the symbol n is generally used for an integer. Also the three numbers in the example are all integers. However writing n belongs to R suggests your interpretation. –  Michael Chernick Jul 14 '12 at 15:06
@Thomas. It is not clear. Everything points to integers except for the use of R. But even there it is perfectly acceptable to talk about integers belonging to R. –  Michael Chernick Jul 14 '12 at 15:11
I agree. It isn't obvious. My first thought had also been that $x$ should be an integer. In particular because of the $n$. I also think that it is confusing that the OP says: "Given an integer..." And the after that someone chooses a number $x$. (I by the way did not vote you down). –  Thomas Jul 14 '12 at 16:13

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.