Random Variables

This chapter discusses random variables.

What are Random Variables?

In probability theory, we use random variables to represent the outcomes of random processes. Don't confuse them with variables you define in your code or the variables you read about in algebra class. These variables are traditionally denoted by upper case letters. We call them random because they represent the outcomes of random processes such as flipping a coin, throwing dice or the possibility of rain on a given day. As an example, we define two random variables below:

X=Numberofheadsin3flipsofacoinX = Number\:of\: heads\: in\: 3\: flips\: of\: a\: coin

Y=Faceupvalueofadicegreaterthan2onarollofdiceY = Faceup\: value\: of\: a\: dice\: greater\: than\: 2\: on\: a\: roll\: of\: dice

Note that in both the above cases X and Y can take on different values depending on the outcome of the experiment.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.