You are on page 1of 28

Probability and Statistics ì

for Computer Science


“It’s straightforward to link a
number to the outcome of an
experiment. The result is a
Random variable.” --- Prof.
Forsythe

Random variable is a function,


it is not the same as in X =X+1
Credit: wikipedia

Hongye Liu, Teaching Assistant Prof, CS361, UIUC, 09.12.2023


Last time

✺Conditional Probability BS
✺ Review P(AIB) P(B)
=

✺ Bayes rule P(An B) D(A)B> P(B) =

✺ Total probability P(B) = (B1A ) P(A


= :

- P(A)PB)
✺ Independence
=

A disjoint A

-AlB)
;
:

PCA)
0
=

AinAj
=

0
P(DDA) P(B)
=

p(AinA; ) =
Probability using the property of
Independence: Airline overbooking (4)
An airline has a flight with s seats. They
always sell t (t>s) 4ckets for this flight. If
4cket holders show up independently
with probability p, what is the probability
that exactly u people showed up?
W

P( exactly u people showed up)


() prin -1- pit
-

-
Probability using the property of
Independence: Airline overbooking (5)
An airline has a flight with s seats. They
always sell t (t>s) 4ckets for this flight. If
4cket holders show up independently
with probability p, what is the probability
that the flight is overbooked ?
sti St2 . .
-
+

P( overbooked)
n -
(i) "s.-pite
Which is larger?

The hands
0 probability of drawing of
5-cards that have no
pairs .

Ino
replacement (
② 0
.
5

A P .
B ②

(E) =
52 x 48x44x43x36
#1 507
(2)
0

PLE 52x51x50x49x48
=
= .

wel
=
Random numbers
✺ Amount of money on a bet
✺ Age at retirement of a population
✺ Rate of vehicles passing by the toll
✺ Body temperature of a puppy in its pet clinic

✺ Level of the intensity of pain in a toothache


Random variable as vectors
Brain imaging
of Human
emotions
A) Moral
conflict
B) Multi-task
C) Rest

,ent
(t A. McDonald et al. NeuroImage doi:
10.1016/j.neuroimage.2016.10.048
Objectives
✺ Review
✺ Random Variable
✺ Probability distribution
✺ Cumulative distribution
✺ Joint probability
✺ Independence of random variables
Random variables
A random variable maps all outcomes to

Numbers ! outcomes
(w) ->
(x) are disjoint

Bernoull
:

Random Variable

X(w)
Head
Tail
=51W=
0 W =

Tail
He ad

P(W=Heads =

P -> PC X =

1) =

P
PLW = Tail) = 1 -

p
Random variables
The values of a random variable can
be either discrete, con5nuous or
mixed.
--
Discrete Random variables
The range of a discrete random
variable is a countable set of real
numbers.

T
4 - die
Discrete Random variables
The range of a discrete random
variable is a countable set of real
numbers. w X (W)

A tipixe
die ->
4 -

---
-
-

34
P)Szor33)
=

P(X(w) 2)
=
=

05 -
Random Variable Example
Number of pairs in a hand of 5 cards
Four of

Wi the same
->
2 pairs

X(Wi) = ?

Let a single outcome be the hand of 5 cards


Each outcome maps to values in the set of
numbers {0, 1, 2}
Random Variable Example
Number of pairs in a hand of 6 cards
Let a single outcome be the hand
of 6 cards
What is the range of values of this
random variable?
take
X (w) can

,3]
Q: Random Variable
If we roll a 3-sided fair die, and define
random variable U, such that
side ,
v2
- Iw=

S
W = 0 We sidez X =

(w) I
w- sides

what is the range of / ?


1
p,X
=

PlU=-a
&
=

1)
V
=

A. {-1, 0, 1} B. {0, 1} =
side
=

23xb)
Three important facts of Random
variables
✺Random variables have
probability functions

*
✺Random variables can be
conditioned on events or other
random variables
✺Random variables have averages
Random variables have probability
functions
✺ Let X be a random variable
S t
. .

✺ The set of outcomes S(WIERS X(Wi) =

x0}
is an event with probability Wi are

disjoint
P (X = x0 ) -

IP(wi)
X is the discrete random variable
x0 is any unique instance that X takes on
Probability>e
Distribution
✺P (X = x) is called the probability X
2

0
=

distribution for all possible x So


P(X =
3 I
x)
5) =

✺ P (X = x) is also denoted as P (x) or p(x)


,

✺ P (X = x) ≥ 0 for all values that X can


take, and is 0 everywhere else
✺ The sum of the probability
!
distribution is 1
x
-Pixe
P (x) = 1
Examples of Probability
Distributions side
3! ↳ !
W(W) = die
x(w) fair
=

(fair side 2
coin) sides
p(X =
x) p(X =
x)
↳ ar i

!
XIW) =

plot
j
Y3
=
x
>x

#et pairs -

3
X(w) ?
=

2
p(X =
x)

in a
#
pairs 507
x0 .

oli
hand
of 5-cards x8
I
.

44550
-
0475
,

->
K
Another way to write PDF

x(w)
=

3 Fair
- E
!

p(X =
x) P(x = x =

o
otherwise

j0
>x

side
v(w) =

! side z
⑤x 0

I
=

side 3
P(X
=
x) =

X(w)
=
02 PcX = x) 2
x =

1
3

! Y3 O otherwise
=

*
x
Cumulative distribution
✺ P (X ≤ x) is called the cumulative
distribution function of X => (X =

x)
x =
- A

✺ P (X ≤ x) is also denoted as f (x) see rate


✺ P (X ≤ x) is a non-decreasing function
of x lim p(Xxx) 1

-x)
=

-
x -
&

Probability distribution and


cumulative distribution
✺ Give the random variable X,
!
1 outcome of ω is head
X(ω) =
0 outcome of ω is tail
p(x) P (X = x) f (x)
G P (X ≤ x)
o
P(X <
1/2
1
1/2
p(X- 1)
=DIX =
0 o

0 1 x 0 1 x X
=

1)

P(x =
0) +
P(X 1) 1
=
=
What is the value ?
rolled
A biased four-sided die is once .

Random variable X is defined to be the

down-face value ·

x
x 3 4

E
=
1, 2,
To
P(X
,
=
x) =

o
otherwise

P(X = 4)

A
?
o . 1 C) 0 . 2

6
#
B 0 .
3 D) 0 .
Functions of Random Variables
U

x =
04
=(2)
xi X
S =
+
=

D =

X 1
- X-
Q .
Do they have the same
pdf ?
Head He ad
X(w) =

) ! Tail
Y(w) =

S ! Tail
same fair
u =
2X V =
x
+ Y Indpt
coin

tosses

Do U and U have the same Pot ?

Al Yes P(U =

2)

spirit
No Ern Ve

W
- 30 , 13
V
Assignments
✺ Module Week 4
✺ Next time: More random variable,
Expectations, Variance
Additional References
✺ Charles M. Grinstead and J. Laurie Snell
"Introduction to Probability”
✺ Morris H. Degroot and Mark J. Schervish
"Probability and Statistics”
See you next time

See
You!

You might also like