\begin{frame}
	\myheading{Module 20.2 : Why do we care about Markov Chains?}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
	\begin{columns}
				
		\begin{column}{0.35\textwidth}
			\begin{overlayarea}{\textwidth}{\textheight}
				\centering
				\vspace{1cm}
				\onslide<2->{
					\begin{figure}
						\includegraphics[scale=0.4]{images/noisy_image.jpg}
						\caption{$X\in R^{1024}$}
					\end{figure}
				}
				\vspace{1cm}				
				\onslide<3->{
					\begin{align*}
						\mathbb{E}_{P(X)}[f(X)]
					\end{align*}	
				}
			\end{overlayarea}
		\end{column}
		\begin{column}{0.65\textwidth}
			
			
			\begin{itemize}
				\justifying
				\item<1-> Recall our goals
				\item<2-> \textbf{Goal 1}: Sample from $P(X)$
				\item<3-> \textbf{Goal 2}: Compute $\mathbb{E}_{P(X)} f(X)$
				\item<4-> Now suppose we set up a Markov Chain $X_1, X_2, \dots$ such that
					\begin{itemize}
						\justifying
						\item<5-> It is \textbf{\textcolor{red}{easy to draw samples}} from this chain and
						\item<6-> This Markov Chain's \textbf{\textcolor{red}{stationary distribution is $P(X)$}}
					\end{itemize}
				\item<7-> Then it would mean that if we run the Markov Chain for long enough, we will start getting samples from $P(X)$
				\item<8-> And once we have a large number of such samples we can empirically estimate $\mathbb{E}_{P(X)} f(X)$ as 
				\vspace{-1em}
				\begin{align*}
					\frac{1}{n}\sum_{i=l}^{l+n} f(X_i)
				\end{align*}	
			\end{itemize}
		\end{column}
	\end{columns}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
	\begin{block}{}
	\begin{itemize}	
		\justifying
		 \item<1-> We will now get into a formal discussion to concretize the above intuition
		\end{itemize}
	\end{block}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\begin{frame}
	\begin{block}{}
			\textbf{Theorem:} If $X_0, X_1, \dots, X_t$ is an \textcolor{red}{irreducible} time homogeneous discrete Markov Chain with stationary distribution $\pi$, then
			\vspace{-1em}
			\onslide<2->{
				\begin{align*}
					\frac{1}{t} \sum_{i=1}^t f(X_i) \xrightarrow[t\rightarrow \infty]{\text{converges almost surely}} E_{\pi}[f(X)], \hspace{0.5em} \text{where} ~ X \in \mathscr{X} ~ \text{and} ~ X \sim \pi 
				\end{align*} 
			}
			\onslide<3->{\hspace{-0.4em}for any function $f$ : $\mathscr{X} \rightarrow R$}\\
			\onslide<4->{
			If, further the Markov Chain is \textcolor{red}{aperiodic} then $P(X_t = x_t | X_0 = x_0) \rightarrow \pi(X)$ as $t \rightarrow \infty \hspace{0.5em} \forall x, x_0 \in \mathscr{X}$
			}
	\end{block}
	\fontsize{10}{7.2}\selectfont
	%\vspace{-0.4em}
	\begin{itemize}
		\justifying
		\item<5-> So Part A of the theorem essentially tells us that if we can set up the chain $X_0, X_1, \dots, X_t$ such that it is tractable then using samples from this chain we can compute $E_{\pi}[f(X)]$ (which we know is otherwise intractable)
		\item<6-> Similarly Part B of the theorem says that if we can set up the chain $X_0, X_1, \dots, X_t$ such that it is tractable then we can essentially get samples as if they were drawn from $\pi(X)$ (which was otherwise intractable)
		\item<7-> Of course Part A and Part B are related!
		\item<8-> Further note that it doesn't matter what the initial state was (the theorem holds for $\forall x, x_0 \in \mathscr{X}$)
	\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
	\begin{block}{So our task is cut out now}
		\begin{itemize}
			\item<1-> Define what our Markov Chain is?
			\item<2-> Define the transition matrix $T$ for our Markov Chain
			\item<3-> Show how it is easy to sample from this chain
			\item<4-> Show that the stationary distribution of this chain is the distribution $P(X)$ (\textit{i.e.}, the distribution that we care about)
			\item<5-> Show that the chain is irreducible and aperiodic (because the theorem only holds for such chains)
			\item<6-> For ease of notation instead of $X = V_1, V_2, V_m, \dots, H_1, H_2, \dots, H_n$, we will use $X = X_1, X_2, \dots, X_{n+m}$
		\end{itemize}
	\end{block}
\end{frame}

