# Markov chain

## Markov chain :

A Markov chain is a mathematical system that undergoes transitions from one state to another according to certain probabilistic rules. The defining characteristic of a Markov chain is that no matter how the system arrived at its current state, the possible future states are fixed. This is known as the “memoryless” property.
One example of a Markov chain is a model for the weather. Let’s say we have three states: sunny, cloudy, and rainy. The probability of transitioning from one state to another is fixed and known. For instance, the probability of transitioning from sunny to cloudy may be 0.3, while the probability of transitioning from cloudy to rainy may be 0.7.
If we start in the sunny state, we can use the probabilities to calculate the likelihood of transitioning to the other states. For example, the probability of transitioning to the cloudy state is 0.3, and the probability of transitioning to the rainy state is 0. If we stay in the sunny state for several transitions, we can calculate the overall probability of transitioning to each state after a certain number of steps.
Another example of a Markov chain is a model for the stock market. Let’s say we have three states: bullish, neutral, and bearish. The probability of transitioning from one state to another is fixed and known. For instance, the probability of transitioning from bullish to neutral may be 0.5, while the probability of transitioning from neutral to bearish may be 0.2.
If we start in the bullish state, we can use the probabilities to calculate the likelihood of transitioning to the other states. For example, the probability of transitioning to the neutral state is 0.5, and the probability of transitioning to the bearish state is 0.1. If we stay in the bullish state for several transitions, we can calculate the overall probability of transitioning to each state after a certain number of steps.
In both of these examples, the Markov chain allows us to predict the future state of the system based on its current state and the fixed probabilities of transitioning to other states. This can be useful for making decisions or planning strategies in various real-world situations.