# How can I visualize Matrix operations?

I would like to visualize some matrix operations like that:

How can I do that (preferably something that also works for mathjax)?

-
A non-LaTeX related remark: By inspection, I can see what the first transformation is meant to do, and I can sort-of guess what the second one is going to do. But that's because I'm familiar enough with linear algebra that I'd also be able to guess reasonably well if all you had written were the matrices with a squiggly arrow between them. Unless you expect your readers to be reading and writing these diagrams, communicating in the same notation with other people, for enough years into the future that this shorthand remains permanently useful to them, I suggest something easier to render. –  Niel de Beaudrap Jan 6 '12 at 17:38
Well, first of all this is not my image. I've searched for it. And I am currenctly writing some blogposts for math students in the first term. They should do the calculations and learn how to use Gaussian elimination. So I want to explain it step by step. As soon as I am covering more advanced topics, I'll simply provide the solution of the Gaussian elimination. –  moose Jan 6 '12 at 18:11
A fairly common way to represent row operations is something along the lines of R2 - t \cdot R1, or -R3, to show what's being changed between the matrices, in a format not unlike this answer to a related question. –  Niel de Beaudrap Jan 6 '12 at 19:30
Also have a look at the examples on this link. –  percusse Jan 7 '12 at 2:19
@percusse: Thanks for sharing this link. tikz is amazing, but in this case it seems not like it would provide what I've been looking for. –  moose Jan 7 '12 at 13:48

Can't say about MathJax, but the gauss package does this.

\documentclass{article}
\usepackage{gauss}
\begin{document}
$\begin{gmatrix}[p] 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \rowops \swap{0}{1} \mult{0}{\cdot 7} \add[5]{1}{2} \end{gmatrix}$
\end{document}

-
This is great! It looks exactly like what I've been looking for. But it doesn't work with MathJax. I gave your answer +1 and I'll accept it in a week if nobody has a solution that works with MathJax. –  moose Jan 6 '12 at 18:07
I suppose this explains where the notation came from. Is this common many places, outside of users of this package? I've never seen it before. –  Niel de Beaudrap Jan 6 '12 at 19:20
Another common notation is just writing the matricies with a arrow between them. Such like –  N3buchadnezzar Jan 6 '12 at 19:29
I've just found this list with Latex features supported by MathJax: mathjax.org/docs/1.1/tex.html –  moose Feb 10 '12 at 16:17

I'm used to the following notation:

You can use the following LaTex Code in MathJax (The code looks a little bit messy because I'm not used to MathJax):

\begin{aligned}
&\begin{pmatrix}
1&2&8\\
1&3&7\\
2&9&3
\end{pmatrix}
\hspace{-0.5em}
\begin{align}
&\phantom{I}\\
&II-I \\
&III-2\cdot I\
\end{align}
\newline
\Rightarrow
&\begin{pmatrix}
1&2&8\\
0&1&-1\\
0&5&-13
\end{pmatrix}
\end{aligned}

-
Nice workaround, but not what I've searched for: +1 –  moose Jan 8 '12 at 14:37

Since TikZ or PsTricks are not supported in Math JaX getting those back pointing arrows or proper placement of symbols are not possible as far as I know. This is the closest that I can come up within the limitations of Math JaX.

\documentclass[11pt]{amsart}
\usepackage{amsmath}
\begin{document}
$\begin{pmatrix} 1 & 1 & 1\\ t & 2t & 2\\ t+1 & 0 & 2t \end{pmatrix}\ \hookleftarrow\stackrel{-t}{+}% \hookleftarrow\stackrel{-(t+1)}{+}\rightsquigarrow \begin{pmatrix} 1 & 1 & 1\\ 0 & t & 2-t\\ 0 & -t-1 & t-1 \end{pmatrix}\hookleftarrow+|\cdot(-1)$
\end{document}


-