Probability gives us a language for uncertainty. It helps reason about randomized algorithms, reliability, experiments, and systems where outcomes are not fully predictable.
Outcomes, sample spaces, and events
A sample space lists possible outcomes of an experiment. When rolling a fair six-sided die, it is {1, 2, 3, 4, 5, 6}. An event is a set of outcomes, such as rolling an even number. In this example, the event's probability is 3/6 = 1/2.
For equally likely outcomes, probability is the number of favorable outcomes divided by the total number of outcomes. When outcomes are not equally likely, use their actual probabilities instead.
Conditional probability
The probability of event A given event B is written P(A | B). It asks how likely A is after learning that B occurred. For example, in a deck of cards, the chance of drawing a king changes if you already know the card is a face card.
Carefully define what information is known. Confusing P(A | B) with P(B | A) is a common source of mistakes because the conditions are different.
Expected value
The expected value is a probability-weighted average of possible outcomes. It does not predict the next individual result, but it describes the long-run average across many repetitions.
In computer science, probability helps analyze randomized algorithms and model failures. State your assumptions about randomness and independence; conclusions are only as trustworthy as the model behind them.