# [texhax] Typesetting row operations in matrices

E. Krishnan ekmath at asianetindia.com
Sat Mar 25 04:18:41 CET 2006

On Fri, 24 Mar 2006, Matthew Leingang wrote:

> When I'm talking at the board and I want to say "we're going to transpose
> row 1 and row 3 of this matrix", I draw a double-ended arrow on the
> right-hand side of the matrix, pointing to the first and third row.  If I
> want to represent the row operation "add -2 times the first row to the
> second row", I draw an arrow from the right side of row 1 to the right side
> of row 2, decorated with a "-2".
>
> I'd like to get the same thing in my TeX-ed notes.

Please have a look at this:

\documentclass{article}
\usepackage{amsmath}
\usepackage{pstricks,pst-node}

\begin{document}

\begin{equation*}
\psset{nodesep=5pt,%
linestyle=dotted,%
dotsep=1pt}
\begin{pmatrix}
1 & 2 & \rnode{1}{3}\\
4 & 5 & 6\\
7 & 8 & \rnode{3}{9}
\end{pmatrix}
\ncbar{<->}{1}{3}
\Aput[1pt]{\scriptstyle{-2}}
\end{equation*}

\end{document}

--
Krishnan