0

One of my textbooks notates Markov transition matrices this way with 1 and 2 denoting states:

enter image description here

How can I reproduce this matrix in LaTeX?

Gaussler
  • 12,801

1 Answers1

1

[EDITED to resolve the equation axis properly]

\documentclass{article}
\usepackage{amsfonts}
\usepackage{scalerel}
\begin{document}
\def\x{\begin{array}{c}x\\x\end{array}}
\(
\let\svarraycolsep\arraycolsep
\renewcommand\arraystretch{1.4}
\arraycolsep 0.4ex
\begin{array}{c}
\\
\mathbb{P}=\quad\\
\\
\end{array}
\begin{array}{c}
 \\
 {\scriptstyle 1}\\
 {\scriptstyle 2}\\
\\
\end{array}
\begin{array}{c}
 \\
 \scalerel*[1.5ex]{(}{\x}\\
\\
\end{array}
\begin{array}{c}
 {\scriptstyle 1}\\
 1-a\\
 b\\
\\
\end{array}
\begin{array}{c}
 {\scriptstyle 2}\\
 a\\
 1-b\\
\\
\end{array}
\begin{array}{c}
 \\
 \scalerel*[1.5ex]{)}{\x}\\
\\
\end{array}
\mathrm{is~the~answer}
\arraycolsep\svarraycolsep
\renewcommand\arraystretch{1.0}
\)
\end{document}

enter image description here

David Carlisle
  • 757,742
  • One caveat with this approach is that your math axis is now slightly distorted. Visually you print P= between rows 2 and 3 of the matrix construction. If you add constructions on either side of this it will vertically align with the middle row (row 2), which would make P= seem off-axis. – Werner May 01 '13 at 19:02
  • @werner. True, but that can be circumvented by adding an extra [null] row each,to the bottom of the P+ as well as the matrix entries. No? – Steven B. Segletes May 01 '13 at 19:04
  • ...which you then have to compensate for regarding content (say, paragraphs) above/below. The space below this construction is then far greater than the space above... – Werner May 01 '13 at 19:31
  • A long time without up votes!? Strange. +1. – Sigur Apr 03 '14 at 00:51
  • 1
    @Sigur Thanks. I hardly even remember this one. Today, I'd be using stacks to tackle it. Maybe next year, I'll ping you on my zero-vote answer from today ;^) Cheers! – Steven B. Segletes Apr 03 '14 at 01:02