%% Determine Whether Markov Chain Is Reducible
% Consider this three-state transition matrix.
% P = \left[ {\begin{array}{*{20}{c}}
% {0.5}&{0.5}&0\\
% {0.5}&{0.5}&0\\
% 0&0&1
% \end{array}} \right]
% Create the Markov chain that is characterized by the transition matrix P.

P = [0.5 0.5 0; 0.5 0.5 0; 0 0 1];
mc = dtmc(P);

%
% Determine whether the Markov chain is reducible.

isreducible(mc)

% 1 indicates that mc is reducible.
%
% Visually confirm the reducibility of the Markov chain by plotting its digraph.

figure;
graphplot(mc);

% Two independent chains appear in the figure. This result indicates that you can analyze the two chains separately.
% Copyright 2012 The MathWorks, Inc.