# Introduction to probability and statistics: a computational framework of
randomness

Lakshman Mahto
Assistant Professor (Mathematics)  IIIT Dharwad  India
<EMAIL_ADDRESS>
###### Abstract

This text presents an unified approach of probability and statistics in the
pursuit of understanding and computation of randomness in engineering or
physical or social system with prediction with generalizability. Starting from
elementary probability and theory of distributions, the material progresses
towards conceptual and advances in prediction and generalization in
statistical models and large sample theory. We also pay special attention to
unified derivation approach and one-shot proof of each and every probabilistic
concept. Our presentation of intuitive and computation framework of
conditional distribution and probability are strongly influenced by unified
patterns of linear models for regression and for classification. The text ends
with a future note on the unified approximation of the linear models, the
generalized linear models and the discovery models to neural networks and a
summarized ML system.

###### Contents

  1. 1 Introduction
    1. 1.1 Perceiving randomness and probabilistic problem
    2. 1.2 Statistics and randomness
    3. 1.3 Strategies for solving probabilistic problems
    4. 1.4 Overview
  2. 2 Elementary probability
    1. 2.1 What is probability?
    2. 2.2 Basic concepts of probabilistic modelling
      1. 2.2.1 A sample space i.e. specification of all possible outcomes
      2. 2.2.2 The event (of interest)
      3. 2.2.3 Probability Measure
    3. 2.3 Types of probabilistic models
      1. 2.3.1 Discrete probabilistic model
      2. 2.3.2 Continuous probabilistic model
    4. 2.4 Conditional probability
      1. 2.4.1 Joint probability
      2. 2.4.2 Total probability
      3. 2.4.3 Bayes rule
  3. 3 Probability distribution
    1. 3.1 Random variable
    2. 3.2 Discrete distribution
      1. 3.2.1 Various discrete distribution
      2. 3.2.2 Derived distribution of a discrete random variable
      3. 3.2.3 Jointly discrete distribution
      4. 3.2.4 Conditional PMF
      5. 3.2.5 Expectation and variance of discrete random variable
      6. 3.2.6 Function of jointly discrete random variables
    3. 3.3 Continuous distribution
      1. 3.3.1 Various continuous distribution
      2. 3.3.2 Jointly continuous distribution
      3. 3.3.3 Derived distribution of a continuous random variable
      4. 3.3.4 Expectation and variance of continuous random variables
    4. 3.4 General random variable
  4. 4 Large sample theory
    1. 4.1 Sample statistic
      1. 4.1.1 Methods of estimation for sample statistic
      2. 4.1.2 Method of sampling
    2. 4.2 Probabilistic inequalities
      1. 4.2.1 Probabilistic inequalities and non-asymptotic sample theory
      2. 4.2.2 Stochastic convergence and asymptotic large sample theory
    3. 4.3 Limit theorems
      1. 4.3.1 Law of large numbers
      2. 4.3.2 Limit theorems
  5. 5 Statistical methods
    1. 5.1 Point estimation
      1. 5.1.1 Sample statistic
      2. 5.1.2 Maximum likelihood estimation
      3. 5.1.3 Method of moments
      4. 5.1.4 Max a posterior estimation
      5. 5.1.5 Goodness of fit
    2. 5.2 Interval estimation
      1. 5.2.1 Confidence interval
    3. 5.3 Hypothesis testing
  6. 6 Statistical modelling
    1. 6.1 Statistical models
    2. 6.2 Linear models
      1. 6.2.1 Simple univariate linear model (SULM)
      2. 6.2.2 Simple multivariate linear model
      3. 6.2.3 Embedded linear models (ELM)
      4. 6.2.4 Multiple multivariate linear model (MMLM)
    3. 6.3 Generalized linear models
      1. 6.3.1 Logistic regression: Bernoulli logit model
      2. 6.3.2 SoftMax regression: a multinomial logit model
    4. 6.4 Future note: control, discovery models, and generation
      1. 6.4.1 A non-linear inverse problem

## preface

pothee padhi padhi jag mua, pandit bhaya na koy | dhaee aakhar prem ka, padhe so pandit hoy | $\displaystyle\mbox{Kabir}.$

Here, prem may refer, devotion to observation, understanding, & applicability.

The central objects of our studies are probability as a measure of randomness
and statistics as a computation of a sample statistic (with goodness of fit)
from given data-sets.

### Objective and approach

This text assumes that you know approximately nothing about probability and
statistics. Its goal is to provide you with observation, understanding and
applications of each every concepts that ultimately leads to solving real
world problems.

We cover a large number of techniques, from the simplest and most commonly
used (such as conditioning) to some of the advance techniques (e.g. estimation
and generalization of a statistical model).

Computational framework (in the intersection of probability & statistics,
optimization & numerical methods, algorithm & programming, and computer) means
a practical understanding of a concept and its applicability in solving a
related problem in computers effectively with the help of some numerical
method. The text favours a computational approach of each and every concept
with a better observation, understanding and applicability through concrete
working examples and their simulation in computer. Furthermore, the approach
in order to solve a real world problem characterizes with an accuracy, (i.e.
approximately very close to the correct/optimal result), an efficiency (i.e. a
polynomial time computational and iteration complexities),a robustness (i.e.
work for every possible realization of a random sample of any size) and an
stability (i.e. not sensitive to small perturbations in the input).

Figure 1: A self-explanatory meaning of computational framework in Hindi with
corresponding translation in English.

### Prerequisite

This text assumes that you have some basic understanding of linear algebra,
calculus, programming and algorithm.

### Roadmap

The central objects of our studies are probability as a measure of randomness
and statistics as a computation of a sample statistic (with goodness of fit)
from given data-sets. So, the text is decomposed into two parts.

Part I, probability, covers the following topics:

  1. i.

What is probability? What is probabilistic modelling of a random experiment?
What are the types of probabilistic modelling? How a prior information or
conditioning affects a probabilistic modelling?

  2. ii.

The central concept of probability, probability distribution, as a
computational measure of randomness in a random experiment.

  3. iii.

The most common probability distributions and their derived distributions.

  4. iv.

Joint probability distributions and their derived distributions, convolutions.

  5. v.

Central representation of a probability distribution: expectation, variance,
co-variance.

  6. vi.

Moment generating function and its applications

Part II, statistics, covers the following topics:

  1. i.

What is sample? What is data from a sample? What is sample statistic? What is
stochastic convergence?

  2. ii.

Probabilistic inequalities and non-asymptotic large sample theory.

  3. iii.

Limit theorems and asymptotic large sample theory.

  4. iv.

Methods of point estimation and goodness of fit (e.g. bias, variance,
efficiency, sufficiency).

  5. v.

Interval estimation and limit theorems.

  6. vi.

Hypothesis testing and statistical inferences

  7. vii.

Linear models and prediction (e.g. simple univariate linear models, simple
multivariate linear models, embedded linear models, multiple multivariate
linear models).

  8. viii.

Simulation with Python.

Note: don’t jump into solving a noisy observation based problem in a computer
too hastily: while solving the problem in computer is no doubt one of the most
exciting areas in computational mathematics, you should master the
fundamentals first.

### Silent features of the book

  1. a.

Derivation of various concepts such as:

    1. i.

computation of probability of an subinterval $[a,b]$ in the sample space
$\Omega$ of a continuous probability model

$\displaystyle P([a,b])=\frac{\mbox{length of}\ [a,b]}{\mbox{length of}\
\Omega}=\frac{b-a}{\mbox{length of}\ \Omega}.$

    2. ii.

conditional probability as a technique to understand, compute and apply to
central concepts such as concepts joint probability, total probability, Bayes
rule, conditional distribution, joint distribution and conditional
expectation.

  2. b.

presentation of each and every example in an ordered 3-tuple of backdrop,
question and answer.

  3. c.

One-shot derivation of various proofs and solutions such as derived
distribution, limit theorem, point estimation, interval estimation and
computation $\&$ estimation of parameters for a linear model.

  4. d.

A unified approach to compute and estimate parameters of simple univariate,
simple multivariate, embedded and multiple multivariate linear models.

  5. e.

Goodness of fit for every estimate of a parameter or a parametric model.

  6. f.

Python demonstration of almost every probability distribution, large sample
theory and statistical methods.

  7. g.

An effort to utilise self-explanatory capability of a word in Indian languages
to understand, observe and apply at the best (i.e. upto optimality) in-line
with new education policy 2023.

Figure 2: A self-explanatory meaning of statistics in Hindi with corresponding
translation in English.

  8. h.

This is a text, not a reference book, for probability and statistics of
undergraduate studies. I have tried to present the fundamental ideas of the
subject in simple and intuitive contexts in computational frameworks.

##  Chapter 1 Introduction

The purpose of the text is to present the computational framework of
probability and statistics as a mathematical discipline that observe,
understand and applicability of a problem based on probabilistic phenomenon or
a mathematical model based on noisy measurements.

###  1.1 Perceiving randomness and probabilistic problem

Natural sciences (e.g. theory of errors in measurements, problems of the
theory of ballistics, problems of statistics) made it necessary to develop the
theoretical probability with advanced analytical tools.

The modern development of probability is characterized by the notions of
measure theory and, subsequently, functional analysis that lead to an extended
content of theoretical probability (e.g. large sample theory, stochastic
processes, stochastic modelling).

In the middle of 20th century, applicability of probability developed in
modern science immeasurably (e.g. molecular orbital theory, statistical
physics, microscopic understanding of diffusion and transport of particles
through interaction, intra-action and characterization of motion).

At microscopic level, particle theory establish a fact that every substance is
composed of very many particles i.e. in a homogeneous body their properties
are very similar. Under these circumstances standard mathematical research
methods are useless in the investigation of physical theories. For example,
the techniques of differential equations are incapable of yielding any serious
results under these conditions.

######  Example 1.1.1.

Consider a diffusion model

$\displaystyle\frac{\partial u}{\partial t}=D\frac{\partial^{2}}{\partial
t^{2}}\left(u\right).$ (1.1)

Then,

  1. a.

At macroscopic level, the equation (1.1) refers a deterministic system.

  2. b.

While, at microscopic level, the motion of each individual molecule/particle
is having a Brownian motion, which is random in nature.

Schematic a phenomenon or selection of mathematical tools to investigate the
phenomenon. Goodness of fit or quality can be judged by how well the theory
agrees with experiment and with practice.

###  1.2 Statistics and randomness

Consider a statement, "$80\%$ chance of rain on this Friday". So, we perceive
the following:

  1. a.

the chance $80\%$ is estimated from data statistically (i.e. a statistical
estimate).

  2. b.

an estimation is performed in a deterministic way, because it involves a
computation technique.

  3. c.

so, a statistical estimation is carried through measurement (or observation)
using a computation technique.

  4. d.

furthermore, a measurement involve measurement randomness due to computation
approximation and measuring unit.

###  1.3 Strategies for solving probabilistic problems

The central objects of our studies are probability as a measure of randomness
and statistics as a computation of a sample statistic (with goodness of fit)
from given data-sets. So, the text is decomposed into two parts.

Part I, probability, covers the following topics:

  1. i.

What is probability? What is probabilistic modelling of a random experiment?
What are the types of probabilistic modelling? How a prior information or
conditioning affects a probabilistic modelling?

  2. ii.

The central concept of probability, probability distribution, as a
computational measure of randomness in a random experiment.

  3. iii.

The most common probability distributions and their derived distributions.

  4. iv.

Joint probability distributions and their derived distributions, convolutions.

  5. v.

Central representation of a probability distribution: expectation, variance,
co-variance.

  6. vi.

Moment generating function and its applications

Part II, statistics, covers the following topics:

  1. i.

What is sample? What is data from a sample? What is sample statistic? What is
stochastic convergence?

  2. ii.

Probabilistic inequalities and non-asymptotic large sample theory.

  3. iii.

Limit theorems and asymptotic large sample theory.

  4. iv.

Methods of point estimation and goodness of fit (e.g. bias, variance,
efficiency, sufficiency).

  5. v.

Interval estimation and limit theorems.

  6. vi.

Hypothesis testing and statistical inferences

  7. vii.

Linear models and prediction (e.g. simple univariate linear models, simple
multivariate linear models, embedded linear models, multiple multivariate
linear models).

  8. viii.

Simulation with Python.

Note: don’t jump into solving a noisy observation based problem in a computer
too hastily: while solving the problem in computer is no doubt one of the most
exciting areas in computational mathematics, you should master the
fundamentals first.

###  1.4 Overview

  1. a.

Derivation of various concepts such as:

    1. i.

computation of probability of an subinterval $[a,b]$ in the sample space
$\Omega$ of a continuous probability model

$\displaystyle P([a,b])=\frac{\mbox{length of}\ [a,b]}{\mbox{length of}\
\Omega}=\frac{b-a}{\mbox{length of}\ \Omega}.$

    2. ii.

conditional probability as a technique to understand, compute and apply to
central concepts such as concepts joint probability, total probability, Bayes
rule, conditional distribution, joint distribution and conditional
expectation.

  2. b.

presentation of each and every example in an ordered 3-tuple of backdrop,
question and answer.

  3. c.

One-shot derivation of various proofs and solutions such as derived
distribution, limit theorem, point estimation, interval estimation and
computation $\&$ estimation of parameters for a linear model.

  4. d.

A unified approach to compute and estimate parameters of simple univariate,
simple multivariate, embedded and multiple multivariate linear models.

  5. e.

Goodness of fit for every estimate of a parameter or a parametric model.

  6. f.

Python demonstration of almost every probability distribution, large sample
theory and statistical methods.

  7. g.

An effort to utilise self-explanatory capability of a word in Indian languages
to understand, observe and apply at the best (i.e. upto optimality) in-line
with new education policy 2023.

Figure 1.1: A self-explanatory meaning of statistics in Hindi with
corresponding translation in English.

  8. h.

This is a text, not a reference book, for probability and statistics of
undergraduate studies. I have tried to present the fundamental ideas of the
subject in simple and intuitive contexts in computational frameworks.

##  Chapter 2 Elementary probability

###  2.1 What is probability?

Probability is a mathematical discipline that concerning with numerical
descriptions of how likely an event is to occur or a degree of belief of the
occurrence of an event, or how likely it is that a proposition is true. The
probability of an event is a number between 0 and 1. In simple, probability is
the measure or quantification of randomness that falls in the intersection of
mathematical thinking and intuitive observation/experience of patterns. It
finds applications in . It diffuses through almost every discipline of
sciences & mathematics, engineering & technology and social & life sciences.
And it finds applications in inference, decision making, experimental design,
reliability theory, statistical theory of information, communication, control,
and many more except motion of planets. A few example inspired from (Pfeiffer
and Schum, 1973) and (Ramon van Handel, 2006):

  1. a.

Physics: a few quantities (e.g. temperature and pressure) arise as a direct
consequence of the random motion of atoms and molecules. Heisenberg
uncertainty principle in quantum mechanics.

  2. b.

Biology and medicine: in human evaluation, random mutations lead to the
amazing diversity of life. Stochastic models are essential in understanding
the spread of disease, both in a population (e. g. epidemics) or in the human
body (e.g. cancer).

  3. c.

Chemistry: a chemical reaction takes place when molecules randomly meet.
Stochastic models of chemical kinetics are particularly important in systems
with very low concentrations (e.g. biochemical reactions in a single cell).

  4. d.

Electronics and communication engineering: the effect of noise to design a
reliable communication protocol that we use on a daily basis in our cell
phones. Observation or measurement of a signal using a suitable measuring unit
happens to be noisy in nature (i.e. in practice, measurement of a signal
contains a signal along-with an additive noise).

  5. e.

Computer science: randomness in an algorithm (for some best known method)
brings robustness and stability in order to compute a solution of a complex
problem.

  6. f.

Finance and economics: stock and bond prices are inherently unpredictable, so
these lead to some kind of stochastic models. The modelling of randomly
occurring rare events forms the basis for all insurance policies, and for risk
management in banks.

  7. g.

Sociology: stochastic models provide basic understanding of the formation of
social networks and of the nature of voting & polling schemes.

  8. h.

Statistics and machine learning: statistical methods lead to stochastic models
that form the foundation for almost all of data science (e.g. tabular data
science, image data science, text data science or NLP).

  9. i.

Optimization: in order to come out of stuck region of local in minimization a
function, there is a need noise in an optimization algorithm through noisy or
perturbed gradient (e.g. noisy gradient descent, stochastic gradient descent).

Figure 2.1: A self-explanatory meaning of probability in Hindi with
corresponding translation in English.

######  Example 2.1.1 (A measurement error due to limitation of a scale).

Consider a measurement scale (2.2) that can measure 0 to 100 cm with 1cm
accuracy. Now if we have to measure $99.73$cm with respect to the given scale,
we find that $99.73$ cannot be measured deterministically on it. With respect
to the scale, $99.73$ has three significant figures, so it is $99.73\approx
99.7$, where first two numbers i.e. $99$ are deterministic significant figures
and the third one $.7$ is a uncertain or estimated or random significant
figure. So, we can a measurement includes uncertainty due to limitation of the
corresponding measuring instrument in use.

Figure 2.2: a measurement scale that can measure 0 to 100 cm with 1cm
accuracy.

######  Example 2.1.2 (the toss of a fair coin).

You know intuitively that there is a 50 percent chance of getting heads, and
50 percent chance of getting tails. If you want to do the math to calculate
the probability of a head, here’s the basic formula that count the number of
times that the event will happen (e.g. in this case, there’s just one chance
of a head appearing, so it’s 1). Divide this by the total number of possible
outcomes (e.g. with a coin, it’s either heads or tails, which is 2 possible
outcomes). So the probability of getting a head is $0.5$ or 50 percent.

######  Example 2.1.3 (Estimating a number or a function).

Consider an estimation of a number from its noisy measurement. For example,
$\bar{x}=\mu+\varepsilon$, where $\mu$ is the true mean, and$\bar{x}$ is the
estimated mean with a noise $\varepsilon$ as the error containing some
randomness. Furthermore, consider an estimation of a deterministic function of
$f(x)=x^{2}$ with its noisy measurement $x^{2}+\varepsilon$ in figure (2.3).

Figure 2.3: In left there a deterministic function $x^{2}$ to be estimated
from its noisy version in right.

######  Example 2.1.4.

Backdrop: three men are on a trip. One of the three will volunteer to cook
breakfast. A is twice as likely to volunteer as B, and B is three times as
likely to volunteer as C.

Question: compute the probability of volunteering for each man.

Answer: suppose that one and only one will volunteer among A, B, and C. So, we
can assume that $\\{A,B,C\\}$ are mutually exclusive and totally exhaustive,
i.e. $P(A)+P(B)+P(C)=1$.

Now, from the question, we have the following assumptions:

$\displaystyle(a.)P(A)=2P(B),\ (b.)P(B)=3P(C),\ (c.)P(A)+P(B)+P(C)=1$
$\displaystyle\implies 2\cdot 3P(C)+3P(C)+P(C)=1\implies P(C)=\frac{1}{10}.$

And hence, we get

$\displaystyle P(A)=\frac{6}{10},\ P(B)=\frac{3}{10},\ \mbox{and}\
P(C)=\frac{1}{10}.$

######  Remark 2.1.5.

In summary, we may perceive following at first instant observation from
probability:

  1. a.

chance/unpredictable/random/stochastic,

  2. b.

possible outcomes in a random experiment (an experiment with unpredictable
possible outcome in each of its trials).

So, generally we come across a random experiment with a list of possible
outcomes, but a possible outcome in each trial of the experiment is
unpredictable (i.e. random)

######  Definition 2.1.6 (Random experiment).

A random experiment is an experiment whose outcome is not predictable before
the experiment is performed, however in advance we know all possible outcomes
in the experiment. That is, an outcome of a random experiment is uncertain and
a probabilistic modelling is providing an approach to the quantify the
uncertainty.

Furthermore, there is no restriction on what constitutes an experiment (e.g.
it could be a single toss of a coin, or three tosses, or an infinite sequence
of tosses). So, it is important to note that in formulation of a probabilistic
model, there is only one experiment (e.g. three tosses of a coin constitute a
single experiment, rather than three experiments).

######  Example 2.1.7 (Tossing a coin).

If we toss a coin, then either a head or tail comes up with some degree of
belief, but we don’t know in advance which one will turn up.

######  Example 2.1.8 (Tossing a coin).

In weather prediction, a meteorologist just know either it will rain or not
rain with degree of belief, but we doesn’t know in advance which one will turn
up.

###  2.2 Basic concepts of probabilistic modelling

Consider a few situation–(a.) the probability that it will rain the next day
or (b.) the probability that you will win the lottery (Kay, 2006). Here, we
cannot be certain because, there are many factors that affect the weather and
those leads to uncertainty that whether it will or not rain the next day. So,
as a predictive tool we usually assign a number between 0 and 1 as our degree
of certainty or belief that the event, rain, will occur. If we say that there
is a 30% chance of rain, means we believe that if identical conditions
prevail, then 3 times out of 10, rain will occur the next day. To predict at
the nature’s standard, it is essential to come up with an accurate model by
knowing everything of science of meteorology that gives the probability is
either 0 or 1. Unfortunately, it is not possible at practice, i.e. uncertainty
of an outcome is not because of the inaccuracy of our model, but because the
experiment has been designed to produce uncertain results.

In the last section (2.1), we see a list of common items e.g. a random
experiment, a set of possible outcomes, and the probabilities assigned to
these outcomes. These attributes are common to all probabilistic descriptions.
And hence, it is very much essential to come up with a systematic approach as
designed by Kolmogrow to compute randomness or uncertainty through three basic
concepts of probabilistic modelling of random experiment:

  1. (a.)

a sample space,

  2. (b.)

an event of interest, and

  3. (c.)

probability measure of an event as an assignment or degree of belief between 0
and 1.

####  2.2.1 A sample space i.e. specification of all possible outcomes

Once a random experiment is being performed, we need to specify all possible
outcomes of the random experiment as:

  1. (a.)

First we identify an outcome of the random experiment,

  2. (b.)

Secondly, we list out all possible outcomes of the experiment as a sample
space.

######  Example 2.2.1 (Throwing two dice together).

Question: Throw two dice together and find its sample space.

Answer: Consider a throw of two dice together, then

  1. a.

we identify an outcome as an ordered pair $(i,j)$, where the first die comes
up i and the second die comes up j.

  2. b.

we list out all possible outcomes as $\\{(i,j)|1\leq i\leq 6,1\leq j\leq
6\\}$.

So, we have the sample space,

$\displaystyle\Omega=\\{(i,j)|1\leq i\leq 6,1\leq j\leq 6\\}\ \mbox{with
cardinality}\ |\Omega|=36.$

######  Example 2.2.2 (Waiting time for a bus at a bus stop).

Question: suppose you are waiting for a bus at a bus stop, then compute its
sample space.

Answer: If you are waiting for a bus at a bus stop, then

  1. a.

a real number $t\geq 0$ is identified as a possible outcome of the experiment.

  2. b.

$t=0h$ refers an outcome that on your arrival at the bus stop, immediately you
get a bus. $t=1.5h$ refers an outcome that on your arrival at the bus, you
waited for $1.5h$ to get a bus. In this process, listing out all possible
outcomes as $\\{t\in\mathbb{R}|t\geq 0\\}$.

So, the sample space is given by

$\displaystyle\Omega=\\{t\in\mathbb{R}|t\geq 0\\}=[0,\infty).$

######  Example 2.2.3 (Path of a bee for 5 seconds).

Question: consider a random experiment of observing path of a bee for 5
seconds. Compute its sample space.

Answer: If we observe path of a bee for 5 seconds, then

  1. a.

a possible outcome is identified as a continuous map
$\omega:[0,5]\to\mathbb{R}^{3}$ in (2.4):

Figure 2.4: Path of a bee as continuous map $\omega:[0,5]\to\mathbb{R}^{3}$.

  2. b.

listing all possible outcomes as

$\displaystyle\Omega=\\{\omega:[0,5]\to\mathbb{R}^{3}|\omega\ \mbox{is a
continuous map}\\}.$

So, the sample space is given by

$\displaystyle\Omega=\\{\omega:[0,5]\to\mathbb{R}^{3}|\omega\ \mbox{is a
continuous map}\\}.$

####  2.2.2 The event (of interest)

######  Definition 2.2.4 (Informal).

Once we have identified a sample space for a given random experiment, then we
can come up with a statement in order to construct (or define) an event as a
collection of some of outcomes (or favourable outcomes) satisfying the
statement.

######  Definition 2.2.5 (Formal).

A subset $A$ of the sample space $\Omega$ which satisfies a given statement
i.e. an element of a $\sigma-$ algebra of the sample space $\Omega$ (i.e.
$A\in\sigma(\Omega)$). An $\sigma-$algebra of $\Omega$ is collection of
subsets in $\Omega$ and closed with respect to complementation and countable
union of its members.

An event of interest can be computed as follows:

  1. a.

First, list out all possible outcomes as a sample space of the given random
experiment.

  2. b.

Secondly, collect some possible outcomes satisfying a statement under
interest/consideration.

######  Example 2.2.6.

Question: consider an experiment of throwing a die and getting a number
exactly divisible by 3.

Answer:

  1. a.

Listing out all possible outcomes as

$\displaystyle\Omega=\\{1,2,3,4,5,6\\}.$

  2. b.

$A\to$ collection of some possible outcomes satisfying a statement that a
number is exactly divisible by 3. So, we have

$\displaystyle A=\\{3,6\\}.$

######  Example 2.2.7 (A throw of two dice).

Question: consider a throw of two dice together. Getting an outcome with a sum
of is $7$.

Answer:

  1. a.

When we toss two coins together, the sample space is given by

$\displaystyle\Omega=\\{(i,j)|i,j=1,2,3,4,5,6\\}.$

  2. b.

$A\to$ collection of some possible outcomes satisfying a statement that sum is
7. So, we have

$\displaystyle A=\\{(1,6),(2,5),(3,4),(4,3),(5,2),(6,1)\\}.$

######  Example 2.2.8 (Waiting time for a bus at a bus stop).

Question: Suppose you are waiting for bus at a bus stop. Getting a bus in the
first hour.

Answer:

  1. a.

As you are waiting for a bus at a bus stop, so, the sample space is given by

$\displaystyle\Omega=\\{t\in\mathbb{R}|t\geq 0\\}=[0,\infty).$

  2. b.

$A\to$ collection of some possible outcomes satisfying a statement that a bus
is in first. So, we have

$\displaystyle A=\\{t\in\mathbb{R}|0\leq t\leq 1\\}=[0,1]\subset\Omega.$

######  Example 2.2.9 (Path of a bee for 5 seconds).

Question: In a random experiment of observing path of a bee for 5 seconds.
Observing path of bee stuck in a region C for first 1 second.

Answer:

  1. a.

If we observe a bee for 5 second, so, the sample space is given by

$\displaystyle\Omega=\\{\omega|\omega:[0,5]\to\mathbb{R}^{3}\ \mbox{is a
continuous map}\\}.$

  2. b.

$A\to$ collection of some outcomes satisfying a statement that a bee got stuck
in a region C in first second. So, we have

$\displaystyle A=\\{\omega:[0,5]\to\mathbb{R}^{3}|\omega(t)\in C\ \mbox{for}\
t\in[0,1]\\}\subset\Omega.$

######  Remark 2.2.10.

  1. a.

If $\omega\in\Omega$ is an outcome of a random experiment, then an event $A$
occurs if $\omega\in A$.

  2. b.

$A^{c}$ occurs if $A$ does not occur.

  3. c.

$A\cup B$ occurs if A occurs or B occurs (or both).

  4. d.

$A\cap B$ occurs if A occurs and B occurs.

  5. e.

$A\textbackslash B=A-B=A\cap B^{c}$ occurs if $A$ occurs and B does not occur.

  6. f.

$A$ and $B$ are mutually disjoint if $A\cap B=\varphi$ i.e. $A$ occurs and B
does not occurs

####  2.2.3 Probability Measure

Till now, we have seen the following:

  1. (a.)

Sample space ($\Omega\to$) as a collection of all possible outcomes from the
random experiment.

  2. (b.)

An event ($A$) defined by a statement as a collection of some possible
outcomes from the experiment.

######  Definition 2.2.11 (Probability measure of an event).

Now, we define probability measure of an event A as a degree of confidence or
a map $P:\sigma(\Omega)\to[0,1]$ satisfies the following properties or axioms:

  1. (i.)

$P(\Omega)=1,P(\varphi)=0,$

  2. (ii.)

$P(A^{c})=1-P(A)\in[0,1]$ for any event $A\in\sigma(\Omega)$,

  3. (iii.)

$P(A\cup B)=P(A)+P(B)$ for any two disjoint events A and B i.e. $A\cap
B=\varphi$,

The third axiom or property can be generalized to ($\sigma-$ additive of) any
countable collection of mutually disjoint events ${A_{i}}$ as follows:

$\displaystyle P(\cup_{i=1}^{\infty}A_{i})$
$\displaystyle=\sum_{i=1}^{\infty}P(A_{i})\ \mbox{for any mutually disjoint
events i.e.}$ $\displaystyle\ A_{i}\cap A_{j}$ $\displaystyle=\varphi\
\mbox{for}\ i\neq j.$

A probability measure of an event A can be computed using a suitable
probability law (e.g. a uniform law or symmetrical outcomes) in the following
two steps:

  1. (01)

first come up with an assumption or information from the random experiment,
where first instant assumption happens to be uniform assumption (or equally
likely outcomes or symmetrical outcomes). For example, in a single toss of a
coin, the chances of getting both head and tail are equal due to symmetrical
coin (with respect to head and tail).

  2. (02)

then computing the probability measure of an event using the assumption
observed from the random experiment in step-01 and the axioms (2.2.11) of the
probability measure of the event.

######  Example 2.2.12 (A roll of a die).

Question: In a roll of a fair die, compute probability of occurrence of each
and every outcomes.

Answer: In a roll of a fair die, the sample space is given by

$\displaystyle\Omega=\\{1,2,3,4,5,6\\}.$

As the die happens to be fair, so each outcome is equally likely in the roll
of the fair die i.e. there is a uniform law of distribution of outcomes. So,
we have

$\displaystyle P(1)=P(2)=P(3)=P(4)=P(5)=P(6)$ (2.1)

Now, using axioms of the probability measure for an event, we have

$\displaystyle
P(\Omega)=1,\Omega=\\{1\\}\cup\\{2\\}\cup\\{3\\}\cup\\{4\\}\cup\\{5\\}\cup\\{6\\}\implies$
$\displaystyle P(1)+P(2)+P(3)+P(4)+P(5)+P(6)=1$ (2.2)

Solving for equations (2.1) and (2.2.12), we get

$\displaystyle P(1)=P(2)=P(3)=P(4)=P(5)=P(6)=1/6.$

######  Example 2.2.13 (Swimming in leisure time per week a day).

Ram likes swimming in leisure time per week on a day. An outcome is a day that
is

$\displaystyle\Omega=\\{Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday\\}.$

The first instant assumption is the uniform as each day is equally likely, so
we have

$\displaystyle P(Monday)$ $\displaystyle=P(Tuesday)=P(Wednesday)=P(Thursday)$
$\displaystyle=P(Friday)=P(Saturday)=P(Sunday).$

Now, using axioms of probability measure of an event, we have

$\displaystyle P(Monday)$ $\displaystyle+P(Tuesday)+P(Wednesday)+P(Thursday)$
$\displaystyle+P(Friday)+P(Saturday)+P(Sunday)=1.$

By solving above two equations, we get

$\displaystyle P(Monday)$ $\displaystyle=P(Tuesday)=P(Wednesday)=P(Thursday)$
$\displaystyle=P(Friday)=P(Saturday)=P(Sunday)=1/6.$

######  Example 2.2.14 (swimming on weekday as often as weekend).

Ram goes for swimming on weekday as often as weekend. The first instant
assumption says that weekdays and weekends are equally likely. So

$\displaystyle P(Weekdays)=P(Weekends)=1/2.$

Further, there are 5 days in weekdays, and each of these 5 days are equally
likely, so, we have

$\displaystyle P(Monday)$ $\displaystyle=P(Tuesday)=P(Wednesday)=P(Thursday)$
$\displaystyle=P(Friday)=1/2\cdot 1/5=1/10.$

And there are two days in weekends, and each of these 2 days are equally
likely, so, we have

$\displaystyle P(Saturday)=P(Sunday)=1/2\cdot 1/2=1/4$

######  Example 2.2.15 (Continuation of information from the previous two
examples).

He goes on Friday equals to Sum of Wednesday and Thursday. Let
$P(Wednesday)=P(Thursday)=p$. Then $P(Friday)=2p$ and
$P(Monday)=P(Tuesday)=\frac{1}{2}\cdot\left(\frac{1}{2}-4p\right)=\frac{1}{4}-2p>0\implies
0<p<1/8$.

Note: probability measure is not assigned to an individual outcome, it is
assigned to an event containing the outcome.

######  Example 2.2.16.

Five balls numbered $1,2,3,4,5$ are drawn from an urn without replacement.
Then compute the probability that they will be drawn in the same order as
their number.

Each outcome is represented by the 5-tuple $(z_{1},z_{2},z_{3},z_{4},z_{5})$,
so total possible outcomes are $|\Omega|=5!=120$. The only outcome in the
event $A$ is $(1,2,3,4,5)$. Hence, the desired probability is

$\displaystyle P(A)=\frac{1}{120}.$

######  Example 2.2.17 (Monte Hall problem).

Background: suppose you’re on a game show, and you’re given the choice of
three doors: behind one door there is a car, behind the others, there are
goats. You pick a door (say No. 1), and the host, who knows what’s behind the
doors, opens another door (say No. 3), which has a goat. He then says to you,
’do you want to pick door No. 2?’

Question: Compute the probability with which the player wins by switching.

Answer: first we need to all possible outcomes followed by an event of
interest (i.e. the player wins by switching) and probability measure of the
event.

  1. a.

In order to identify an outcome, we recall a randomly determined quantities
that may help to determine the outcome as:

    1. i.

the door concealing the car (as a first layer of information),

    2. ii.

the door initially chosen by the player (as a second layer of information),

    3. iii.

the door that the host opens to reveal a goat (as a third layer of
information).

Figure 2.5: Three randomly determined quantities are defining three layers of
information upside down in the tree plot.

Consider the doors are A, B and C instead of 1, 2, and 3. Now as the first
layer of the tree (see in figure (2.5)) is the door concealing the prize. So,
the prize may be behind any of the three doors A,B and C in equally likely
manner.

The player could initially choose any of the three doors is the second layer
of the tree (see in figure (2.5)).

Then a third layer of the tree (see in figure (2.5)) is that the host opens a
door to reveal a goat.

If the prize is behind door A and the player picks door A, then the host could
open either door B or door C. So, the possible outcomes are AAB or AAC.

If the prize is behind door A and the player picks door B, then the host must
open door C. So, a possible outcomes is ABC.

Repeating all the possibility of above three randomly-determined quantities,
then the leafs of the tree (see in figure (2.5)) determine all the 12 possible
outcomes of the random experiment. So, sample space is given by

$\displaystyle\Omega$
$\displaystyle=\left\\{AAB,AAC,ABC,ACB,BAC,BBA,BBC,BCA,CAB,\right.$
$\displaystyle\left.CBA,CCA,CCB\right\\}.$

  2. b.

The event of interest is determined by the statement that the player wins by
switching. So, the desired event is given by

$\displaystyle E=\\{ABC,ACB,BAC,BCA,CAB,CBA\\}.$

  3. c.

Computing probability measure of the desired event E. Consider the topmost
event of the tree (see in figure (2.5)) i.e. the outcome $AAB$, then, the
probability of $AAB$ computed as:

$\displaystyle
P(AAB)=P(A)P(A|A)P(B|A,A)=\frac{1}{3}\cdot\frac{1}{3}\cdot\frac{1}{2}=\frac{1}{18}.$

Similarly, we can compute probability of every possible outcome as a leaf of
the tree (see in figure (2.5)) in the following probability tree diagram:

Figure 2.6: A plot of probability three is containing probability of every
possible outcome of the Monte-Hall problem.

So, the desired probability is given by

$\displaystyle
P(E)=P\left(\\{ABC,ACB,BAC,BCA,CAB,CBA\\}\right)=6\cdot\frac{1}{9}=\frac{2}{3}.$

######  Example 2.2.18.

(sampling with order and replacement] Compute number of distinct non-negative
integer-valued solutions of the equation

$\displaystyle x_{1}+x_{2}+\ldots+x_{k}=n.$ (2.3)

Consider a sequence of n $*$’s and m-1 $|$’s. There is a bijection between
such sequences and non-negative integer-valued solutions to the equation. For
example, if $m=4$ and $n=3$, i.e.a sequence of $n=3\ *$’s and $m-1=4-1=3\ |$’s

$\displaystyle\underbrace{\star\ \star}_{x_{1}=2}\ |\ \underbrace{\ \
}_{x_{2}=0}|\underbrace{\ \star\ }_{x_{3}=1}|\underbrace{\ \ }_{x_{4}=0}.$

There are $\left(\begin{array}[]{cc}n+m-1\\\ n\end{array}\right)$ sequences of
n $\\*$’s and m-1 $|$’s and, hence, the same number of solutions to the
equation (2.3).

######  Example 2.2.19.

Question: consider a urn with 15 identical (in shapes), but different (in
colour) balls (i.e. an instant of seven white, two green, and six red). If you
draw a ball from the urn, then compute the probability of drawing the ball
from the urn.

Solution: Drawing a from the urn means either drawing a white as a type A, or
drawing a red ball as a type B or drawing a green ball as a type C. So, out of
the fifteen identical balls, A contains seven equally likely favourable
outcomes, B contains six equally likely favourable outcomes and C contains two
equally likely favourable outcomes. And hence, we have the following
probabilities:

$\displaystyle P(A)=\frac{7}{15},\ P(B)=\frac{6}{15},\ \mbox{and}\
P(C)=\frac{2}{15}.$

######  Remark 2.2.20.

  1. a.

Two events $A$ and $B$ are mutually exclusive if $P(A\cap B)=0$.

  2. b.

######  Theorem 2.2.21.

Any two mutually disjoint events are mutually exclusive, but converse is not
true.

######  Proof 2.2.22.

Consider $A$ and $B$ are two mutually disjoint events. Then, we have

$\displaystyle A\cap B=\varphi\implies P(A\cap B)=P(\varphi)=0.$

So, $A$ and $B$ are two mutually exclusive.

###  2.3 Types of probabilistic models

Consider the number of persons at a business location that are talking on
their respective phones any-time between $9:00$ AM and $9:10$ AM. Clearly, the
possible outcomes are $0,1,2,\ldots,n$, where $n$ is the number of persons in
the office. On the other hand, if we are interested in the length of time a
particular caller is on the phone during that time period, then the outcomes
may be anywhere from $0$ to $T$ minutes, where $T=10$. Now the outcomes are
infinite in number since they lie within the interval $[0,T]$. In the first
case, since the outcomes are discrete (and finite), we can assign
probabilities to the outcomes $\\{0,1,2,\ldots,n\\}$. An equi-probable
assignment would be to assign each outcome a probability of $1/(n+1)$. In the
second case, the outcomes are continuous (and therefore infinite) and so it is
not possible to assign a non-zero probability to each outcome. In the
continuous case, it is not appropriate to ask for the probability that $T$
will be exactly, e.g. 5 minutes, because this probability will be zero.
Instead, we inquire as to the probability that $T$ will be between 5 and 6
minutes.

So, based on discrete and continuum patterns of outcomes in a sample space of
a random experiment, there are two types of probabilistic models:

  1. a.

Discrete probabilistic model

  2. b.

Continuous probabilistic model

####  2.3.1 Discrete probabilistic model

A probabilistic model of a random experiment is discrete if the sample space
of the random experiment is finite or at most countable (i.e. there are
finitely many outcomes or infinitely many outcomes which can be arranged into
a simple sequence) i.e. $\Omega=\\{\omega\\}_{k\in\mathbb{N}}$. And a
probability measure of an event A can be computed in the following two steps:

  1. a.

Come up with an assumption or information from the random experiment, where
first instant assumption happens to be uniform assumption (or equally likely
outcomes).

  2. b.

Computing the probability measure of an event using the assumption observed
from the random experiment in step-01 and the axioms of the probability
measure of the event.

######  Theorem 2.3.1 (Discrete probabilistic modelling).

A probabilistic modelling of a random experiment is discrete if

  1. a.

the sample space, $\Omega$, of the experiment is discrete i.e. $\Omega$ is at
most countable i.e. $\Omega$ contains at most a countable collection of
possible outcomes of the experiment i.e. $\Omega=\\{\omega_{n}|\omega_{n}\
\mbox{is a possible outcome}\\}$.

  2. b.

an even, $A$, is at most countable as a sub-sequence of some possible outcomes
i.e. $\\{\omega_{n_{k}}|\omega_{n_{k}}\ \mbox{satisfies a given
statement}\\}$.

  3. c.

Probability measure of an event (from a random experiment with a finite sample
space) is defined as the ratio of number outcomes occur in the event $A$ to
number outcomes occur in the sample space $\Omega$.

Note: If the sample space of a random experiment is a finite i.e.
$\Omega=\\{x_{1},x_{2},\ldots,x_{n}\\}$, then computation of probability
measure of an event A is given by

$\displaystyle P(A)=\frac{\mbox{number of outcomes occur in A}}{\mbox{number
of outcomes occur in}\ \Omega}.$

######  Example 2.3.2 (Throwing a die).

Consider a throw of a die, then $\Omega=\\{1,2,3,4,5,6\\}$. Define an event
$A\to$ even face or outcomes in the experiment, then $A=\\{2,4,6\\}$. So,
$P(A)=3/6=1/2$.

######  Example 2.3.3 (Tossing a coin twice).

Consider two tosses of a coin, then $\Omega=\\{HH,HT,TH,TT\\}$. Define an
event $A\to$ at least one head, then $A=\\{HH,HT,TH\\}$. So, $P(A)=3/4$.

######  Example 2.3.4 (Drawing ball from an urn (Feller, 1968)).

An urn has k red balls and $n-k$ black balls. If two balls are chosen in
succession and at random with replacement, then compute the probability of a
red ball followed by a black ball.

To solve the problem, we first label the k red balls with $1,2,\ldots,k$ and
the black balls with $k+1,k+2,\ldots,n$. In doing so the possible outcomes of
the experiment can be represented by a 2-tuple
$(z_{1},z_{2}):z_{1}=1,2,\ldots,n,z_{2}=1,2,\ldots,n$. A successful outcome is
a red ball followed by a black one so that the successful event is
$A=\\{(z_{1},z_{2}):z_{1}=1,2,\ldots,k,z_{2}=k+1,k+2,\ldots,n\\}$. Then the
desired probability is given by

$\displaystyle a.\
P(A)=\frac{k(n-k)}{n^{2}}=\frac{k}{n}\left(1-\frac{1}{n}\right)\ \mbox{with
replacement},$ $\displaystyle b.\
P(A)=\frac{k(n-k)}{n(n-1)}=\frac{k}{n}\left(1-\frac{1}{n}\right)\frac{n}{n-1}\
\mbox{without replacement}.$

######  Example 2.3.5.

Question: if two fair dice are tossed, find the probability that the same
number will be observed on each one. Next, find the probability that different
numbers will be observed.

Solution: if we toss two dice together than the sample is given by

$\displaystyle\Omega=\left\\{(i,j)|1\leq i\leq 6,1\leq j\leq
6\right\\}\implies|\Omega|=36.$

Now, probability that the same number will be observed on each one is given by

$\displaystyle
P\left(\\{(1,1),(2,2),(3,3),(4,4),(5,5),(6,6)\\}\right)=6\cdot\frac{1}{36}=\frac{1}{6}.$

And, the probability that different numbers will be observed is given by

$\displaystyle P(\mbox{different numbers will be observed})$
$\displaystyle=1-P\left(\\{(1,1),(2,2),(3,3),(4,4),(5,5),(6,6)\\}\right)$
$\displaystyle=1-6\cdot\frac{1}{36}=1-\frac{1}{6}=\frac{5}{6}.$

######  Example 2.3.6 (Birthday problem (Kay, 2006)).

A probability class has $n$ students enrolled. Then compute the probability
that at least two of the students will have the same birthday.

We first assume that each student in the class is equally likely to be born on
any day of the year. To solve this problem consider a birthday urn that
contains 365 balls. Each ball is labelled with a different day of the year.
Now allow each student to select a ball at random, note its date, and return
it to the urn. The day of the year on the ball becomes his/her birthday. The
probability desired is of the event that two or more students choose the same
ball. It is more convenient to determine the probability of the complement
event or that no two students have the same birthday. Then, the desired
probability is given by

$\displaystyle P(\mbox{at least 2 students have same birthday})$
$\displaystyle=1-P(\mbox{no students have same birthday})$
$\displaystyle=1-\frac{\left(\begin{array}[]{cc}365\\\
n\end{array}\right)}{365^{n}}.$

Figure 2.7: Probability of at least two students having the same birthday.

####  2.3.2 Continuous probabilistic model

A probabilistic model of a random experiment is continuous if the sample space
of the random experiment is at least continuum in nature i.e.
$\Omega\neq\\{x_{k}\\}_{k\in\mathbb{N}}$, but $\Omega$ is an interval or union
of intervals. In this case, a probability measure of an event $A$ can be
computed in the following two steps:

  1. a.

Come up with an assumption or information from the random experiment, where
first instant assumption happens to be uniform assumption (or equally likely
outcomes).

  2. b.

Computing the probability measure of an event using the assumption observed
from the random experiment in step-01 and the axioms of the probability
measure of the event.

######  Remark 2.3.7 (Uniform law).

Consider a sample space $\Omega=[a,b]$ with a uniform partition
$\\{x_{0}=a,x_{1},x_{2},\ldots,x_{n}=b\\}$ of width
$\delta=x_{i}-x_{i-1}=\frac{b-a}{n}$ i.e.
$[a,b]=[x_{0},x_{1}]\cup[x_{1},x_{2}]\cup\ldots\cup[x_{n-1},x_{n}]$ and the n
sub-intervals are mutually disjoint except the common terminal points.

As per uniform law or equally likely assumption we have

$\displaystyle P([x_{0},x_{1}])=P([x_{1},x_{2}])=\ldots=P([x_{n-1},x_{n}])\
\mbox{and}\ P([x_{i-1},x_{i}])\propto\delta$ $\displaystyle\implies
P([x_{i-1},x_{i}])=c_{i}\delta\ \mbox{for}\ i=1,2,\ldots,n\implies
c_{1}\delta=c_{2}\delta=\ldots=c_{n}\delta$ $\displaystyle\implies
c_{1}=c_{2}=\ldots=c_{n}=c\ \mbox{so}\ P([x_{i-1},x_{i}])=c\delta\ \mbox{for}\
i=1,2,\ldots,n.$

Now, using property of probability, we have

$\displaystyle
P([x_{0},x_{1}])+P([x_{1},x_{2}])+\ldots+P([x_{n-1},x_{n}])=P(\Omega)=1\implies
nc\delta=1$ $\displaystyle\implies c=\frac{1}{n\delta}=\frac{1}{b-a}\implies
P([x_{i-1},x_{i}])=\frac{\delta}{b-a}\ \mbox{for}\ i=1,2,\ldots,n.$

So, an equally likely or uniform law assumption for a continuous sample space
is a valid one and produces a probability equal to the ratio of the length of
the interval and the length of the sample space as follows:

$\displaystyle P([a,b])=\frac{\ \mbox{length of}\ [a,b]}{\ \mbox{length of}\
\Omega}=\frac{b-a}{\ \mbox{length of}\ \Omega}.$

Since the probability of a point event occurring is zero, the probability of
any interval

$\displaystyle P([a,b])=P((a,b])=P([a,b))=P((a,b))=\frac{b-a}{\ \mbox{length
of}\ \Omega}.$

######  Remark 2.3.8.

In continuous probabilistic modelling, we define probability of a subset of
$[0,1]$ as the length of the subset. It is easy to compute of a subset in an
interval or union of intervals. In real analysis, the concept of length of a
set is generalized to a measure of the set and it is always not possible to
come up with an explicit probability measure of every subset of a continuum
sample space. That is, we need to introduce some kind of finiteness pattern in
the continuum set, so that, a concrete probability measure can be defined
similar to computation of probabilities in the remark (2.3.7). For the sack of
simplicity, the finite pattern approach may lead to a well defined result that
every measurable set in a continuum sample space is having a probability
measure.

######  Example 2.3.9 (Linear dartboard).

Suppose one throws a dart at a linear dartboard as shown in Figure (2.8) and
measures the horizontal distance from the bullseye or center at $x=0$. We will
then have a sample space $\Omega=\\{x|-\frac{1}{2}\leq x\leq\frac{1}{2}\\}$
which is continuum in nature i.e. not countable. A possible approach is to
assign probabilities to intervals (i.e. events in $\Omega$) as opposed to
sample points. If the dart is equally likely to land anywhere, then we could
assign the interval $[a,b]$ a probability equal to the length of the interval
or

$\displaystyle P([a,b])=\frac{b-a}{\frac{1}{2}+\frac{1}{2}}=b-a\ \mbox{for}\
-\frac{1}{2}\leq a\leq b\leq\frac{1}{2}.$

Figure 2.8: A linear dartboard.

######  Example 2.3.10.

Question: a person always arrives at his job between 8:00 AM and 8:20 AM. He
is equally likely to arrive any time within that period. What is the
probability that he will arrive at 8:10 AM? What is the probability that he
will arrive between 8:05 and 8:10 AM?

Solution: since arrival time between 08:00 AM to 08:20 AM. And the person is
arriving in equally likely manner in the interval. So, we have

$\displaystyle(a.)\ P(\mbox{he will arriave at 8:10 AM})=0.$

And

$\displaystyle(b.)\ P(\mbox{he will arriave between 8:05 AM and 08:10 AM})$
$\displaystyle=\frac{08:10-08:05}{08:20-08:00}$
$\displaystyle=\frac{5}{20}=\frac{1}{4}.$

######  Example 2.3.11 (Arrival time).

A person always arrives at his job between 8:00 AM and 8:20 AM. He is equally
likely to arrive any time within that period. What is the probability that he
will arrive at 8:10 AM? What is the probability that he will arrive between
8:05 and 8:10 AM?

Solution: since arrival time between 08:00 AM to 08:20 AM. And the person is
arriving in equally likely manner in the interval. So, we have

$\displaystyle(a.)\ P(\mbox{he will arriave at 8:10 AM})=0.$

And

$\displaystyle(b.)\ P(\mbox{he will arriave between 8:05 AM and 08:10 AM})$
$\displaystyle=\frac{08:10-08:05}{08:20-08:00}$
$\displaystyle=\frac{5}{20}=\frac{1}{4}.$

######  Example 2.3.12 (Romeo and Juliet meeting (Bertsekas and Tsitsiklis,
2008)).

Romeo and Juliet have a date on given time and each will arrive at the meeting
with a delay between 0 and 1 hour with all the pair of delays are equally
likely. The first to arrive wait 15 minutes and will leave the place if the
other has not arrived. Compute the probability of meeting.

The sample space of the experiment is as follows: $\Omega=\\{(x,y)|0\leq x\leq
1,0\leq y\leq 1\\}$. Event of interest of the problem is
$A=\\{(x,y)||x-y|\leq\frac{1}{4},0\leq x\leq 1,0\leq y\leq 1\\}$ and is shaded
in the figure (2.9).

Figure 2.9: The event $A$ that Romeo and Juliet will arrive within 15 minutes
of each other.

Thus, the desired probability is given by

$\displaystyle
P(A)=1-\frac{3}{4}\cdot\frac{3}{4}=1-\frac{9}{16}=\frac{7}{16}.$

###  2.4 Conditional probability

In many real-world experiments, an outcome may not be completely random since
we have some prior knowledge. For instance, (a.) knowing that it has rained
the previous 2 days might influence our assignment of the probability of
sunshine for the following day, (b.) knowing that from a population, a
person’s height exceeds 6 ft might influence assignment of probability that he
weighs more than $100$kg. It is the interaction between the original
probabilities and the probabilities in light of prior knowledge that we wish
to describe and quantify, leading to the concept of a conditional probability.
So, it provides us with a way to reason about the outcome of an experiment,
based on partial information.

######  Definition 2.4.1 (Conditional probability).

Suppose that we know outcome of an event $A$ is within some given event $B$,
then conditional probability of $A$ given $B$ with $P(B)>0$ is defined as
below:

$\displaystyle P(A|B)=\frac{P(A\cap B)}{P(B)}.$

Figure 2.10: A self-explanatory meaning of conditional probability in Hindi
with corresponding translation in English.

######  Example 2.4.2.

Question: In three successive tosses of a fair coin, compute the conditional
probability $P(A|B)$ when $A$ and $B$ are the events

$\displaystyle A=\\{\mbox{more heads than tails come up}\\},\ B=\\{\mbox{1st
toss is a head}\\}.$

Answer: We have the sample space as a collection of all possible outcomes

$\displaystyle\Omega=\\{HHH,HTH,HHT,THH,TTH,THT,HTT,TTT\\}$

and the events:

$\displaystyle A=\\{\mbox{more heads than tails come up}\\},\ B=\\{\mbox{1st
toss is a head}\\}.$

Then

$\displaystyle P(A|B)=\frac{P(A\cap B)}{P(B)}=\frac{3}{4}.$

######  Example 2.4.3 ((Bertsekas and Tsitsiklis, 2008)).

Question: a conservative design team, call it C, and an innovative design
team, call it N, are asked to separately design a new product within a month.
From past experience we know that:

  1. (a)

The probability that team C is successful is $2/3$.

  2. (b)

The probability that team N is successful is $1/2$.

  3. (c)

The probability that at least one team is successful is $3/4$.

If both teams are successful, the design of team N is adopted. Assuming that
exactly one successful design is produced, then compute the probability that
it was designed by team N.

Answer: There are four possible outcomes here, corresponding to the four
combinations of success and failure of the two teams as follows:

$\displaystyle\Omega=\\{SS,SF,FS,FF\\}\ \mbox{where}\ SF\equiv C\
\mbox{succeeds and }\ N\mbox{fails}.$

02: Events of interests and corresponding probabilities.

  1. a.

$A_{1}\to C$ is successful i.e.$A_{1}=\\{SS,SF\\}$, so $P(A_{1})=2/3$.

  2. b.

$A_{1}\to N$ is successful i.e. $A_{2}=\\{FS,FF\\}$, so $P(A_{2})=1/2$.

  3. c.

$A_{3}\to$ at least one team is successful i.e. $A_{3}=\\{SS,SF,FS\\}$, so
$P(A_{3})=3/4$.

  4. d.

From normalizing property of $\Omega$, we have
$P(\\{SS.SF,FS,FF\\})=P(\Omega)=1$.

So, we have

$\displaystyle P(SS)=5/12,P(SF)=1/4,P(FS)=1/12,P(FF)=1/4.$

The the desired probability is given by

$\displaystyle
P(A)=P(\\{SF\\}|\\{SF,FS\\})=\frac{P(SF)}{P(SF)+P(FS)}=\frac{1}{4}.$

######  Example 2.4.4 (bus arrival time).

Question: this morning, I caught the bus whose arrival time is based on an
uniform assumption (i.e. it is equally likely to come at any time) that bus
always comes within at most one hour. Compute the probability that whether bus
came within the first 5 minutes in the following two situation (a.) not any
further information, (b.) the bus actually came in the first 10 minutes.

Solution: In the absence of any further information, you would say this is
quite unlikely as

$\displaystyle
P\left(t\in\left[0,\frac{1}{12}\right]\right)=\frac{1}{12}\approx 0.083.$

I give you a hint: I tell you that the bus actually came in the first 10
minutes. given this additional information, it seems much more likely that the
bus came in the first 5 minutes than without this information in figure
(2.11).

$\displaystyle
P\left(t\in\left.\left[0,\frac{1}{12}\right]\right|\left[0,\frac{1}{6}\right]\right)=\frac{1}{2}=0.5.$

Figure 2.11: Bus arrival time conditioned on the bus actually came in the
first 10 minutes.

####  2.4.1 Joint probability

######  Definition 2.4.5 (Joint probability (Bertsekas and Tsitsiklis, 2008)).

In order to compute joint probability of two events A and B is a restatement
of the definition of conditional probability (2.4.1) leads to a multiplication
rule as:

$\displaystyle P(A\cap B)=\left\\{\begin{array}[]{cc}P(A)P(B|A)&\ \mbox{if A
occurs first}\\\ P(B)P(A|B)&\ \mbox{if B occurs first}.\end{array}\right.$

Furthermore, an event A which occurs if and only if each one of several events
$A_{1},\ldots,A_{n}$ has occurred, i.e.

$\displaystyle A=A_{1}\cap\ldots\cap A_{n}\to
P(A)=P(A_{1})P(A_{2}|A_{1})\cdots P(A_{n}|A_{1},\ldots,A_{n-1}).$

The occurrence of A can be viewed as an occurrence of $A_{1}$, followed by the
occurrence of $A_{2}$, then of $A_{3}$, etc, and it is visualized as a path on
the tree with n branches, corresponding to the events $A_{1},\ldots,A_{n}$ in
(2.12).

Figure 2.12: Visualizing occurrence of A through joint occurrence of
$A_{1},\ldots,A_{n}$ sequentially.

######  Example 2.4.6.

Question: In a factory there are 100 units of a certain product, 5 of which
are defective. When we pick three units from the 100 units at random, compute
the probability that none of them are defective.

Solution: let $A_{i}$ is the event that the ith chosen unit is not defective,
for $i=1,2,3$. Then, we need to compute $P(A_{1}\cap A_{2}\cap A_{3})$ as the
desired probability of interest.

Now, we have

$\displaystyle P(A_{1})=\frac{95}{100}\ \mbox{from uniform assumption}.$

Given that the first chosen item was good, the second item will be chosen from
94 good units and 5 defective units, thus

$\displaystyle P(A_{2}|A_{1})=\frac{94}{99}\ \mbox{from uniform assumtion
conditioned on}\ A_{1}.$

Given that the first and second chosen items were okay, the third item will be
chosen from 93 good units and 5 defective units, thus

$\displaystyle P(A_{3}|A_{1},A_{2})=\frac{93}{98}\ \mbox{from uniform
assumtion conditioned on}\ A_{1},A_{2}.$

So, the desired probability is given by

$\displaystyle P(A)$ $\displaystyle=P(A_{1}\cap A_{2}\cap
A_{3})=P(A_{1})P(A_{2}|A_{1})P(A_{3}|A_{1},A_{2})$
$\displaystyle=\frac{95}{100}\cdot\frac{94}{99}\cdot\frac{93}{98}=0.8560.$

######  Definition 2.4.7 (Independent events).

Consider two events A and B, if chance of occurrence of one first does effect
the chance of occurrence of the other i.e. conditioned on the outcome of one
event does not change the probability of the other event, then these two
events are independent to each other. Mathematically,

$\displaystyle P(B|A)=P(B)\ \mbox{or}\ P(A|B)=P(A)\implies P(A\cap
B)=P(A)P(B).$

It can generalized to a sequence of events namely $A_{1},A_{2},\ldots,A_{n}$:
the events $A_{1},\ldots,A_{n}$ are independent if

$\displaystyle P(A_{i}|A_{j_{1}},\ldots,A_{j_{k}})=P(A_{i})\ \mbox{for}\ i\neq
j_{1}\neq\ldots\neq j_{k},1\leq k\leq n.$

Furthermore, conditioned on an event C, the events A and B are called
conditionally independent if

$\displaystyle P(B|A,C)=P(B|C)\ \mbox{or}\ P(A|B,C)=P(A|C)\implies$
$\displaystyle P(A\cap B|C)=P(A|C)P(B|C).$

######  Example 2.4.8.

Backdrop: Consider two independent fair coin tosses, in which all f a our
possible outcomes are equally likely. Let

$\displaystyle A_{1}=\\{1st\ \mbox{toss is a head.}\\},A_{2}=\\{2nd\
\mbox{toss is head.}\\},$ $\displaystyle B=\\{\mbox{the two tosses have
different results.}\\}$

Question: show that (a.) $A_{1}$ and $A_{2}$ are independent, (b.) but
conditioned on B, $A_{1}$ and $A_{2}$ are dependent.

Answer: we have

$\displaystyle A_{1}=\\{HT,HH\\},A_{2}=\\{TH,HH\\},B=\\{HT,TH\\}\implies
P(A_{1})=\frac{1}{2},$ $\displaystyle
P(A_{2})=\frac{1}{2},P(B)=\frac{1}{2},P(A_{1}\cap A_{2})=\frac{1}{4}$
$\displaystyle P(A_{1}|B)=\frac{1}{1},P(A_{2}|B)=\frac{1}{2},P(A_{1}\cap
A_{2}|B)=0.$

Then

$\displaystyle P(A_{1}\cap
A_{2})=\frac{1}{4}=\frac{1}{2}\cdot\frac{1}{2}=P(A_{1})P(A_{2})\implies$
$\displaystyle\ \mbox{$A_{1}$ and $A_{2}$ are indepedent}.$

Again

$\displaystyle P(A_{1}\cap A_{2}|B)=0\neq
P(A_{1}|B)P(A_{2}|B)=\frac{1}{2}\cdot\frac{1}{2}=\frac{1}{4}\implies$
$\displaystyle\ \mbox{$A_{1}|B$ and $A_{2}|B$ are depedent}.$

####  2.4.2 Total probability

######  Definition 2.4.9 (Mutually disjoint events).

Consider any two sets $A$ and $B$. Then A and B are mutually disjoint if

$\displaystyle A\cap B=\varphi.$

Moreover, a list of events namely $E_{1},E_{2},E_{3},\ldots$ are mutually
disjoint if the intersection of any pair of events is empty, that is,

$\displaystyle E_{i}\cap E_{j}=\varphi\ \mbox{for}\ i\neq j,\
i,j=1,2,3,\ldots.$

######  Definition 2.4.10 (Mutually exclusive events).

Consider two events $A$ and $B$ in a probabilistic modelling of a random
experiment. Then A and B are mutually exclusive if

$\displaystyle P(A\cap B)=0\ \mbox{i.e. joint occurance of A and B is
impossible}.$

That is, happening of one in a single trial, kills the happening of the other
(or others) in the same trial. For example, a coin cannot land with head and
tail (or a die cannot land with several faces up), so they are exclusive
outcomes.

Moreover, a list of events namely $E_{1},E_{2},E_{3},\ldots$ are mutually
exclusive if the joint occurrence of any pair of events is impossible, that
is,

$\displaystyle P(E_{i}\cap E_{j})=0\ \mbox{for}\ i\neq j,\ i,j=1,2,3,\ldots.$

And, for mutually exclusive events $E_{1},E_{2},E_{3},\ldots$, we have

$\displaystyle P(E_{1})+P(E_{2})+P(E_{3})+\ldots\leq 1=P(\Omega).$

######  Definition 2.4.11 (collectively exhaustive).

A list of events $E_{1},E_{2},E_{3},\ldots$ in a probabilistic modelling of a
random experiment is collectively exhaustive if

$\displaystyle E_{1}\cup E_{2}\cup E_{3}\cup\ldots=\Omega\implies P(E_{1}\cup
E_{2}\cup E_{3}\cup\ldots)=1=P(\Omega).$

Moreover, if a list of events $E_{1},E_{2},E_{3},\ldots$ are mutually
exclusive and collectively exhaustive, then

$\displaystyle P(E_{1})+P(E_{2})+P(E_{3})+\ldots=1=P(\Omega).$

######  Example 2.4.12.

Consider a random experiment with the sample space: $\Omega=\\{1,2,3,4\\}$,
and define a few events as:

$\displaystyle A_{1}=\\{1,2\\},\ A_{2}=\\{3\\},\ B_{1}=\\{1,2,3\\},\
B_{2}=\\{3,4\\}.$

Then

  1. a.

$A_{1}=\\{1,2\\}$ and $A_{2}=\\{3\\}$ are mutually exclusive but not
collectively exhaustive.

  2. b.

$B_{1}=\\{1,2,3\\}$ and $B_{2}=\\{3,4\\}$ are collectively exhaustive but not
mutually exclusive.

  3. c.

$\\{A_{1},B_{2}\\}=\\{1,2,3,4\\}$ is a collection of mutually exclusive and
collectively exhaustive events, and is thus it forms a partition of the sample
space $\Omega$.

######  Theorem 2.4.13 (Mutually disjoint vs mutually exclusive).

In a probabilistic modelling of a random experiments, mutually disjoint events
are also mutually exclusive, but converse is not true.

######  Proof 2.4.14.

Consider two mutually disjoint events A and B in a probabilistic modelling of
a random experiment. Then

$\displaystyle A\cap B=\varphi\implies P(A\cap B)=P(\varphi)=0.$

Since $P(A\cap B)$, so the mutually disjoint events A and B are also mutually
exclusive.

A counter example of the converse: consider points in the square with each
coordinate uniformly distributed from 0 to 1. Let A be the event where the
x-coordinate is 0, and B be the event that the y-coordinate is 0. Then

$\displaystyle A\cap B=\\{(0,0)\\}\neq\varphi,\ \mbox{but}\ P(A\cap B)=0.$

So A and B are not mutually disjoint, but they are mutually exclusive.

Another counter example: consider a sample space be $\Omega=\\{x,y,z\\}$ with
probabilities $P(\\{x\\})=0,P(\\{y\\})=1/2$, and $P(\\{z\\})=1/2$. If
$A=\\{x,y\\}$ and $B=\\{x,z\\}$, then $A\cap B=\\{x\\}$, but $P(A\cap
B)=P(\\{x\\})=0$. That is, they are mutually exclusive but not disjoint.

######  Definition 2.4.15 (Total probability).

Consider a sample space $\Omega$ with a partition $\\{B_{1},\ldots,B_{n}\\}$
i.e.

  1. a.

mutually exclusive:

$\displaystyle B_{i}\cap B_{j}=\varphi\ \mbox{for any pair of}\
B_{i},B_{j},i\neq j.$

  2. b.

collectively exhaustive:

$\displaystyle B_{1}\cup B_{2}\cup\ldots\cup B_{n}=\Omega.$

Suppose $A\subset\Omega$ be an event in the experiment, then $\\{B_{1}\cap
A,\ldots,B_{n}\cap A\\}$ introduces a partition of A as (in figure (2.13)):

  1. a.

mutually exclusive:

$\displaystyle(B_{i}\cap A)\cap B_{j}\cap A=\varphi\ \mbox{for any pair of}\
B_{i},B_{j},i\neq j.$

  2. b.

collectively exhaustive:

$\displaystyle B_{1}\cap A\cup B_{2}\cap A\cup\ldots\cup B_{n}\cap A=A.$

Figure 2.13: Visualizing a partition of event A through partition of the
sample space $\Omega$.

Then,

$\displaystyle P(A)$ $\displaystyle=P(A\cap B_{1}\cup\ldots\cup A\cap
B_{n})=\sum_{i=1}^{n}P(A\cap B_{i})$
$\displaystyle=\sum_{i=1}^{n}P(B_{i})P(A|B_{i}).$

######  Example 2.4.16.

Question: Three machines make parts at a factory. Suppose, we know the
following about the manufacturing process that Machine 1 ($M_{1}$) makes
$60\%$ of the parts, Machine 2 ($M_{2}$) makes $30\%$ of the parts, Machine 3
($M_{3}$) makes $10\%$ of the parts. Of the parts $M_{1}$ makes $7\%$ are
defective, of the parts $M_{2}$ makes $15\%$ are defective, of the parts
$M_{3}$ makes $30\%$ are defective. Compute the probability of defective
products produced by the factory.

Answer: the desired probability of defective product produced by the factory
is given by

$\displaystyle P(D)$
$\displaystyle=P(M_{1})P(D|M_{1})+P(M_{2})P(D|M_{2})+P(M_{3})P(D|M_{3})$
$\displaystyle=0.6\cdot 0.07+0.3\cdot 0.15+0.1\cdot 0.3=0.117.$

####  2.4.3 Bayes rule

######  Definition 2.4.17 (Bayes rule).

Consider two events A and B with $P(A)>0,P(B)>0$, then Bayes rule is a
restatement of the definition of conditional probability (2.4.1) together with
total probability (2.4.15) as:

$\displaystyle P(A\cap B)=\left\\{\begin{array}[]{cc}P(A)P(B|A)&\ \mbox{if A
occurs first}\\\ P(B)P(A|B)&\ \mbox{if B occurs first}.\end{array}\right.$
$\displaystyle\implies P(B|A)=\frac{P(A\cap B)}{P(A)}=\frac{P(A\cap
B)}{\sum_{i=1}^{n}P(B_{i})P(A|B_{i})}$

where, events $\\{B_{1},\ldots,B_{n}\\}$ together is a partition of the sample
space $\Omega$, and hence it brings a partition of the event A as $\\{A\cap
B_{1},\ldots,A\cap B_{n}\\}$.

Furthermore, the probabilities of effect causes $\\{B_{1},\ldots,B_{n}\\}$
conditioned on effect A, can be reverse calculated as

$\displaystyle P(B_{k}|A)=\frac{P(A\cap
B_{k})}{P(A)}=\frac{P(B_{k})P(A|B_{k})}{\sum_{k=1}^{n}P(B_{i})P(A|B_{i})}.$

######  Example 2.4.18 (01: Medical diagnostics for a rare disease i.e. a
false positive).

Le A be the event that the test comes back positive, and B be the event that
you have the disease. Our modelling assumptions are: 1. $95\%$ of patients
with the disease test positive i.e. $P(A|B)=0.95$, 2. $2\%$ of patients
without the disease test positive i.e. $P(A|B^{c})=0.02$, 3. one in a thousand
people have the disease i.e. $P(B)=0.001$. Compute the probability $P(B|A)\to$
you have the disease given that the test comes back positive.

Answer: we have the following probabilistic data:

$\displaystyle P(A|B)=0.95,P(A|B^{c})=0.02,P(B)=0.001.$

Now, in order to compute the desired probability $P(B|A)$, we apply Bayes rule
as :

$\displaystyle P(B|A)$
$\displaystyle=\frac{P(B)P(A|B)}{P(B)P(A|B)+P(B^{c})P(A|B^{c})}=\frac{0.001\cdot
0.95}{0.001\cdot 0.95+0.999\cdot 0.02}$ $\displaystyle\approx 0.045.$

######  Example 2.4.19 (Airport security).

Question: on an airport all passengers are checked carefully. Let T be the
random variable indicating whether somebody is a terrorist (i.e.$t=1$) or not
(i.e. $t=0$) and A be the variable indicating arrest (i.e. $A=a\in\\{0,1\\}$.
A terrorist shall be arrested with probability $P(A=1|T=1)=0.98$, a non-
terrorist with probability $P(A=1|T=0)=0.001$. One in hundred thousand
passengers is a terrorist, (i.e. $P(T=1)=0.00001$. Compute the probability
that an arrested person actually is a terrorist.

Answer: using Bayes theorem, we have

$\displaystyle P(T=1|A=1)$ $\displaystyle=\frac{P(T=1)P(A=1|T=1)}{P(A=1)}$
$\displaystyle=\frac{P(T=1)P(A=1|T=1)}{P(T=0)P(A=1|T=0)+P(T=1)P(A=1|T=1)}$
$\displaystyle=\frac{0.00001\cdot 0.98}{(1-0.00001)\cdot 0.001+0.00001\cdot
0.98}\approx 0.01$

######  Remark 2.4.20 (Screening test for a disease).

One thousand in a 100 thousand people have the disease i.e. disease rate is
$1\%$. $99\%$ accurate doesn’t really give us information about the disease.
So, we use the following terms:

  1. a.

Sensitivity - the odds that the test will be positive if you have the disease.
A $98\%$ sensitive means, it will correctly identify 980 of 1000 people with
the disease i.e. it also incorrectly claim $20=1000-980$ people with the
disease don’t have it,

  2. b.

Specificity - the odds that the test will be negative if you lack the disease.
A $99\%$ specific means, it correctly identify 98,010 of 99,000 without the
disease i.e. it also incorrectly claim $990=99000-98010$ people without the
disease have it.

  3. c.

Positive predictive value - the odds that the test will correctly predict you
have the disease, if you test positive. So, out of $1970=980+990$ people (true
positive and false positive) who test positive, 980 have the disease. Thus,
our positive predictive value is $1000/1970=50.76\%$.

  4. d.

Negative predictive value - the odds that the test will correctly predict you
lack the disease, if you test negative.So, Out of $98030=98010+20$ who test
negative (false negative and true negative), 99000 do not have the disease.
Thus, our negative predictive value is $98030/99000=99.02\%$.

In this case, this test is first-rate for determining who lacks the disease.
The 1970 (true positive and false positive), who test positive can be tested
to confirm they do have the disease, whereas those who tested negative (false
negative and true negative) need no further tests.

######  Remark 2.4.21.

The accuracy of a DNA test would be in its ability to predict a match vs non-
match between two samples of blood. For example, I draw blood from one person
into two tubes, then perform the test and see if it matches. Repeat a bunch
and divide the positives by the total, that’s the sensitivity. Then draw blood
from two random donors, repeat, and divide the number of negatives over the
total. That’s the specificity. They are testing whether the machine can tell
$A=A$ and $\neq B$, not whether a random sample of all the humans on the
planet will match your blood specifically.

######  Example 2.4.22 (Drug test).

Question: a drug test (say T) has 1% false positives (i.e. 1% of those not
taking drugs show positive in the test), and 5% false negatives (i.e. 5% of
those taking drugs test negative). Suppose that 2% of those tested are taking
drugs. Compute the probability that somebody who tests positive is actually
taking drugs (say D).

Answer: we define here

  1. a.

$T=p\to$ Test positive,

  2. b.

$T=n\to$ Test negative,

  3. c.

$D=p\to$ person takes drug,

  4. d.

$D=n\to$ person does not take drugs

Now, we have

  1. i.

false positive i.e. test positive given that person does not take drug:
$P(T=p|D=n)=0.01$

  2. ii.

false negatives i.e. test negative given that person takes drug:
$P(T=n|D=p)=0.05\implies P(T=p|D=p)=0.95$ : true positives i.e. test positive
given that person takes drug.

  3. iii.

drug consuming rate: $P(D=p)=0.02\implies P(D=n)=0.98$.

Then, using Bayes theorem, the probability that somebody who tests positive is
actually taking drugs computed as:

$\displaystyle P(D=p|T=p)$ $\displaystyle=\frac{P(D=p)P(T=p|D=p)}{P(T=p)}$
$\displaystyle=\frac{P(D=p)P(T=p|D=p)}{P(D=n)P(T=p|D=n)+P(D=p)P(T=p|D=p)}$
$\displaystyle=\frac{0.02\cdot 0.95}{0.98\cdot 0.01+0.02\cdot 0.95}\approx
0.66.$

An alternative way to solve this exercise is using decision trees. Let’s
assume there are 1000 people tested. Then we have following decision tree:

Figure 2.14: In left plot, there is a decision tree of 100 tested people and
in the right plot there is a contingency table for tested people.

So, from the contingency table (2.14), we have

$\displaystyle\frac{\mbox{taking drug and tests positive}}{\mbox{all positive
tests}}=\frac{19}{28.8}\approx 0.66.$

There is a chance of only two thirds that someone with a positive test is
actually taking drugs.

######  Example 2.4.23 (Oral exam).

In an oral exam you have to solve exactly one problem, which might be one of
three types, A, B, or C, which will come up with probabilities 30%, 20%, and
50%, respectively. During your preparation you have solved 9 of 10 problems of
type A, 2 of 10 problems of type B, and 6 of 10 problems of type C. Then, (a)
compute the probability that you will solve the problem of the exam, (b.)
given you have solved the problem, compute the probability that it was of type
A.

Answer: the probability to solve the problem of the exam is the probability of
getting a problem of a certain type times the probability of solving such a
problem, summed over all types. This is known as the total probability.

$\displaystyle P(solved)$
$\displaystyle=P(solved|A)P(A)+P(solved|B)P(B)+P(solved|C)P(C)$
$\displaystyle=\frac{9}{10}\cdot 30\%+\frac{2}{10}\cdot 20\%+\frac{6}{10}\cdot
50\%=\frac{27}{100}+\frac{4}{100}+\frac{30}{100}=0.61.$

Furthermore, using Bayes theorem, we have

$\displaystyle
P(A|solved)=\frac{P(A)P(solved|A)}{P(solved)}=\frac{30\%\cdot\frac{9}{10}}{0.61}=0.442.$

##  Chapter 3 Probability distribution

Till now, we have seen in section (2.2) that in principle of probabilistic
modelling of a random experiment in terms of outcomes and event and carried
out through the following three basic concepts:

  1. a.

Sample space $\to$ as a collection of all possible outcomes of a random
experiment.

  2. b.

Event $to$ as a subset of the sample (i.e. a collection of some possible
outcomes) defined by an statement.

  3. c.

Probability measure $\to$ as a map $P:\Sigma\to[0,1]$ such that a.
$P(\Phi)=0,P(\Omega)=1$, b. $0\leq P(A)\leq 1$ for any event $A\in\Sigma$, c.
$P(A\cup B)=P(A)+P(B)$ provided A and B are mutually disjoint (i.e. $A\cap
B=\Phi$). In summary, compute the probability of an event by breaking it into
disjoint pieces whose probabilities are summed.

But in practice, everything we measure in real life is random in the sense
(i.e. if we perform the experiment again we will not get the same measured
value). So, every measurement is a random variable
($X:\Omega\to\Omega_{X}\subset\mathbb{R},X^{-1}(B)\in\Sigma_{\Omega}$ for
every $B\in\mathcal{B}$) that provides a concrete/computational representation
$\Omega_{X}$ of the sample space $\Omega$ in a numeric/quantified platform.

We have already observed that an interesting and generic mathematical
principle: to study, analyse and understand a space (with some structure) is
extremely advantageous via study of functions from the space to a target space
such that functions respect the structure of the space. For example:

  1. 1.

An $m\times n$ matrix as a linear transformation from $\mathbb{R}^{n}$ to
$\mathbb{R}^{m}$.

  2. 2.

A linear representation of a group to a general linear group of matrices.

  3. 3.

A rational function from a variety to an algebraic variety.

  4. 4.

A random variable
$X:\Omega\to\Omega_{X}\subset\mathbb{R},X^{-1}(B)\in\Sigma_{\Omega}$ for every
$B\in\mathcal{B}$.

This observation makes random variable much important for the computation of
randomness in a real word situation.

###  3.1 Random variable

In Bernoulli trials, we are interested only in number of successes rather than
successes or failure. In practice, everything in applied/computational
probability is about random variables and their probability distributions.

######  Definition 3.1.1 (Informal).

A random variable translates an outcome of nature in a given random experiment
to some random number ( i.e. a number with a probability of occurrence). For
example, distance is a function of a pair of points, the perimeter of a
triangle is a function of triangles. In summary, a random variable translates
non-numerical sample space $\Omega$ of a random experiment to numerical sample
space $\Omega_{X}$.

######  Definition 3.1.2 (Formal).

A random variable $X$ is a $(\mathbb{R},\mathcal{B})-$ valued map
$X:\Omega\to\mathbb{R}_{+}$ such that $X^{-1}(B)=\\{\omega|X(\omega)\in
B\\}\subset\Sigma$ for every $B\in\mathcal{B}$ (i.e. $X^{-1}(B)$ is a
measurable set w.r.t probability measure P), where $\Omega$ is a sample space
of a given random experiment and $\mathbb{R}$ endures a Borel $\sigma-$
algebra $\mathcal{B}$ on it generated by open intervals. Alternatively, a
random variable is a measurable function
$X:(\Omega,\Sigma,P)\to(\mathbb{R},\mathcal{B})$.

######  Definition 3.1.3 (Probability distribution).

Probability distribution of a random variable (3.1.2) $X$ is defined as a
probability measure $p_{X}=P\circ
X^{-1}:\left(\mathbb{R},\mathcal{B}\right)\to[0,1]$ such that

$\displaystyle P\circ X^{-1}(A)=P(X^{-1}(A))=P(X\in
A)=P\left(\left\\{\omega|X(\omega)\in A\right\\}\right).$

It describes the likelihood of occurrence of the possible value of a random
variable.

Figure 3.1: A self-explanatory meaning of probability distribution in Hindi
with corresponding translation in English.

######  Remark 3.1.4.

Once we get to more complicated examples, it can quickly become impractical to
specify explicitly. Although the concept of a probability space
$(\Omega,\Sigma,P)$ underlies everything, in practice it will be rare that we
think about itself, instead we will talk directly about events and their
probabilities, and random variables and their distributions (and we can do
that without assuming any particular structure for $\Omega$).

###  3.2 Discrete distribution

######  Definition 3.2.1 (Discrete random variable).

A measurable function
$X:\Omega=\\{\omega_{1},\omega_{2},\ldots,\\}\to\Omega_{X}=\\{x_{1},x_{2},\ldots\\}\subset\mathbb{R}$
with
$X^{-1}(B)\in\Sigma_{\Omega}=\\{X(\omega_{1}),X(\omega_{2}),\ldots,X(\omega_{n})\\}\
\forall\ B\in\mathcal{B}$ such that

  1. a.

$X^{-1}(x)=\\{\omega|X(\omega)=x\\}\in\Sigma_{\Omega}$,

  2. b.

$\Omega_{X}=\\{x_{k}\\}_{k\in\mathbb{N}}$ i.e. $\Omega_{X}$ is at most
countable.

  3. a’.

$\Omega_{X}=\\{x_{k}\\}_{k\in\mathbb{N}}\implies B=\\{x\\}\implies
X^{-1}(B)=X^{-1}(x)=\\{\omega|X(\omega)=x\\}\equiv\\{X=x\\}$.

is called a discrete random variable and its probability distribution is known
as probability mass function. An event of a discrete random variable $X$ is
described as below:

$\displaystyle X\in B=\\{x\\}\equiv\\{X=x\\}\equiv\\{\omega|X(\omega)=x\\}.$

Here, $\\{X=x\\}\to$ the event that the random variable $X$ takes the given
value x.

Figure 3.2: Discrete random variable as a mapping of at most countably sample
space into a sequence of real numbers.

######  Definition 3.2.2 (Probability mass function).

Probability distribution of a discrete random variable (DRV) $X$ is known as a
probability mass function (PMF) of the DRV and defined as follows:

$\displaystyle p_{X}(x)=P(X=x)=P(\\{\omega|X(\omega)=x\\}).$

The PMF $p_{X}$ satisfies the following properties:

  1. a.

$p_{X}(x)\in[0,1]$,

  2. b.

$\sum_{x}P_{X}(x)=1$,

  3. c.

$P(X\in B)=\sum_{x\in B}p_{X}(x)$.

####  3.2.1 Various discrete distribution

######  Example 3.2.3 (Bernoulli distribution).

A random variable $X$ (with an event $\\{X=x\\}\equiv\\{\omega=H\ \mbox{or}\
T|X(\omega)=x\\}$) has a Bernoulli distribution with a parameter $p\in[0,1]$
if

$\displaystyle p_{X}(x)=P(X=x)=\left\\{\begin{array}[]{cc}1-p&\ \mbox{if}\
x=0\\\ p&\ \mbox{if}\ x=1\end{array}\right.=p^{x}(1-p)^{1-x}\ \mbox{for}\
x\in\\{0,1\\}.$

So, $X$ is a Bernoulli random variable and we write $X\sim Ber(p)$ (see in
(3.3)). e.g. a. $X=I_{A}\to$ an indicator function for an event $A$, b.
$X\to\\#$ successes in a Bernoulli trial.

The Bernoulli distribution is used to model, for example, the outcome of a
Bernoulli trial with $1$ representing successes and $0$ representing failure.
It is also a basic building block for other classical discrete distributions.

In the experiment of a single fair coin toss with a probability of getting
head is $p$, if we are interested only in whether the outcome is head or tail,
then we define a Bernoulli random variable as follows:

$\displaystyle X(\omega)=\left\\{\begin{array}[]{cc}0&\ \mbox{if}\ \omega=T\\\
1&\ \mbox{if}\ \omega=H.\end{array}\right.$

With the following Bernoulli distribution as a PMF of the $X$:

$\displaystyle p_{X}(0)$
$\displaystyle=p(X=0)=\sum_{X^{-1}(0)\in\Sigma}P(\\{\omega|X(\omega)=0\\})=P(T)=1-p,$
$\displaystyle p_{X}(1)$
$\displaystyle=p(X=1)=\sum_{X^{-1}(1)\in\Sigma}P(\\{\omega|X(\omega)=1\\})=P(H)=p.$

Figure 3.3: Bernoulli probability mass function for $p=0.25$.

In the experiment of a single fair die toss if we are interested only in
whether the outcome is even or odd, then we define a Bernoulli random variable
as follows:

$\displaystyle X(\omega)=\left\\{\begin{array}[]{cc}0&\ \mbox{if}\
\omega=1,3,5\\\ 1&\ \mbox{if}\ \omega=2,4,6.\end{array}\right.$

With the following Bernoulli distribution as a PMF of the $X$:

$\displaystyle p_{X}(0)$
$\displaystyle=p(X=0)=\sum_{X^{-1}(0)\in\Sigma}P(\\{\omega|X(\omega)=0\\})=3/6=1/2,$
$\displaystyle p_{X}(1)$
$\displaystyle=p(X=1)=\sum_{X^{-1}(1)\in\Sigma}P(\\{\omega|X(\omega)=1\\})=3/6=1/2.$

Here, we can draw a remark that once the PMF has been specified all subsequent
probability calculations can be based on it, without referring back to the
original sample space S. Specifically, for an event A defined on Sx the
probability is given by

$\displaystyle P(X\in A)=\sum_{i:x_{i}\in A}p_{X}(x_{i}).$

Consider a die whose sides have been labelled with two sides having 1 dot, two
sides having 2 dots, and two sides having 3 dots. Hence,
$\Omega=\\{\omega_{1}=1,\omega_{2}=1,\omega_{3}=2,\omega_{4}=2,\omega_{5}=3,\omega_{6}=3\\}$.
Then if we are interested in the probabilities of the outcomes displaying
either 1, 2, or 3 dots, we would define a random variable as

######  Example 3.2.4 (Binomial distribution).

A random variable $X$ (with an event
$\\{X=x\\}\equiv\\{\omega\in\\{H,T\\}^{n}|X(\omega)=x=\\#H\\}$) has a Binomial
distribution with a parameter $p\in[0,1]$ and $n\in\mathbb{N}$ if

$\displaystyle p_{X}(x)=P(X=x)=\binom{n}{x}p^{x}(1-p)^{n-x}\ \mbox{for}\
x\in\\{0,1,2,\ldots,n\\}.$

So, $X$ is a Binomial random variable and we write $X\sim Bin(n,p)$ (see in
(3.4)). e.g. $X\to\\#$ successes in n Bernoulli trials with $p$ as a
probability of a success. Probability of a particular sequence of n Bernoulli
trials with x successes is $p^{x}(1-p)^{n-x}$ and there are exactly
$\left(\begin{array}[]{cc}n\\\ x\end{array}\right)$ such sequences.

Figure 3.4: Binomial probability mass function with its cumulative
distribution for $n=15,p=0.25$.

The location of the maximum of the PMF can be shown to be given by
$\arg\max_{x}\left(\left(\begin{array}[]{cc}n\\\
x\end{array}\right)p^{x}(1-p)^{n-x}\right)=[(n+1)p]$ (see (Feller, 1968)),
where $[x]$ denotes the largest integer less than or equal to x.

######  Example 3.2.5 (Geometric distribution).

A random variable $X$ (with an event
$\\{X=x\\}\equiv\\{\omega\in\\{H,T\\}^{\infty}|X(\omega)=x=\\#\
\mbox{Bernoulli trials till first}\ H\\}$) has a Geometric distribution with a
parameter $p\in[0,1]$ if

$\displaystyle p_{X}(x)=P(X=x)=p(1-p)^{x-1}\ \mbox{for}\ x=1,2,\ldots.$

So, $X$ is a geometric random variable and we write $X\sim Geo(p)$ (see in
(3.5)). e.g. $X\to\\#$ Bernoulli trials till first success.

Figure 3.5: Geometric probability mass function for $p=0.25$.

######  Example 3.2.6 (Poisson distribution).

A random variable $X$ has a Poisson distribution with a parameter
$\lambda=np$, where n is possibly large and p is possibly very small, if

$\displaystyle p_{X}(x)=P(X=x)$
$\displaystyle=\lim_{n\to\infty}\left(\left(\begin{array}[]{cc}n\\\
x\end{array}\right)p^{x}(1-p)^{n-x}\right)$
$\displaystyle=\frac{\lambda^{x}e^{-\lambda}}{x!}\ \mbox{for}\
x=0,1,2,\ldots.$

So, $X$ is a Poisson random variable and we write $X\sim Pois(\lambda)$ (see
in (3.6)). e.g. $X\to\\#$ successes in Bernoulli trials per unit interval (or
within a given interval of time or space).

Figure 3.6: The Poisson probability mass function with its cumulative
distribution for $\lambda=75$.

######  Remark 3.2.7 (Poisson approximation of binomial distribution).

If in a binomial PMF, we let $n\to\infty$ as $p\to 0$ such that the product
$\lambda=np$ remains constant, then $Bin(n,p)\to Pois(\lambda)$. Note that
$\lambda=np$ represents the expected or average number of successes in n
Bernoulli trials, hence, by keeping the average number of successes fixed but
assuming more and more trials with smaller and smaller probabilities of
success on each trial, we are led to a Poisson PMF (see in (3.7)).

Figure 3.7: The Poisson approximation to the binomial probability mass
function.

######  Example 3.2.8 (Hyper-geometric distribution (Feller, 1968)).

In a population of n elements $n_{1}$ are red and $n_{2}$ are black. A group
of r elements is chosen at random. We seek the probability $p_{X}(k)$ that the
group so chosen will contain exactly k red elements. Here k can be any integer
between zero and $n_{1}$ or r, whichever is smaller. We note that the chosen
group contains k red and $r-k$ black elements. The red ones can be chosen in
$\binom{n_{1}}{k}$ different ways and the black ones in $\binom{n-n_{1}}{r-k}$
ways. Since any choice of k red elements may be combined with any choice of
black ones, so we have

$\displaystyle
p_{X}(k)=P(X=k;n,n_{1},r)=\frac{\left(\begin{array}[]{cc}n_{1}\\\
k\end{array}\right)\left(\begin{array}[]{cc}n-n_{1}\\\
r-k\end{array}\right)}{\left(\begin{array}[]{cc}n\\\ r\end{array}\right)}$

The hyper-geometric distribution can easily be generalized to the case where
the original population of size n contains several classes of elements. For
example, let the population contain three classes of sizes $n_{1},n_{2},$ and
$n-n_{1}-n_{2}$ respectively. If a sample of size r is taken, the probability
that it contains $k_{1}$ elements of the first, $k_{2}$ elements of the
second, and $r-k_{1}-k_{2}$ elements of the last class is given by

$\displaystyle
p_{X}(k)=P(X=k;n,n_{1},n_{2},r)=\frac{\left(\begin{array}[]{cc}n_{1}\\\
k_{1}\end{array}\right)\left(\begin{array}[]{cc}n_{2}\\\
k_{2}\end{array}\right)\left(\begin{array}[]{cc}n-n_{1}-n_{2}\\\
r-k_{1}-k_{2}\end{array}\right)}{\left(\begin{array}[]{cc}n\\\
r\end{array}\right)}$

In Bridge game: the population of 52 cards consists of four classes, each of
thirteen elements. The probability that a hand of thirteen cards consists of
five spades, four hearts, three diamonds, and one club is

$\displaystyle
p_{X}(k)=P(X=(5,4,3,1);52,13,13)=\frac{\left(\begin{array}[]{cc}13\\\
5\end{array}\right)\left(\begin{array}[]{cc}13\\\
4\end{array}\right)\left(\begin{array}[]{cc}13\\\
3\end{array}\right)\left(\begin{array}[]{cc}13\\\
1\end{array}\right)}{\left(\begin{array}[]{cc}52\\\ 13\end{array}\right)}$

######  Example 3.2.9 (Pascal or negative binomial distribution (Feller,
1968)).

In a sequence of independent Bernoulli trials, let the random variable $X$ be
the trial at which the $rth$ success occurs, where r is a fixed integer. Then
X has a Pascal distribution as follows:

$\displaystyle p_{X}(x)=\binom{x}{r-1}p(1-p)^{x-r}.$

Consider a random variable $Y\to$ number of failures before $rth$ success.
This formulation is statistically equivalent to the above $X\to$ trial at
which the $rth$ success occurs, since $Y=X-r$. And the alternative form of the
Pascal distribution is

$\displaystyle p_{Y}(y)=P(Y=y)$ $\displaystyle=\binom{r+y-1}{y}p^{r}(1-p)^{y}$
$\displaystyle=\binom{-r}{y}p^{r}(p-1)^{y}.$

As we know negative binomial expansion follows:

$\displaystyle(1+t)^{-r}=\sum_{k}\binom{-r}{k}t^{k}=\sum_{k}(-1)^{k}\binom{r+k-1}{k}t^{k}.$

The problem of Banach’s match boxes (Feller, 1968). A certain mathematician
always carries one match box in his right pocket and one in his left. When he
wants a match, he selects a pocket at random, the successive choices thus
constituting Bernoulli trials with $p=1/2$. Suppose that initially each box
contained exactly N matches and consider the moment when, for the first time,
our mathematician discovers that a box is empty. At that moment the other box
may contain $0,1,2,\ldots,N$ matches, and we denote the corresponding
probabilities by $u_{r}$. Let us identify success with choice of the left
pocket. The left pocket will be found empty at a moment when the right pocket
contains exactly r matches if, and only if, exactly $N-r$ failures precede the
$(N+1)$st success. Therefore the required probability is

$\displaystyle
u_{r}=\binom{2N-r}{N}\left(\frac{1}{2}\right)^{N}\left(\frac{1}{2}\right)^{N-r}.$

Generalization of table tennis [Feller]. Suppose that Peter and Paul play a
game which may be treated as a sequence of Bernoulli trials in which the
probabilities p and q serve as measures for the players’ skill. In ordinary
table tennis the player who first accumulates 21 individual victories wins the
whole game. For comparison with the preceding example we consider the general
situation where $2\nu+1$ individual successes are required. The game lasts at
least $2\nu+1$ and at most $4\nu+1$ trials. Denote by $a_{r}$ the probability
that Peter wins at the trial number $4\nu+1-r$. This event occurs if, and only
if, in the first $4\nu-r$ trials Peter has scored $2\nu$ successes and
thereafter wins the $(2\nu+1)$st trial. So, the required probability is

$\displaystyle a_{r}=\binom{4\nu-r}{2\nu}p^{2\nu+1}q^{2\nu-r}.$

######  Example 3.2.10 (Multinomial distribution).

The binomial distribution can easily be generalized to the case of n repeated
independent trials where each trial can have one of several outcomes. Denote
the possible outcomes of each trial by $E_{1},E_{2},\ldots,E_{r}$, and suppose
that the probability of the realization of $E_{i}$ in each trial is $p_{i}$
subject to the condition

$\displaystyle p_{1}+p_{2}+\ldots+p_{r}=1.$

The result of n trials is a succession like $E_{3}E_{1}E_{2}\ldots$. The
probability that in n trials $E_{1}$ occurs $k_{1}$ times, $E_{2}$ occurs
$k_{2}$ times, etc., is

$\displaystyle
p_{X}(k)=P(X=k=(k_{1},k_{2},\ldots,k_{r}))=\frac{n!}{k_{1}!k_{2}!\ldots
k_{r}!}p_{1}^{k_{1}}p_{2}^{k_{2}}\ldots p_{r}^{k_{r}},$

where, $k_{1}+k_{2}+\ldots+k_{r}=n$. If $r=2$, then the above multinomial
distribution reduces to the binomial distribution with
$p_{1}=p,p_{2}=1-p,k_{1}=k,k_{2}=n-k$.

For example: in rolling twelve dice, find the probability of getting each face
twice. Here $E_{1},E_{2},\ldots,E_{6}$ represent the six faces, all $k_{i}$
equal 2, and all $p_{i}$ equal $1/6$. Therefore, the probability is
$\frac{12!}{2^{6}}(1/6)^{12}=0.0034$.

######  Example 3.2.11 (Uniform discrete distribution).

A random variable $X\in\\{a,a+1,\ldots,b\\}$ has a uniform discrete
distribution if

$\displaystyle p_{X}(x)=\left\\{\begin{array}[]{cc}\frac{1}{b-a+1}&\
\mbox{if}\ x\in\\{a,a+1,\ldots,b\\},\\\ 0&\ \mbox{if}\
x\notin\\{a,a+1,\ldots,b\\}.\end{array}\right.$

####  3.2.2 Derived distribution of a discrete random variable

Consider a die whose faces are labelled with the numbers $0,0,1,1,2,2$. We
wish to find the PMF of the number observed when the die is tossed, assuming
all sides are equally likely to occur. If the original sample space is
composed of the possible cube sides that can occur, so that
$\Omega_{X}=\\{1,2,3,4,5,6\\}$, then the transformation appears as follows:

$\displaystyle Y=y=\left\\{\begin{array}[]{ccc}0&\ \mbox{if}\ x=1\ \mbox{or}\
2\\\ 1&\ \mbox{if}\ x=3\ \mbox{or}\ 4\\\ 2&\ \mbox{if}\ x=5\ \mbox{or}\
6.\end{array}\right.$

So, PMF of Y is given by

$\displaystyle p_{Y}(y)=\left\\{\begin{array}[]{ccc}p_{X}(1)+p_{X}(2)=1/3\
\mbox{if}\ y=0,\\\ p_{X}(3)+p_{X}(4)=1/3\ \mbox{if}\ y=1,\\\
p_{X}(5)+p_{X}(6)=1/3\ \mbox{if}\ y=2.\\\ \end{array}\right.$

Figure 3.8: Transformation or function of a discrete random variable.

If $Y=g(X)$ is a transformed or derived random variable of a given DRV $X$,
then the derived distribution $p_{Y}(y)$ is given by

$\displaystyle
p_{Y}(y)=P(Y=y)=P(g(X)=y)=P(X=g^{-1}(y))=\sum_{\\{x:g(x)=y\\}}p_{X}(x),$

where $g^{-1}(y)$ is an inverse image of the observed value $Y=y$ in
$\Omega_{X}$.

So, computation of derived distribution $p_{Y}(y)$of a discrete random
variable $X$ follows two steps:

  1. 1.

Determining all possible observed value of the derived random variable $Y$
i.e. $\Omega_{Y}$,

  2. 2.

Computing the derived distribution as follows:

$\displaystyle p_{Y}(y)=\sum_{\\{x:g(x)=y\\}}p_{X}(x).$

######  Example 3.2.12.

If $X\sim Ber(p)$ and $Y=2X-1$, then derived distribution $p_{Y}(y)$ can be
computed as follows:

  1. 1.

As $X\sim Ber(p)$ and $Y=2X-1$, so $\Omega_{X}=\\{0,1\\}$ transformed to
$\Omega_{Y}=\\{-1,1\\}$.

  2. 2.

Now, we have

$\displaystyle p_{Y}(-1)$ $\displaystyle=P(Y=-1)=P(2X-1=-1)=P(2X=0)$
$\displaystyle=P(X=0)=1-p,$ $\displaystyle p_{Y}(1)$
$\displaystyle=P(Y=1)=P(2X-1=1)=P(2X=2)$ $\displaystyle=P(X=1)=p.$

######  Example 3.2.13.

If $X\sim Unif([-4,4]\cap\mathbb{Z})$ and $Y=|X|$, then derived distribution
$p_{Y}(y)$ can be computed as follows:

  1. 1.

As $X\sim Unif([-4,4]\cap\mathbb{Z})$ and $Y=|X|$, so
$\Omega_{X}=\\{-4,-3,-2,-1,0,1,2,3,4\\}$ transformed to
$\Omega_{Y}=\\{0,1,2,3,4\\}$.

  2. 2.

Now, we have

$\displaystyle p_{Y}(0)$ $\displaystyle=P(Y=0)=P(|X|=0)=P(X=0)=1/9,$
$\displaystyle p_{Y}(1)$
$\displaystyle=P(Y=1)=P(|X|=1)=P(X\in\\{-1,1\\})=2/9,$ $\displaystyle
p_{Y}(2)$ $\displaystyle=P(Y=2)=P(|X|=2)=P(X\in\\{-2,2\\})=2/9$ $\displaystyle
p_{Y}(3)$ $\displaystyle=P(Y=3)=P(|X|=3)=P(X\in\\{-3,3\\})=2/9$ $\displaystyle
p_{Y}(4)$ $\displaystyle=P(Y=4)=P(|X|=4)=P(X\in\\{-4,4\\})=2/9.$

Figure 3.9: Transformation of $X\sim Unif([-4,4]\cap\mathbb{Z})$ to $Y=|X|$.

######  Example 3.2.14.

Let $Y=|X|$ and $X\sim Unif([-3,5]\cap\mathbb{Z})$ is a uniform random
variable, then find PMF $p_{Y}$ and expectation $E(Y)$ of Y.

Solution: if $X\sim Unif([-4,4]\cap\mathbb{Z})$ and $Y=|X|$, then derived
distribution $p_{Y}(y)$ can be computed as follows:

  1. 1.

As $X\sim Unif([-3,5]\cap\mathbb{Z})$ and $Y=|X|$, so
$\Omega_{X}=\\{-3,-2,-1,0,1,2,3,4,5\\}$ transformed to
$\Omega_{Y}=\\{0,1,2,3,4,5\\}$.

  2. 2.

Now, we have

$\displaystyle p_{Y}(0)$ $\displaystyle=P(Y=0)=P(|X|=0)=P(X=0)=1/9,$
$\displaystyle p_{Y}(1)$
$\displaystyle=P(Y=1)=P(|X|=1)=P(X\in\\{-1,1\\})=2/9,$ $\displaystyle
p_{Y}(2)$ $\displaystyle=P(Y=2)=P(|X|=2)=P(X\in\\{-2,2\\})=2/9$ $\displaystyle
p_{Y}(3)$ $\displaystyle=P(Y=3)=P(|X|=3)=P(X\in\\{-3,3\\})=2/9$ $\displaystyle
p_{Y}(4)$ $\displaystyle=P(Y=4)=P(|X|=4)=P(X\in\\{4\\})=1/9$ $\displaystyle
p_{Y}(5)$ $\displaystyle=P(Y=5)=P(|X|=5)=P(X\in\\{5\\})=1/9.$

Figure 3.10: Transformation of $X\sim Unif([-3,5]\cap\mathbb{Z})$ to $Y=|X|$.

######  Example 3.2.15.

If $X\sim Unif([-2,2]\cap\mathbb{Z})$ and $Y=X^{2}$, then derived distribution
$p_{Y}(y)$ can be computed as follows:

  1. 1.

As $X\sim Unif([-2,2]\cap\mathbb{Z})$ and $Y=X^{2}$, so
$\Omega_{X}=\\{-2,-1,0,1,2\\}$ transformed to $\Omega_{Y}=\\{0,1,4\\}$.

  2. 2.

Now, we have

$\displaystyle p_{Y}(0)$ $\displaystyle=P(Y=0)=P(X^{2}=0)=P(X=0)=1/5,$
$\displaystyle p_{Y}(1)$
$\displaystyle=P(Y=1)=P(X^{2}=1)=P(X\in\\{-1,1\\})=2/5,$ $\displaystyle
p_{Y}(4)$ $\displaystyle=P(Y=4)=P(X^{2}=4)=P(X\in\\{-2,2\\})=2/5.$

######  Example 3.2.16.

If $X\sim Pois(\lambda))$ and $Y=g(X)=\left\\{\begin{array}[]{cc}1&\
\mbox{if}\ x\mbox{is even}\\\ -1&\ \mbox{if}\ x\mbox{is
odd}\end{array}\right.$, then derived distribution $p_{Y}(y)$ can be computed
as follows:

  1. 1.

As $X\sim Pois(\lambda))$ and $Y=g(X)$, so $\Omega_{X}=\\{0,1,2,\ldots\\}$
transformed to $\Omega_{Y}=\\{-1,1\\}$.

  2. 2.

Now, we have

$\displaystyle p_{Y}(1)$ $\displaystyle=P(Y=1)=P(X\ \mbox{is
even})=\sum_{\\{x\ \mbox{is even}\\}}\frac{\lambda^{x}}{x!}e^{-\lambda}$
$\displaystyle=\frac{1}{2}\left(1+e^{2\lambda}\right),$ $\displaystyle
p_{Y}(-1)$ $\displaystyle=P(Y=-1)=P(X\ \mbox{is odd})=\sum_{\\{x\ \mbox{is
odd}\\}}\frac{\lambda^{x}}{x!}e^{-\lambda}$
$\displaystyle=\frac{1}{2}\left(1-e^{-2\lambda}\right).$

####  3.2.3 Jointly discrete distribution

In science and in real life, we are often interested in two (or more) random
variables at the same time in a random experiment. In such situations the
random variables have a joint distribution that allows us to compute
probabilities of events involving both variables and understand the
relationship between the variables. This is simplest when the variables are
independent. When they are not, we use covariance and correlation as measures
of the nature of the dependence between them.

######  Definition 3.2.17 (Joint probability mass function).

Suppose X and Y are two discrete random variables and that X takes values
$\\{x_{1},x_{2},\ldots,x_{m}\\}$ and Y takes values
$\\{y_{1},y_{2},\ldots,y_{n}\\}$. Then, the ordered pair $(X,Y)$ take values
in the product $\\{(x_{1},y_{1}),(x_{1},y_{2}),\ldots(x_{m},y_{n})\\}$. So,
the joint probability mass function (joint pmf) of X and Y can be defined as
the function $p_{(X,Y)}(x_{i},y_{j})=P(X=x_{i},Y=y_{j})$ as the joint
probability of the joint outcome $(X=x_{i},Y=y_{j})$ and satisfies the
following:

  1. 1.

$p_{(X,Y)}(x,y)\in[0,1]$ for any $(x,y)\in\Omega_{X}\times\Omega_{Y}$,

  2. 2.

$\sum_{\\{(x,y)\in\Omega_{X}\times\Omega_{Y}\\}}p_{(X,Y)}(x,y)=1$,

  3. 3.

$P((X,Y)\in B)=\sum_{\\{(x,y)\in B\\}}p_{(X,Y)}(x,y)$.

More, explicitly, we can visualize the joint probability mass function for
each joint point $\\{(x_{i},y_{j})|1\leq i\leq m,1\leq j\leq n\\}$ in the
table (3.1):

Table 3.1: Joint probability table for joint probability mass function
$p_{(X,Y)}$ of $X\in\Omega_{X}=\\{x_{1},x_{2},\ldots,x_{n}\\}$ and
$Y\in\Omega_{Y}=\\{y_{1},y_{2},\ldots,y_{m}\\}$.

$X\backslash Y$ | $y_{1}$ | $y_{2}$ | $\ldots$ | $y_{j}$ | $\ldots$ | $y_{n}$
---|---|---|---|---|---|---
$x_{1}$ | $P_{X,Y}(x_{1},y_{1})$ | $P_{X,Y}(x_{1},y_{2})$ | $\ldots$ | $P_{X,Y}(x_{1},y_{j})$ | $\ldots$ | $P_{X,Y}(x_{1},y_{n})$
$x_{2}$ | $P_{X,Y}(x_{2},y_{1})$ | $P_{X,Y}(x_{2},y_{2})$ | $\ldots$ | $P_{X,Y}(x_{2},y_{j})$ | $\ldots$ | $P_{X,Y}(x_{2},y_{n})$
$\vdots$ | $\vdots$ | $\vdots$ | $\ldots$ | $\vdots$ | $\ldots$ | $\vdots$
$x_{i}$ | $P_{X,Y}(x_{i},y_{1})$ | $P_{X,Y}(x_{i},y_{2})$ | $\ldots$ | $P_{X,Y}(x_{i},y_{j})$ | $\ldots$ | $P_{X,Y}(x_{i},y_{n})$
$\vdots$ | $\vdots$ | $\vdots$ | $\ldots$ | $\vdots$ | $\ldots$ | $\vdots$
$x_{m}$ | $P_{X,Y}(x_{m},y_{1})$ | $P_{X,Y}(x_{m},y_{2})$ | $\ldots$ | $P_{X,Y}(x_{m},y_{j})$ | $\ldots$ | $P_{X,Y}(x_{m},y_{n})$

######  Example 3.2.18.

Question: consider a roll two dice in together. Let X be the value on the
first die and let Y be the value on the second die. Then both X and Y take
values 1 to 6 and the joint pmf is $p(i,j)=1/36$ for all i and j between 1 and
6. Draw the probability table for the joint PMF for each observation of the
jointly discrete random variable $(X,Y)$. Further, consider an event
$B=Y-X\geq 2$, then compute its probability.

Answer: It is given that X be the value on the first die and let Y be the
value on the second die. So, both X and Y take values 1 to 6 with joint pmf is
$p(i,j)=1/36$ for all i and j between 1 and 6. Then, the probability table of
the joint PMF is given in the table (3.2):

Table 3.2: Joint probability table for joint probability mass function
$p_{(X,Y)}$ of $X\in\Omega_{X}=\\{1,2,\ldots,6\\}$ and
$Y\in\Omega_{Y}=\\{1,2,\ldots,6\\}$.

$X\backslash Y$ | 1 | 2 | 3 | 4 | 5 | 6
---|---|---|---|---|---|---
1 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
2 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
3 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
4 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
5 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
6 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$

Further, we have

$\displaystyle B$ $\displaystyle=Y-X\geq 2$
$\displaystyle=\\{(1,3),(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(3,5),(3,6),(4,6)\\}.$

So, the desired probability of the event B is given by

$\displaystyle P(B)=P((X,Y)|Y-X\geq 2)=10\cdot\frac{1}{36}=\frac{5}{18}.$

######  Example 3.2.19.

Question: consider a roll two dice in together. Let X be the value on the
first die and let T be the total on both dice. Then X takes values 1 to 6, Y
takes values 2 to 12 and the joint pmf is $p_{X,T}(i,t)=p_{X,Y}(i,t-i)$ for
all $i\in\\{1,2,3,4,5,6\\}$ and $t\in\\{2,3,4,5,6,7,8,9,10,11,12\\}$. Draw a
probability table for each possible observation of the jointly discrete random
variable $(X,T)$.

Answer: It is given that X be the value on the first die and let T be the
total on both dice. Then X takes values 1 to 6, Y takes values 2 to 12 and the
joint pmf is $p_{X,T}(i,t)=p_{X,Y}(i,t-i)$ for all $i\in\\{1,2,3,4,5,6\\}$ and
$t\in\\{2,3,4,5,6,7,8,9,10,11,12\\}$. Then, the probability table of the joint
PMF is given in the table (3.3):

Table 3.3: Joint probability table for joint probability mass function
$p_{(X,T)}$ of $X\in\Omega_{X}=\\{1,2,\ldots,6\\}$ and
$T\in\Omega_{T}=\\{2,3,\ldots,12\\}$.

$X\backslash T$ | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12
---|---|---|---|---|---|---|---|---|---|---|---
1 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0 | 0 | 0
2 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0 | 0
3 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0
4 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0
5 | 0 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0
6 | 0 | 0 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$

######  Definition 3.2.20 (Marginal PMFs).

Marginalization of joint probability mass function: when X and Y are jointly-
distributed random variables, we may want to consider only one of them, say X.
In that case we need to find the pmf of X without Y. This is called a marginal
pmf of X. For each observation/event $X=x$, the $p_{X}$ is computed by summing
probability of points on $x--$ strip i.e.

$\displaystyle p_{X}(x)=\sum_{y\in\Omega_{Y}}p_{X,Y}(x,y).\ \mbox{Similarly}\
p_{Y}(y)=\sum_{x\in\Omega_{X}}p_{X,Y}(x,y).$

Figure 3.11: Visualizing marginal PMFs $p_{X}(x)$ and $p_{Y}(y)$ respectively.

######  Example 3.2.21.

Question: consider a roll two dice in together. Let X be the value on the
first die and let T be the total on both dice. Then X takes values 1 to 6, Y
takes values 2 to 12 and the joint pmf is $p_{X,T}(i,t)=p_{X,Y}(i,t-i)$ for
all $i\in\\{1,2,3,4,5,6\\}$ and $t\in\\{2,3,4,5,6,7,8,9,10,11,12\\}$. In the
table each row represents a single value of X. So the event $X=3$ is the third
row of the table. To find $P(X=3)$ we simply have to sum up the probabilities
in this row. We put the sum in the right-hand margin of the table. Likewise
$P(T=5)$ is just the sum of the column with $T=5$. We put the sum in the
bottom margin of the table. Draw a probability table for each possible
observation of the jointly discrete random variable $(X,T)$ along with
marginal PMFs.

Answer: It is given that X be the value on the first die and let T be the
total on both dice. Then X takes values 1 to 6, Y takes values 2 to 12 and the
joint pmf is $p_{X,T}(i,t)=p_{X,Y}(i,t-i)$ for all $i\in\\{1,2,3,4,5,6\\}$ and
$t\in\\{2,3,4,5,6,7,8,9,10,11,12\\}$. Then, the probability table of the joint
PMF is given in the table (3.4):

Table 3.4: Joint probability table for joint probability mass function
$p_{(X,T)}$ of $X\in\Omega_{X}=\\{1,2,\ldots,6\\}$ and
$T\in\Omega_{T}=\\{2,3,\ldots,12\\}$ along with marginal PMFs $p_{X}(x)$ and
$p_{T}(t)$.

$X\backslash T$ | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | $p_{X}(x)$
---|---|---|---|---|---|---|---|---|---|---|---|---
1 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0 | 0 | 0 | $\frac{1}{6}$
2 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0 | 0 | $\frac{1}{6}$
3 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0 | $\frac{1}{6}$
4 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | $\frac{1}{6}$
5 | 0 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | $\frac{1}{6}$
6 | 0 | 0 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{6}$
$p_{T}(t)$ | $\frac{1}{36}$ | $\frac{2}{36}$ | $\frac{3}{36}$ | $\frac{4}{36}$ | $\frac{5}{36}$ | $\frac{6}{36}$ | $\frac{5}{36}$ | $\frac{4}{36}$ | $\frac{3}{36}$ | $\frac{2}{36}$ | $\frac{1}{36}$ | 1

As motivated by this example, marginal pmf’s are obtained from the joint pmf
by summing:

$\displaystyle p_{X}(x)=\sum_{\\{y\in\Omega_{Y}\\}}p_{(X,Y)}(x,y)\
p_{Y}(y)=\sum_{\\{x\in\Omega_{X}\\}}p_{(X,Y)}(x,y).$

The term marginal refers to the fact that the values are written in the
margins of the table.

######  Definition 3.2.22 (Conditional probability mass function of a DRV
conditioned on an event).

In a probabilistic model if a certain event A has already occurred, then we
define conditional PMF of the possible observations of a random variable X
conditioned on the event A as follows:

$\displaystyle
p_{X|A}(x|A)=P(X=x,A|A)=\frac{P(X=x,A}{P(A)}=\left\\{\begin{array}[]{cc}\frac{p_{X}(x)}{P(A)}&\
\mbox{if}\ x\in A,\\\ 0&\ \mbox{if}\ x\notin A.\end{array}\right.$

The conditional PMF is a legitimate discrete distribution and satisfies the
following:

  1. 1.

$p_{X|A}(x|A)\geq 0$ as $p_{X}(x)\geq 0$,

  2. 2.

We have the following normalization property:

$\displaystyle\sum_{\\{x\in A\\}}p_{X|A}(x|A)$
$\displaystyle=\frac{1}{P(A)}\sum_{\\{x\in
A\\}}p_{X}(x)=\frac{1}{P(A)}\sum_{\\{x\in A\\}}P(X=x,A)$
$\displaystyle=\frac{1}{P(A)}P(A)=1.$

Since for any discrete random variable $X$, we have

$\displaystyle a.\ A_{i}\cap A_{j}=X^{-1}(x_{i})\cap
X^{-1}(x_{j})=\\{\omega|X(\omega)=x_{i}\\}\cap\\{\omega|X(\omega)=x_{j}\\}$
$\displaystyle\quad\quad\quad\quad\quad=\varphi\ \mbox{for}\ i\neq j,$
$\displaystyle b.\
\cup_{\\{x_{k}\in\Omega_{X}\\}}A_{k}=\cup_{\\{x_{k}\in\Omega_{X}\\}}X^{-1}(x_{k})=\cup_{\\{x_{k}\in\Omega_{X}\\}}\\{\omega|X(\omega)=x_{k}\\}$
$\displaystyle\quad\quad\quad\quad\quad\quad\quad=\Omega,$ $\displaystyle c.\
A_{k}=X^{-1}(x_{k})=\\{\omega|X(\omega)=x_{k}\\}\neq\varphi\ \mbox{for any}\
x_{k}\in\Omega_{X}.$

Figure 3.12: Conditional probability mass function of $X$ conditioned on an
event $A$.

######  Example 3.2.23.

Consider an experiment of rolling a dice, A be the event that roll is an even
number. Let $X$ be the roll of a die, then conditional PMF of X conditioned A
is given by

$\displaystyle p_{X|A}(x|A)$
$\displaystyle=P(X=x|A)=\frac{P(X=x,A}{P(A)}=\left\\{\begin{array}[]{cc}\frac{p_{X}(x)}{P(A)}&\
\mbox{if}\ x\in A\\\ 0&|\mbox{if}\ x\notin A\end{array}\right.$
$\displaystyle=\left\\{\begin{array}[]{cc}1/3&\ \mbox{if}\ x\in
A=\\{2,4,6\\}\\\ 0&|\mbox{if}\ x\notin A.\end{array}\right.$

####  3.2.4 Conditional PMF

######  Definition 3.2.24 (Conditional probability mass function).

When an experiment is a compound one, in which the second part of the
experiment (described by a discrete random variable $Y$) depends upon the
outcome of the first part (described another discrete random variable $X$),
conditional probability mass function, conditioned on the event $Y=y$, is
coming into picture as follows:

$\displaystyle p_{X|Y}(x|y)$
$\displaystyle=P(X=x,Y=y|Y=y)=\frac{P(X=x,Y=y}{P(Y=y)}=\frac{p_{(X,Y)(x,y)}}{p_{Y}(y)}$
$\displaystyle=\frac{p_{X,Y}(x,y)}{\sum_{x}p_{X,Y}(x,y)}$ $\displaystyle\
\mbox{for a fixed observation}\ Y=y.$

######  Definition 3.2.25 (Conditional PMFs).

Conditioning of joint probability mass function: when X and Y are jointly-
distributed random variables, we may want to consider only one of them
conditioned on one observation the other, say $X|Y=y$. In that case we need to
find the pmf of X conditioned on $Y=y$. This is called a conditional pmf of X
given $Y=y$. For each observation/event $X=x$, the $p_{X|Y}$ is computed by a
normalized probability of a point on $x\to$ strip, where the normalization is
provided by the value of PMF $p_{Y}$ at $Y=y$ i.e.
$p_{Y}(y)=P(Y=y)=\sum_{x}p_{X,Y}(x,y)$ as a total probability of the event
$Y=y$ on $y-$ axis. So, we can have a concrete definition of the conditional
PMF as follows:

$\displaystyle p_{X|Y}(x|y)$
$\displaystyle=P(X=x|Y=y)=\frac{P(X=x,Y=y}{P(Y=y)}=\frac{p_{(X,Y)(x,y)}}{p_{Y}(y)}$
$\displaystyle=\frac{p_{X,Y}(x,y)}{\sum_{x}p_{X,Y}(x,y)}$ $\displaystyle\
\mbox{for a fixed observation}\ Y=y.$

Similarly,

$\displaystyle p_{Y|X}(y|x)$
$\displaystyle=P(Y=y|X=x)=\frac{P(X=x,Y=y}{P(X=x)}=\frac{p_{(X,Y)(x,y)}}{p_{X}(x)}$
$\displaystyle=\frac{p_{X,Y}(x,y)}{\sum_{y}p_{X,Y}(x,y)}$ $\displaystyle\
\mbox{for a fixed observation}\ X=x.$

Figure 3.13: Visualizing conditional PMFs $p_{Y|X}(y|x)$ and $p_{X|Y}(x|y)$
respectively.

So, by using the definition of conditional probability for events we have

$\displaystyle p_{(X,Y)}((x,y)$ $\displaystyle=P(X=x,Y=y)=P(Y=y)P(X=x|Y=y)$
$\displaystyle=p_{Y}(y)p_{X|Y}(x|y).$

It provides a computational framework to determine joint PMF of the joint
discrete random variable $(X,Y)$.

######  Example 3.2.26.

Two dice are tossed with all outcomes assumed to be equally likely. The number
of dots observed on each die are added together. Then compute the conditional
PMF of the sum if it is known that the sum is even.

Let Y be the sum and define $X=1$ if the sum is even and $X=0$ if the sum is
odd. Thus, we wish to determine $p_{Y|X}(y|0)$ and $p_{Y|X}(y|1)$ for all
$y\in\Omega_{Y}=\\{2,3,\ldots,12\\}$. Then

$\displaystyle
p_{Y|X}(y|1)=\frac{p_{(Y,X)}(y,1)}{p_{X}(1)}=\left\\{\begin{array}[]{ccc}2\cdot\frac{1}{36}&\
\mbox{if}\ y=2,12\\\ 2\cdot\frac{3}{36}&\ \mbox{if}\ y=4,10\\\
2\cdot\frac{5}{36}&\ \mbox{if}\
y=6,8\end{array}\right.=\left\\{\begin{array}[]{ccc}\frac{1}{18}&\ \mbox{if}\
y=2,12\\\ \frac{3}{18}&\ \mbox{if}\ y=4,10\\\ \frac{5}{18}&\ \mbox{if}\
y=6,8.\end{array}\right.$

And

$\displaystyle
p_{Y|X}(y|0)=\frac{p_{(Y,X)}(y,0)}{p_{X}(0)}=\left\\{\begin{array}[]{ccc}2\cdot\frac{2}{36}&\
\mbox{if}\ y=3,11\\\ 2\cdot\frac{4}{36}&\ \mbox{if}\ y=5,9\\\
2\cdot\frac{6}{36}&\ \mbox{if}\
y=7\end{array}\right.=\left\\{\begin{array}[]{ccc}\frac{2}{18}&\ \mbox{if}\
y=3,11\\\ \frac{4}{18}&\ \mbox{if}\ y=5,9\\\ \frac{6}{18}&\ \mbox{if}\
y=7.\end{array}\right.$

Figure 3.14: Conditional PMFs $p_{Y|X}(y|1)$ and $p_{Y|X}(y|0)$.

######  Theorem 3.2.27 (Bayes rule for probability mass function).

Definition of conditional probability mass function leads to computation of
posterior distribution as follows:

$\displaystyle
p_{X|Y}(x|y)=\frac{p_{X,Y}(x,y)}{p_{Y}(y)}=\frac{p_{X}(x)p_{Y|X}(y|x)}{\sum_{x}p_{X}(x)p_{Y|X}(y|x)}.$

where $p_{X}(x)\to$ prior distribution of $X$, $p_{Y|X}(y|x)=f(x)\to$ is the
data generating process as a likelihood of $Y=y$ conditioned on $X=x$ and
$p_{Y}(y)=\sum_{x}p_{X}(x)p_{Y|X}(y|x)\to$ probability of observing $Y=y$ or
evidence.

Figure 3.15: Bayes theorem for posterior PMF of Y conditioned on $X=x$ and of
X conditioned on $Y=y$ respectively.

######  Example 3.2.28 (Computation of joint PMF).

(3.2.28) Professor May often has her facts wrong, and answers each of her
students’ questions incorrectly with probability $1/4$, independently of other
questions. In each lecture May is asked 0, 1, or 2 questions with equal
probability $1/3$. Find the desired joint probability mass function.

Solution: Let X and Y be the number of questions May is asked and the number
of questions she answers wrong in a given lecture, respectively. Now need to
compute the joint PMF of X and Y as follows:

$\displaystyle p_{(X,Y)}((x,y)=p_{X}(x)p_{Y|X}(y|x).$

We have $(a.)\ Y|X=0\in\\{0\\}$ with PMF $p_{Y|X}(y|0)=1,\ (b.)\
Y|X=1\in\\{0,1\\}$ with PMF
$p_{Y|X}(y|0)=\left(\frac{1}{4}\right)^{y}\left(\frac{3}{4}\right)^{1-y}$, and
$(c.)\ Y|X=2\in\\{0,1,2\\}$ with PMF
$p_{Y|X}(y|0)=\left(\begin{array}[]{cc}2\\\
y\end{array}\right)\left(\frac{1}{4}\right)^{y}\left(\frac{3}{4}\right)^{2-y}$.
Then

$\displaystyle p_{(X,Y)}(0,0)$ $\displaystyle=p_{X}(0)p_{Y|X}(0|0)=1/3\cdot
1=1/3=16/48,$ $\displaystyle p_{(X,Y)}(0,1)$
$\displaystyle=p_{X}(0)p_{Y|X}(1|0)=1/3\times 0=0,$ $\displaystyle\vdots$
$\displaystyle=\vdots$ $\displaystyle p_{(X,Y)}(2,2)$
$\displaystyle=p_{X}(2)p_{Y|X}(2|2)=1/3\times 1/16=1/48.$

Figure 3.16: Computation of joint PMF of dependent discrete random variables
$X$ and $Y$, where $p_{(X,Y)}(x,y)=p_{X}(x)p_{Y|X}(y|x)$.

######  Example 3.2.29 (Computation of posterior PMF).

Question: suppose $X$ is the number of $1$s that appear in a binary string of
length $L$, each bit in the string is equal to zero or one with probability
$1/2$, and the bits are independent. Suppose that the length of the string is
also random and uniformly distributed between 1 and 10. We learn that the
binary string contains 4 ones. By using the given information, compute the
updated PMF for the length of the string L.

Answer: Given $L=\ell$, we know that X has the binomial distribution when
$x\leq\ell$ (the probability is zero otherwise):

$\displaystyle
p_{X|L}(x|\ell)=\left\\{\begin{array}[]{cc}\left(\begin{array}[]{cc}\ell\\\
x\end{array}\right)\left(\frac{1}{2}\right)^{x}\left(\frac{1}{2}\right)^{\ell-x}&\
\mbox{if}\ x\leq\ell,\\\ 0&\ \mbox{otherwise}.\end{array}\right.$

And

$\displaystyle p_{L}(\ell)=\left\\{\begin{array}[]{cc}\frac{1}{10}&\
\mbox{if}\ \ell=1,2,\ldots,10,\\\ 0&\ \mbox{otherwise}.\end{array}\right.$

Given $L=\ell$, we have the binary string contains 4 ones (i.e. $X=4$), so
likelihood of observing $X=4$ is given by

$\displaystyle p_{X|L}(4|\ell)=\left(\begin{array}[]{cc}\ell\\\
4\end{array}\right)\left(\frac{1}{2}\right)^{4}\left(\frac{1}{2}\right)^{\ell-4}=\left(\begin{array}[]{cc}\ell\\\
4\end{array}\right)\left(\frac{1}{2}\right)^{\ell}=f(\ell).$

And by suing the prior probability mass function of L, we get

$\displaystyle
p_{X}(4)=\sum_{L}p_{(X,L)}(x,\ell)=\sum_{L}p_{L}(\ell)p_{X|L}(4|\ell)=\sum_{\ell=1}^{10}\frac{1}{10}\left(\begin{array}[]{cc}\ell\\\
4\end{array}\right)\left(\frac{1}{2}\right)^{\ell}$

Then, the updated probability mass function as the posterior PMF of L is given
by

$\displaystyle
p_{L|X}(\ell|4)=\frac{p_{L}(\ell)p_{X|L}(4|\ell)}{p_{X}(4)}=\left\\{\begin{array}[]{cc}\frac{\frac{1}{10}\times\left(\begin{array}[]{cc}\ell\\\
4\end{array}\right)\left(\frac{1}{2}\right)^{\ell}}{p_{X}(4)}&\ \mbox{if}\
\ell=1,2,\ldots,10,\\\ 0&\ \mbox{otherwise}.\end{array}\right.$

######  Definition 3.2.30 (In-dependency or dependency of joint discrete
random variables).

Jointly-distributed discrete random variables X and Y are independent if
observation of one random variable before the other is going to affect their
probability mass functions or their joint PMF is the product of the marginal
PMF’s:

$\displaystyle p_{X|Y}(x|y)=p_{X}(x)\ \mbox{or}\
p_{X,Y}(x,y)=p_{X}(x)p_{Y}(y)\ \mbox{or}F_{X,Y}(x,y)=F_{X}(x)F_{y}(y),$

If $E(XY)\neq E(X)E(Y)$ or $Cov(X,Y)\neq 0$, then the jointly distributed
random variables $X$ and $Y$ are dependent.

######  Example 3.2.31.

Roll two dice. Let X be the value on the first die and let Y be the value on
the second die. Independent discrete variables means the probability in a cell
must be the product of the marginal probabilities of its row and column. In
the probability table below this is true: every marginal probability is $1/6$
and every cell contains $1/36$, i.e. the product of the marginals and $X,Y\sim
Unif(\\{1,2,3,4,5,6\\})$. Therefore X and Y are independent.

Question: We rolled two dice and let X be the value on the first die and T be
the total on both dice. First construct a probability table for joint
probability mass function and then establish whether X and Y are independent
or nor.

Answer: we rolled two dice and let X be the value on the first die and let Y
be the value on the second die. In the probability table (3.5), the
probability in a cell is the product of the marginal probabilities of its row
and column. Therefore X and Y are independent.

Table 3.5: Joint probability table for joint probability mass function
$p_{(X,Y)}$ of $X\in\Omega_{X}=\\{1,2,\ldots,6\\}$ and
$Y\in\Omega_{Y}=\\{1,2,\ldots,6\\}$ along with marginal PMFs $p_{X}(x)$ and
$p_{Y}(y)$.

$X\backslash Y$ | 1 | 2 | 3 | 4 | 5 | 6 | $p_{X}(x)$
---|---|---|---|---|---|---|---
1 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
2 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
3 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
4 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
5 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
6 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$
$p_{Y}(y)$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 1

######  Example 3.2.32.

Question: We rolled two dice and let X be the value on the first die and T be
the total on both dice. First construct a probability table for joint
probability mass function and then establish whether X and T are independent
or nor.

Answer: we rolled two dice and let X be the value on the first die and T be
the total on both dice. In the probability table (3.6), below most of the cell
probabilities are not the product of the marginal probabilities. For example,
none of marginal probabilities are 0, so none of the cells with 0 probability
can be the product of the marginals.

Table 3.6: Joint probability table for joint probability mass function
$p_{(X,T)}$ of $X\in\Omega_{X}=\\{1,2,\ldots,6\\}$ and
$T\in\Omega_{T}=\\{2,3,\ldots,12\\}$ along with marginal PMFs $p_{X}(x)$ and
$p_{T}(t)$.

$X\backslash T$ | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | $p_{X}(x)$
---|---|---|---|---|---|---|---|---|---|---|---|---
1 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0 | 0 | 0 | $\frac{1}{6}$
2 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0 | 0 | $\frac{1}{6}$
3 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | 0 | $\frac{1}{6}$
4 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | 0 | $\frac{1}{6}$
5 | 0 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | 0 | $\frac{1}{6}$
6 | 0 | 0 | 0 | 0 | 0 | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{36}$ | $\frac{1}{6}$
$p_{T}(t)$ | $\frac{1}{36}$ | $\frac{2}{36}$ | $\frac{3}{36}$ | $\frac{4}{36}$ | $\frac{5}{36}$ | $\frac{6}{36}$ | $\frac{5}{36}$ | $\frac{4}{36}$ | $\frac{3}{36}$ | $\frac{2}{36}$ | $\frac{1}{36}$ | 1

######  Example 3.2.33.

Consider a tossing of a biased coin (with probability of success is 1/4) in
the following 2 steps: in the first step we flip the coin until we get a heads
and let X denote the trial on which the first heads occurs. In the second step
we flip the coin X more times and let Y be the number of heads in the second
step. Compute joint PMF of X and Y.

Here, the random variable $X$ is geometrically distributed with parameter
$p=1/4$, so

$\displaystyle
p_{X}(x)=p(1-p)^{x-1}=\left(\frac{3}{4}\right)^{x-1}\frac{1}{4}\ \mbox{for}\
x=1,2,\ldots.$

And, the conditional PMF of $Y$ conditioned on $X=x$ is given by

$\displaystyle p_{Y|X}(y|x)=\left(\begin{array}[]{cc}x\\\
y\end{array}\right)\left(\frac{1}{4}\right)^{y}\left(\frac{3}{4}\right)^{x-y}\
\mbox{for}\ y=0,1,2,\ldots,x.$

And hence, the joint PMF can be computed as follows:

$\displaystyle p_{X,Y}(x,y)=p_{X}(x)p_{Y|X}(y|x)=\left(\begin{array}[]{cc}x\\\
y\end{array}\right)\left(\frac{1}{4}\right)^{y}\left(\frac{3}{4}\right)^{x-y}\left(\frac{3}{4}\right)^{x-1}\frac{1}{4}$

####  3.2.5 Expectation and variance of discrete random variable

######  Definition 3.2.34 (Expectation of a discrete random variable).

Consider a discrete random variable, if we observe $n$ random values of X,
then the mean of the $n$ values will be approximately equal to expectation of
X, $E(X)$, for large $n$. The expectation, $E(X)$ is defined as follows:

$\displaystyle E(X)=\sum_{\\{x\in\Omega_{X}\\}}xp_{X}(x).$

######  Definition 3.2.35 (Expected value rule).

Consider a discrete random variable and let $Y=g(X)$ be a function of X. If we
observe $X$ many times ($n$ times) to give results $x_{1},x_{2},\ldots,x_{n}$
and hence $g$ provides the observations $g(x_{1}),g(x_{2}),\ldots,g(x_{n})$.
The mean of $g(x_{1}),g(x_{2}),\ldots,g(x_{n})$ approaches $E(g(X))$, for
large $n$. The expectation, $E(g(X))$ is defined as follows:

$\displaystyle E(g(X))$
$\displaystyle=E(Y)=\sum_{\\{y\in\Omega_{Y}\\}}yp_{Y}(y)=\sum_{\\{y\in\Omega_{Y}\\}}y\sum_{g^{-1}(y)=\\{x|g(x)=y\\}}p_{X}(x)$
$\displaystyle=\sum_{\\{x\in\Omega_{X}\\}}g(x)p_{X}(x).$

The expectation tells us important information about the average value of a
random variable, but there is a lot of information that it doesn’t provide. If
you are investing in the stock market, the expected rate of return of some
stock is not the only quantity you will be interested in, you would also like
to get some idea of the riskiness of the investment. The typical size of the
fluctuations of a random variable around its expectation is described by
another summary statistic, the variance.

######  Definition 3.2.36 (Variance of a discrete random variable).

For a discrete random variable $X$, the variance, $Var(X)$, of $X$ is defined
by

$\displaystyle
Var(X)=E\left(\left(X-E(X)\right)^{2}\right)=E(X^{2})-(E(X))^{2}.$

provided that this quantity exists. We can also treat variance, $Var(X)$, of X
as an expected value $E(g(X))$ of the function $g(X)=(X-E(X))^{2}$.

That is variance is a measure of how much the distribution of X is spread out
about its mean and only randomness gives rise to variance. Statisticians often
prefer to use the standard deviation (in practice for interpretation and
visualization) rather than variance (in principle for theoretical analysis and
understanding) as a measure of spread.

######  Definition 3.2.37 (Covariance of two a joint discrete random
variable).

Consider a joint discrete random variable $(X,Y)$, where $X$ and $Y$ are
associated with the same random experiment, then covariance of $(X,Y)$ is
defined as follows:

$\displaystyle Cov(X,Y)=E\left((X-E(X))(Y-E(Y))\right)$
$\displaystyle=E\left(XY-XE(Y)-YE(X)+E(X)E(Y)\right)=E(XY)-E(X)E(Y).$

######  Theorem 3.2.38.

If X and Y are independent discrete random variables whose expectations exist,
then

$\displaystyle(a.)\ E(XY)=E(X)E(Y),\ (b.)\ E(g(X)h(Y))=E(g(X))E(h(Y)).$

######  Example 3.2.39 (A counter-example for converse of (3.3.51)).

Consider a uniformly distributed discrete random variable, $X\in\\{-1,0,1\\}$
i.e. $X\sim Unif([-1,1]\cap\mathbb{Z})$, then

$\displaystyle a.\ E(X)=0,\ b.\ E(X^{2})=\frac{2}{3},\ c.\ E(X^{3})=0,$
$\displaystyle d.\ Cov(X,X^{2})=E(X^{3})-E(X)E(X^{2})=0.$

For the observation $X^{2}=t$,

$\displaystyle
p_{X|X^{2}}(x|t)=\frac{P(X=x,X^{2}=t)}{P(X^{2}=t)}=\frac{P(X=x,X\in\\{-\sqrt{t},\sqrt{t}\\})}{P(X\in\\{-\sqrt{t},\sqrt{t}\\})}.$

So,

$\displaystyle
p_{X|X^{2}}(\sqrt{t}|t)=\frac{p_{X}(\sqrt{t})}{p_{X}(-\sqrt{t})+p_{X}(\sqrt{t})}\neq
p_{X}(\sqrt{t}).$

Also,

$\displaystyle
p_{X|X^{2}}(-\sqrt{t}|t)=\frac{p_{X}(-\sqrt{t})}{p_{X}(-\sqrt{t})+p_{X}(\sqrt{t})}\neq
p_{X}(-\sqrt{t})$

Therefore $X$ and $X^{2}$ are dependent discrete random variable despite of
having zero covariance.

######  Theorem 3.2.40.

If $X$ is a non-negative and non-constant discrete random variable, then $X$
and $X^{2}$ are positively correlated, and hence dependent.

######  Proof 3.2.41.

We have $X\geq 0$ and $X^{2}\geq 0$, then

$\displaystyle Cov(X,X^{2})$
$\displaystyle=E\left((X-E(X))(X^{2}-E(X^{2}))\right)$
$\displaystyle=E\left((X-E(X))(X^{2}-(E(X))^{2}+(E(X))^{2}-E(X^{2}))\right)$
$\displaystyle=E\left((X-E(X))(X^{2}-(E(X))^{2})\right)$
$\displaystyle+E\left((X-E(X))((E(X))^{2}-E(X^{2}))\right)$
$\displaystyle=E\left((X-E(X))(X^{2}-(E(X))^{2})\right)$
$\displaystyle=E\left((X-E(X))^{2}(X+E(X))\right)>0.$

######  Example 3.2.42.

There are 5 candidates for 2 job openings, 3 of the candidates are women and 2
are men. Let X be the number of women hired. Find PMF, expected value, and
variance of X.

Solution: the count of total possible outcomes of hiring 2 person from 5
candidates as a size of the sample is given by

$\displaystyle|\Omega|=\binom{5}{2}=10.$

Suppose, X be the number of women hired, then probability mass function of X
is computed as:

$\displaystyle\\{X=0\\}\implies|\\{X=0\\}|=\binom{3}{0}\cdot\binom{2}{2}=1\implies
p_{X}(0)=P(X=0)=\frac{1}{10}.$
$\displaystyle\\{X=1\\}\implies|\\{X=1\\}|=\binom{3}{1}\cdot\binom{2}{1}=6\implies
p_{X}(1)=P(X=1)=\frac{6}{10}.$
$\displaystyle\\{X=2\\}\implies|\\{X=2\\}|=\binom{3}{2}\cdot\binom{2}{0}=3\implies
p_{X}(2)=P(X=2)=\frac{3}{10}.$

Then

$\displaystyle E(X)=\sum_{x=0}^{2}xp_{X}(x)=\frac{12}{10},\
E(X^{2})=\sum_{x=0}^{2}x^{2}p_{X}(x)=\frac{18}{10}\implies
Var(X)=\frac{36}{100}.$

######  Example 3.2.43 (Expectation and variance of various discrete
distributions).

Determine the expectation and variance of the following discrete random
variables:

  1. (a.)

$X\sim Ber(p)$,

######  Solution 3.2.44.

As $X\sim Ber(p)$, so $p_{X}(x)=p^{x}(1-p)^{1-x}$ for $x\in\\{0,1\\}$. Then

$\displaystyle E(X)=\sum_{x\in\\{0,1\\}}xp_{X}(x)=0\cdot(1-p)+1\cdot p=p.$

And,

$\displaystyle E(X^{2})=\sum_{x\in\\{0,1\\}}x^{2}p_{X}(x)=0\cdot(1-p)+1\cdot
p=p.$

Then,