MCMC algorithm to generate samples I read that MCMC algorithm is used to draw samples from a distribution.
The example mentioned in the text book is about a 6x6 matrix which after 1000 iterations will converge to a steady state 1x6 matrix as shown below.

Okay I understand how this reaches the state state part, 
[ 0.1, 0.2, 0.2, 0.2, 0.2, 0.1 ]

How will I generate samples from this matrix ? This is where I am confused.
 A: The matrix $P$ is, presumably, a transition matrix for a Markov chain. For some Markov chains, a stationary distribution exists. For your example, you get
\begin{equation}
P^{1000}=\begin{pmatrix}
0.1&0.2&0.2&0.2&0.2&0.1\\
0.1&0.2&0.2&0.2&0.2&0.1\\
0.1&0.2&0.2&0.2&0.2&0.1\\
0.1&0.2&0.2&0.2&0.2&0.1\\
0.1&0.2&0.2&0.2&0.2&0.1\\
0.1&0.2&0.2&0.2&0.2&0.1\\
\end{pmatrix}.
\end{equation}
So you can see, informally, that a stationary distribution for the Markov chain with transition matrix $P$ exists.
The basic idea for MCMC methods is that the stationary distribution is chosen to be the distribution you want to sample from. An MCMC algorithm then constructs a Markov chain that has the appropriate stationary distribution. The most commonly used MCMC algorithm is the Metropolis-Hastings algorithm, with which the Gibbs sampler is a special case you can use when the full conditional densities of the target distribution are known. http://en.wikipedia.org/wiki/Metropolis-Hastings_algorithm gives a good explanation of how it works and how to use it.
