DEV Community

Cover image for Random Variables: A Glimpse

Random Variables: A Glimpse

ashwinsharmap profile image Ashwin Sharma P Originally published at ・1 min read

So, what are actually random variables?

In statistics, a random variable is a variable whose outcome is based on some random phenomenon.

These random variables are classified into discrete random variables and continuous random variables.

Discrete Random Variables:- They are the random variables which take up a finite number of values. It usually takes up a whole number value.

Discrete Random Variable

Let’s consider an example.

Suppose we are tossing 3 unbiased coins. The sample space ‘S’, i.e. the whole set of outcome possibilities is;

S={HHH,HHT,HTH,THH,HTT,THT,TTH,TTT}, where H denotes head and T denotes tail.

So if we check the possible number of heads in each toss, the random variable ‘X’ can be denoted as;


Here we can see that the random variable takes up the values 0,1,2,3 which are discrete values.

Continuous Random Variable:- A random variable becomes a continuous random variable if it takes up any number of values inside a particular interval.

Continuous Random Variable

For example; suppose we consider the weights of students in a school. The weights may vary over a range and if we consider a particular range inside the whole set, the random variables will take up any value (indefinite number of values). Hence there is no discrete observation in a continuous random variable.

So that’s it about random variables.


Editor guide