CSCE 411 Lecture 23

From Notes
Jump to navigation Jump to search
Lecture Slides

« previous | Monday, October 22, 2012 | next »

No lecture last Friday due to bomb threat.

Randomized Algorithms

Verifying Polynomial Identity

def verify_polynomial_identity f, g
  d = [f.degree, g.degree].max
  r = (1..100*d).to_a.sample
  f(r) == g(r)
end

The alogorithm reports that and are the same although they are different iff is a root of the polynomial .

A polynomial of degree has exactly roots, so choosing from gives 1/100 chance for error.

We could reduce this even further by choosing a larger range of integers, but no matter how large, there will always be a small chance for error.

We could also run the algorithm times, so the failure probability of failure for independent events

Random Variables

More probability theory. (See :Category:STAT 211-507→)


Let be a σ-algebra over a sample space . A random variable is a function such that is an event in for each in .

We write for this event.

Allows us to describe events as preimages.

Examples

  1. Let be the random variable denoting the sum of face values of a pair of dice. Then is a shorthand for the event .
  2. Let be the random variable counting the number of heads during three subsequent coin tosses. Then is shorthand for the event

Discrete Random Variables

A random variable with a countable image, where is an event.

Expectation Value

Let be a discrete random variable over probability space

The expectation value (or mean) of is given by

Example

Let denote the number of heads in three subsequent coin tosses.

  • is
  • is
  • is
  • is

Probabilities of event:

Expected value

Linearity of Expectation

For random variables and real numbers

Example: Hat Check Girl

Suppose persons give their hat to the hat check girl. The girl is upset and hands each person a random hat (where the hat is chosen uniformly at random). How many persons can expect to get their own hat back?

Sample space is

Allow subsets of to be events such that σ-algebra .

For , the event has the interpretation that received his or her own hat. Therefore, by uniform distribution, the probability that any receives his or her own hat is

Use random variable if the th person received his or her own hat back, and otherwise.

.

The random variable counts the number of persons receiving their own hat. By linearity,

So 1 person gets his or her own hat back, and the other are in a riot outside the manager's office.

Bernoulli Distribution

Tossing a biased coin can be described by a random variable that takes the value 1 if the outcome is heads and 0 if the outcome is tails. Assume that and

Geometric Distribution

Suppose we keep tossing a biased coin that has Bernoulli distbibution with parameter until heads event occurs. Let be the number of coin flips needed in this experiment. We say that is geometrically distributed with parameter and th edensity is given as:

for .

Example: Coupon Collection

The hat check girl is a compulsive coupon collector. Currently, she is collecting charming Hanny Potter characters that are contained in overpriced cereal boxes. There are different characters and each box contains one character. How many boxes of cereal does she have to buy for a complete collection?

Let denote the number of boxes required to collect at least one character of each type.

Goal is to find . Let be the random variables counting the number of boxes that the hat-check girl buys to get the th character after she has already collected characters.

The probability to draw one of the remaining characters is . Hence is geometrically distributed with parameter . Therefore

Linearity shows that