如何生成矩阵?

如何生成矩阵?

在此处输入图片描述

这是我的作品。我完全按照教程做的,但乳胶根本不起作用......我做错了什么?这太令人沮丧了......

\documentclass{article}
\begin{document}
\begin{matrix}
    1&0\\
    0&1
\end{matrix}
\end{document}

答案1

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Matrices require appropriate packages, e.g.\ \texttt{amsmath}, and math
environments.
\[
\begin{matrix}
1 & 0\\
0 & 1
\end{matrix}\quad\text{vs.}\quad
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix}
\]
If you don't like to load \texttt{amsmath}, you can get matrices with arrays.
\[
\begin{array}{cc}
1 & 0\\
0 & 1
\end{array}\quad\mbox{vs.}\quad
\left(\begin{array}{cc}
1 & 0\\
0 & 1
\end{array}\right)
\]
As you can see, this requires you to specify the columns.

If you want to number them, use some numbered math environment like
\texttt{equation} or \texttt{align}.
\begin{equation}
 \begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix}\cdot \begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix}~=~
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix}\;,
\end{equation}
\begin{align}
 \begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix}\cdot \begin{pmatrix}
-1 & 0\\
0 & -1
\end{pmatrix}&~=~
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix} \\
&~=~
\begin{pmatrix}
1 & 0\\
0 & 1
\end{pmatrix}^{-1}\;.
\end{align}
Please consult the \texttt{amsmath} docu for more information.
\end{document}

相关内容