Probability is the mathematical way to talk about chance. A value of 0 means the event is impossible, 1 means it is certain, and values in between indicate degrees of chance. A fair coin, for example, has a probability of 0.5 of landing heads.

How it works

For events that do not influence each other, the chance of both happening together is the multiplication of the chances. The chance of getting heads twice in a row is 0.5 times 0.5, or 0.25.

There is also conditional probability: the chance of something happening given that something else has already happened. The chance of rain today changes if you know the sky is overcast.

AI models use these ideas all the time. An email classifier calculates the chance that each message is spam. A language model calculates the chance of each possible next word.

Then the system chooses. It can pick the most likely option or sample among the most likely ones. That sampling explains why the answer varies.

Practical example

You have a spam filter that scores each email from 0 to 1. With a score above 0.9, the email goes to the spam folder. Between 0.5 and 0.9, it goes for review. Below that, it lands in the inbox.

Python
def decidir(prob_spam):
    if prob_spam > 0.9:
        return "spam"
    if prob_spam > 0.5:
        return "revisar"
    return "caixa de entrada"

Choosing these thresholds is a business decision: the lower they are, the more spam you catch, but the more good emails you may block.

What it's for

Probability is for dealing with uncertainty in decisions. In AI, it shows up in classification, forecasting, text generation and risk assessment.

For people who use language models, understanding this helps explain why they sometimes err with confidence: the model picks what is probable, not necessarily what is true.

It also helps you tune parameters like temperature, which makes responses more predictable or more varied.

Difference between probability and statistics

Probability starts with a model and calculates the chance of the data. Statistics starts with the data and tries to find the model. The two complement each other in AI work.