---
# System prepended metadata

title: Untitled

---

## Probabiltity with Matricies
### Created By: Orion Sinacori

As we explore uses of matricies, we come across this idea of using a matrix to determine the probability of an event. When plaing games like Texas Hold'em or Black Jack, knowing probility can give you an advantage over your opponents, but complex games like these require complex matrices to find the probabilty of different hands. This post will give some basic ideas about how you can use probability vectors to find the probability of specific events in simple scenarios. 

For starters, it is important to understand what a probability vector is. A probability vector is a vector with nonnegative entries that add up to 1. With this knowledge, we can define a stochastic matrix as a square matrix whose columns are probabilty vectors. To understand these concepts we will look at an example. If an NBA player makes a free throw then there is a 75 percent chance of him making his next shot. If an NBA player misses his free throw then he has a 40 percent chance of making his next. With this information we can make the stochastic matrix
\begin{bmatrix}
.75&.4\\
.25&.6\\
\end{bmatrix}
The first column demontrates the probability of making the next shot when the first one is made and the second column deonstrates the probability of making the second shot when the first one is missed.

Now that we have this information, what can we do with it? Well what if we wanted to know what the chances are of the NBA player making his 3rd shot or 10th shot if he misses his first? In order to figure this out we will look at a Markov Chain which is a sequence of probabiltiy vectors $\vec{x}_0$, $\vec{x}_1$, $\vec{x}_2$, ... together with a stochastic matrix $P$ such that $\vec{x}_{k+1} = P\vec{x}_k = P^k \vec{x}_0$. What this means is that we will multiply our stochastic matrix by an intial starting point. Then depending on what shot we are trying to find the probability of we will plug that in for our $k$ in $P^k \vec{x}_0$. Since our initial starting point is the NBA player missing their first shot we will have 

$\begin{bmatrix}
.75&.4\\
.25&.6\\
\end{bmatrix}^3 \begin{bmatrix}
0\\
1\\
\end{bmatrix} =\begin{bmatrix}
.589\\
.411\\
\end{bmatrix}$

So the NBA player has a 58.9 percent chance of making their third shot if they miss their first. Now we will replace the $k = 3$ for 10 in order to see what the chance of the NBA player making his tenth shot is after missing the first. 

$\begin{bmatrix}
.75&.4\\
.25&.6\\
\end{bmatrix}^{10} \begin{bmatrix}
0\\
1\\
\end{bmatrix} =\begin{bmatrix}
.6154\\
.3846\\
\end{bmatrix}$

Thus the chance of the NBA player making their tenth shot is about 61.54 percent. 

Now that you have the knowlege to find a stochastic matrix and use a Markov chain, see if you can solve the following exercise. Suppose during an NBA game, if a player first shoots a 3 pointer then there is a 30 percent chance of them shooting a jumper, a 50 percent chance of them shooting a layup and a 20 percent chance of them shooting another 3 on their next shot. If their first shot is a jumper then there is a 30 percent chance of shooting another jumper, a 60 percent chance of shooting a layup, and a 10 percent chance of shooting a 3. If the player's first shot is a layup then there is a a 30 percent chance of shooting a jumper, a 40 percent chance of shooting another layup, and a 30 percent chance of shooting a 3. Create a stochastic matrix and find the probability of the player shooting a 3 pointer for his 5th and 12th shot if his first shot is a jumper.
