Rolls of dice or flips of coins are "fair" by design. Hence it's reasonable to think that the possible results are "equally likely".

We can extend this way of thinking to situations where the results are not equally likely - for example, rain or no rain tomorrow, based on today's temperature and barometric pressure.

For these situations, we can assign probabilities based on the frequencey with which each possibility occurred in the past, in a similar situation.

We can apply probability even more widely, to unique situations, which have never occurred in the past. These probabilities may be assigned based on the opinion of an expert (human or machine). They represent the "degree of belief" in the various outcomes.

Probability isn't confined to prediction of future events. We can also use probability to "predict" past events that we don't already know about, or anything that is unknown or uncertain.

A probabilistic algorithm can branch one way or another with a specified probability.Probabilistic analysis of algorithms:Testing whether a large number is prime: There's a way to quickly get an answer with very high probability of being correct using a probabilistic algorithm. It's been recently shown that one can do the same with a non-probabilistic algorithm. Open question: is it always possible to get rid of the probabilistic aspect at little cost?

Monte Carlo evaluation of integrals: This is a very widely used numerical method in physics, statistics, finance, etc.

Rather than look at the worst-case performance of an algorithm, we might look at itsInformation theory:averagerun time.Quicksort: This has

nworst-case run time, but^{2}n log naverage run time,ifevery possible input is equally likely. But for other probability distributions over inputs, average run time may ben.^{2}

Data compression and error correction are based on probabilistic models.Computer graphics:We can compress data files only if we have some idea of which files are more likely than other files. Then we can assign short encodings to likely files, at the cost of assigning long encodings to less likely files, winning on average.

To correct errors optimally we need to have a model of which error patterns are more likely (eg, do they often come in bursts?). Also, some of the most effective error-correcting codes are constructed randomly.

Manually specifying every object in a scene to be rendered would often be very tedious. Instead, many objects are generated randomly, with probability distributions designed to produce objects that look natural.Statistical analysis:High-quality rendering of scenes often involves integration over possible light rays, which can be done by probabilistically by Monte Carlo methods.

Probability is the foundation for traditional statistical analysis.Machine learning / computer vision / computational linguistics / bioinformatics:Many areas of computer science need to analyse experiments or surveys:

Computer system performance assessment

Empirical evaluation of algorithm performance

Experiments testing usability of human-computer interfaces

Surveys of user requirements

Many applications require both sophisticated computational methods and non-traditional methods for statistical infereence, in which probability plays a central role. For example:Learning to classify customers as good or bad credit risks

Recognizing objects (eg, faces) in images

Translating web pages from one language to another

Finding genes associated with particular diseases

Sample space: The set of all possible outcomes of an "experiment" or other situation. Exactly one of these outcomes actually occurs.

Event: A subset of the sample spaceWe will usually denote the sample space by

Sand other events by other upper case letters.

We roll one 6-sided die. The sample space isS= { 1, 2, 3, 4, 5, 6 }. The event "roll > 4" is the subset { 5, 6 }.We roll two 6-sided dice (one red die and one green die). The sample space has 6x6 = 36 elements, each a pair of results, (red, green):

S= { (1,1), (1,2), ..., (2,1), (2,2), ... (6,5), (6,6) }. The event "sum of rolls > 7" is the subset { (2,6), (3,5), (3,6), (4,4), (4,5), (4,6), (5,3), (5,4), (5,5), (5,6), (6,2), (6,3), (6,4), (6,5), (6,6) }.

- For any event
*A*, P(*A*) >= 0. - If
*S*is the sample space, P(*S*) = 1. - For any disjoint events
*A*,_{1}*A*,_{2}*A*, ..._{3}P(

*A*U_{1}*A*U_{2}*A*U ...) = P(_{2}*A*) + P(_{1}*A*) + P(_{2}*A*) + ..._{3}

**Theorem:** P(*A ^{c}*) = 1 - P(

**Theorem:** P(*A* U *B*) = P(*A*) + P(*B*)
- P(*A* intersection *B*)

**Probability with equally-likely outcomes:**

It's sometimes reasonable to assume that all the outcomes in the sample space are equally likely. We can then let the probability of an event,E, be the fraction of outcomes inSthat are inE:P(E) = #(E) / #(S)

**Example:**

We roll two dice, and use the sample space mentioned above. If the dice are "fair", it's reasonable to assume equally likely outcomes. Referring to the event "sum of rolls > 7" above, we getP(sum of rolls > 7) = 15/36