Random Variable
Random variable is basically a function which maps from the set of sample space to set of real numbers. The purpose is to get an idea about result of a particular situation where we are given probabilities of different outcomes. See below example for more clarity.
Example :
Suppose that two coins (unbiased) are tossed
X = number of heads. [X is a random variable or function]
Here, the sample space S = {HH, HT, TH, TT}.
The output of the function will be :
X(HH) = 2
X(HT) = 1
X(TH) = 1
X(TT) = 0
Formal definition :
X: S -> R
X = random variable (It is usually denoted using capital letter)
S = set of sample space
R = set of real numbers
Suppose a random variable X takes m different values i.e. sample space X = {x1, x2, x3………xm} with probabilities P(X=xi) = pi; where 1 ≤ i ≤ m. The probabilities must satisfy the following conditions :
Hence possible values for random variable X are 0, 1, 2.
X = {0, 1, 2} where m = 3
P(X=0) = probability that number of heads is 0 = P(TT) = 1/2*1/2 = 1⁄4.
P(X=1) = probability that number of heads is 1 = P(HT | TH) = 1/2*1/2 + 1/2*1/2 = 1⁄2.
P(X=2) = probability that number of heads is 2 = P(HH) = 1/2*1/2 = 1⁄4.
Here, you can observe that
1) 0 ≤ p1, p2, p3 ≤ 1
2) p1 + p2 + p3 = 1/4 + 2/4 + 1/4 = 1
Example :
Suppose a dice is thrown X = outcome of the dice. Here, the sample space S = {1, 2, 3, 4, 5, 6}. The output of the function will be:
See if there is any random variable then there must be some distribution associated with it.
Discrete Random Variable:
A random variable X is said to be discrete if it takes on finite number of values. The probability function associated with it is said to be PMF = Probability mass function.
P(xi) = Probability that X = xi = PMF of X = pi.
The examples given above are discrete random variables.
Example:- Let S = {0, 1, 2}
Find the value of P (X=0):
Sol:- We know that sum of all probabilities is equals to 1.
==> p1 + p2 + p3 = 1
==> p1 + 0.3 + 0.5 = 1
==> p1 = 0.2
Continuous Random Variable:
A random variable X is said to be continuous if it takes on infinite number of values. The probability function associated with it is said to be PDF = Probability density function
PDF: If X is continuous random variable.
P (x < X < x + dx) = f(x)*dx.
Then P (X) is said to be PDF of the distribution.
Example:- Compute the value of P (1 < X < 2).
Such that f(x) = k*x^3; 0 ≤ x ≤ 3
= 0; otherwise
f(x) is a density function
Solution:- If a function f is said to be density function, then sum of all probabilities is equals to 1. Since it is a continuous random variable Integral value is 1 overall sample space s.
==> K*[x^4]/4 = 1 [Note that [x^4]/4 is integral of x^3]
==> K*[3^4 – 0^4]/4 = 1
==> K = 4/81
The value of P (1 < X < 2) = k*[X^4]/4 = 4/81 * [16-1]/4 = 15/81.
65 videos|120 docs|94 tests
|
1. What is a random variable in computer science engineering? |
2. How are random variables used in computer science engineering? |
3. What are the types of random variables commonly used in computer science engineering? |
4. How are probabilities assigned to random variables in computer science engineering? |
5. Can you provide an example of how random variables are used in computer science engineering? |
|
Explore Courses for Civil Engineering (CE) exam
|