Is the number of hydrogen bonds or the number of rings in a molecule a discrete or a continuous variable ?

Can I say that the number of rings: 1, 3, 4, $\dots$ is a continuous variable because in theory this number could rise up to infinity?

On the other hand it can only take integer values so....is it discrete then ?

  • 5
    $\begingroup$ If the value cannot take any value between two specified values (e.g. between 1 and 3), then it's not continuous. Just because it can take values up to infinity doesn't make it a continuous variable. $\endgroup$ Jun 2, 2013 at 15:40
  • $\begingroup$ Thank you for this. What would be the best way to graphically summarize discrete data ? For example for continuous variables I use box plots. Is there any alternative for discrete variables ? $\endgroup$
    – beginner
    Jun 2, 2013 at 16:01
  • $\begingroup$ You could use a barplot with absolute or relative frequencies. $\endgroup$ Jun 2, 2013 at 16:07
  • $\begingroup$ Keep in mind that if you really expect the number to take values all the way out to infinity (or very large) it might be fine to just treat it as continuous anyway. It really depends on the intended application. $\endgroup$ Jun 2, 2013 at 22:41
  • $\begingroup$ Seems like this is discrete, count data. As has been pointed out, if the numbers get large enough, treating it as continuous would be fine. $\endgroup$ Jun 3, 2013 at 0:27

1 Answer 1


Grew too long for a comment:

Counts are discrete, the fact that they can go to infinity doesn't change that.

What makes a variable discrete:

If you can enumerate the values the variable can take ('call this value the first one, that the second one, ...') and never miss any (associate them one-to-one with the natural numbers), then the variable is discrete.

If the sample space is countable, your variable is discrete.

This means, for example, that even the difference of the square roots of two Poisson variables is discrete, even though for any two distinct values, there's always more values between them.

Variables that are counts ("the number of..."), of course, are countable.

Heck, counts can't take values between the integers; 'on a lattice' is as discrete as they come; but (as mentioned already in the different of the square roots of two Poissons example) you don't have to have a lattice to have a discrete r.v.

(response from comments)

@DilipSarwate I agree it's weird (it's equally as weird for the case I mentioned and for the same reason; I'd have mentioned that example as well, but figured it would be overkill to have two examples). But that's what discreteness really is.

[As for difficulty finding probabilities from the pmf, consider $X$, $Y$ and $Z$ all geometric. $X + \pi Y + \sqrt 2 Z$ is plainly discrete, yet some probabilities that may arise for it could be awkward to evaluate also. That doesn't suggest it's ill-defined, only that it's not nice to work with.]

There are an infinite number of ways of assigning probability to each of the rational values in [0,1] of course. Here's one example:

  • take $X$ as Poisson $\mu$, $Y$ as (independent of $X$) Poisson $\lambda$, where we condition on $X+Y\neq 0$ and then $V = X/(X+Y)$ is a random variable on the rationals in $[0,1]$. The probability you ask for is just $P(X\leq Y)$ and could be computed in that instance [NB Aside from excluding $X+Y=0$, $X-Y$ has a Skellam distribution]; variables like this really can arise in practice, and even when you can't do the probability calculation algebraically (though in this case you could at least do it numerically to effectively any required bound on accuracy), you can always simulate the required calculations from the definition; the things are well-defined even in cases where they're hard to compute directly.

Of course, we could order the positive rationals using the usual argument based on progressing diagonally along the array $v(i,j)=i/j$ (i.e. $(1,1)$, $(1,2)$, $(2,1)$ $(1,3)$, $(2,2)$, $(3,1)$ but omitting fractions not in simplest form) - only one of an infinite number of ways of doing so - and just assign probabilities from any distribution on the natural numbers (don't ask me what practical use that could have) ... while that might make evaluating the probability that you ask for difficult to evaluate (at best), that doesn't mean it's necessarily ill-defined. Similar constructions on rationals in $(0,1)$ are easy to manage, by staying keeping to $i<j$ and we can incorporate $0$ and $1$ by placing them at the start. Even so, since this doesn't seem to have practical use, I am not sure it's necessarily a big concern that probabilities may be hard to evaluate but since we seem to be wandering into issues about which I know little, I'll leave pursuing further discussion of the rationals in $[0,1]$ aside.

Further edit:

@DilipSarwate I like to make things as simple as possible without saying something that's false. The problem is, I don't think that it is actually true that it is always possible to find an interval $(a,b)$ such that $x∈(a,b)$ and $X$ does not take on any other value in $(a,b)$. In fact, I believe the two examples discussed here are counterexamples - I think for both there's no interval where $a<b$ that won't have probability.

That is, there are discrete cases where there's no empty finite interval - as soon as it has any size at all, there's some points in there.

Edit: the Wikipedia article on Discrete random variables seems to agree -

In cases more frequently considered, this set of possible values is a topologically discrete set in the sense that all its points are isolated points. But there are discrete random variables for which this countable set is dense on the real line (for example, a distribution over rational numbers).

That is, while usually we deal with cases where points are isolated, it's not always the case.

I made the admittedly complicated comment in the later part of my answer because one of the earlier comments looks to me like it was saying something untrue (in fact the same thing that you now suggest).

I'd make a simpler statement in response if I could see a good one that I wasn't pretty sure was wrong.

Is there a simple way to say it?

  • 1
    $\begingroup$ I always worry about calling a random variable that takes on all rational values in $[0,1]$ a discrete random variable. The random variable does take on a countable number of values but the values are dense in $[0,1]$ which somehow goes against the grain (just my personal feeling) of being a discrete random variable. How would one define the probability mass function for such a random variable, and how would we calculate $P\{0 \leq X \leq \frac{1}{2}\}$ for such a random variable from the pmf? $\endgroup$ Jun 3, 2013 at 1:48
  • $\begingroup$ @DilipSarwate I tried to type a comment in response but it grew to be too long. I have added some discussion of your points to the end of my answer above. $\endgroup$
    – Glen_b
    Jun 3, 2013 at 2:30
  • $\begingroup$ For the level of the question asked here (with confusion between the notions of unbounded and continuous, cf. some of the later comments too), it might have been better to simply say that the values taken on by a discrete random variable are isolated points; if $x$ is a value of $X$, then it is possible to find an interval $(a,b)$, possibly a very short interval, such that $x \in (a,b)$ and $X$ does not take on any other value in $(a,b)$. $\endgroup$ Jun 3, 2013 at 3:10
  • $\begingroup$ @DilipSarwate I moved my response up again, because it needed some additional fixes ... and then got too long. $\endgroup$
    – Glen_b
    Jun 3, 2013 at 3:39
  • $\begingroup$ @DilipSarwate (9 years later) On your first comment, you need a definition, which depends on the distribution but is certainly possible. Suppose we have a distribution on $\mathbb Q \cap (0,1)$ where $\mathbb P\left(X = \frac{a}{b}\right) = \frac{\zeta(3)}{\zeta(2) - \zeta(3) } \left(\frac{1}{b}\right)^3$ when $\frac ab$ is expressed in lowest terms. This is a discrete distribution with support on $[0,1]$ and $\mathbb P(0 \lt X \lt 1)=1$ while $\mathbb P(0 \lt X \leq \frac{1}{2}) = \frac12 + \frac1{16}\frac{\zeta(3)}{\zeta(2) - \zeta(3) } \approx 0.6696$ $\endgroup$
    – Henry
    Feb 16 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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