答案1
一个选择是nicematrix
。
\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage{nicematrix}
\begin{document}
\begin{align*}
E_1&=
\begin{bNiceArray}{rrr}[first-row,last-col]
\multicolumn{3}{c}{\mathclap{\textcolor{magenta}{\text{Elementary Matrix}}}}\\
0 & 1 & 0 &\textcolor{magenta}{R_1\leftrightarrow R_2}\\
1 & 0 & 0 & \\
0 & 0 & 1 & \\
\end{bNiceArray}
&
E_1^{-1}&=
\begin{bNiceArray}{rrr}[first-row,last-col]
\multicolumn{3}{c}{\mathclap{\textcolor{magenta}{\text{Inverse Matrix}}}}\\
0 & 1 & 0 &\textcolor{magenta}{R_1\leftrightarrow R_2}\\
1 & 0 & 0 & \\
0 & 0 & 1 & \\
\end{bNiceArray}\\
E_2&=
\begin{bNiceArray}{rrr}[last-col]
1 & 0 & 0 &\\
0 & 1 & 0 & \\
-2 & 0 & 1&
\textcolor{magenta}{R_2+(-2)R_1\to R_3} \\
\end{bNiceArray}
&
E_2^{-1}&=
\begin{bNiceArray}{rrr}[last-col]
1 & 0 & 0 &\\
0 & 1 & 0 & \\
2 & 0 & 1 & \textcolor{magenta}{R_2+(2)R_1\to R_3} \\
\end{bNiceArray} \\
E_3&=
\begin{bNiceArray}{rrr}[last-col]
1 & 0 & 0 &\\
0 & 1 & 0 & \\
0 & 0 & \frac{1}{2} &
\textcolor{magenta}{(\tfrac{1}{2})R_3\to R_3} \\
\end{bNiceArray}
&
E_3^{-1}&=
\begin{bNiceArray}{rrr}[last-col]
1 & 0 & 0 &\\
0 & 1 & 0 & \\
0 & 0 & 2 & \textcolor{magenta}{(2)R_3\to R_3}
\end{bNiceArray} \\
\end{align*}
\end{document}
另一个选择是blkarray
。
\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{blkarray}
\usepackage{bigstrut}
\usepackage{xcolor}
\begin{document}
\begin{align*}
E_1&=
\begin{array}{@{}l@{}}
\textcolor{magenta}{\text{Elementary Matrix}}\\
\begin{blockarray}{[rrr]l}
\bigstrut[t]0 & 1 & 0 &\textcolor{magenta}{R_1\leftrightarrow R_2}\\
1 & 0 & 0 & \\
0 & 0 & 1 & \\
\end{blockarray}
\end{array}
&
E_1^{-1}&=
\begin{array}{@{}l@{}}
\textcolor{magenta}{\text{Inverse Matrix}}\\
\begin{blockarray}{[rrr]l}
\bigstrut[t]0 & 1 & 0 &\textcolor{magenta}{R_1\leftrightarrow R_2}\\
1 & 0 & 0 & \\
0 & 0 & 1 & \\
\end{blockarray}
\end{array} \\
E_2&=
\begin{blockarray}[t]{[rrr]l}
1 & 0 & 0 \bigstrut[t]&\\
0 & 1 & 0 & \\
-2 & 0 & 1&
\textcolor{magenta}{R_2+(-2)R_1\to R_3}
\end{blockarray}
&
E_2^{-1}&=
\begin{blockarray}[t]{[rrr]l}
\bigstrut[t]1 & 0 & 0 &\\
0 & 1 & 0 & \\
2 & 0 & 1 & \textcolor{magenta}{R_2+(2)R_1\to R_3} \\
\end{blockarray} \\
E_3&=
\begin{blockarray}[t]{[rrr]l}
\bigstrut[t]1 & 0 & 0 &\\
0 & 1 & 0 & \\
0 & 0 & \frac{1}{2} &
\textcolor{magenta}{(\tfrac{1}{2})R_3\to R_3} \\
\end{blockarray}
&
E_3^{-1}&=
\begin{blockarray}[t]{[rrr]l}
\bigstrut[t]1 & 0 & 0 &\\
0 & 1 & 0 & \\
0 & 0 & 2 & \textcolor{magenta}{(2)R_3\to R_3}
\end{blockarray} \\
\end{align*}
\end{document}