# Using Markov chains for basketball

The NBA hackathon application process asked a fun question that I got excited about:

```
Given that the Warriors win a game with probability 0.800,
what’s the probability that they play an entire 82-game
season without consecutive losses?
```

I modeled the season as a Markov chain. There are 3 states: `W`

, `L`

, and `2L`

. `W`

transitions to itself with and `L`

with . `L`

transitions to `W`

with and `2L`

with . `2L`

transitions to itself with . This results in the following transition matrix: where the columns represent the “source” states and the rows are the “destination” states. We start off with of being in state `W`

, of being in state `L`

, and of being in state `2L`

, so and we need to solve for .

.

Therefore, the probability of the Warriors never losing consecutive games is .

If you loosen the assumption and tried to model their season as a function of their opponents, their rest schedule, etc. that would be much more difficult. You would need to use some more involved ML techniques.