[Tex/LaTex] Arrow with multiline expression above and below

math-mode

I was trying to write this in latex
enter image description here

but I don't know how to to insert the arrow in the middle with the expressions below and above on it.

Best Answer

Use \substack together with \xrightarrow:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\[
\begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{pmatrix}
\xrightarrow
 [% below
  \substack{a+cx+x^2\\s+x}
 ]
 {% above
  \substack{a+cx+x^2\\s+x}
 }
\begin{pmatrix}
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9
\end{pmatrix}
\]

\end{document}

enter image description here

Related Question