table of Contents
Updated: 2019.10.02
1. Introduction
Matrix is a powerful tool that many things can be represented by a matrix, let's talk about how in a matrix input in latex
2. Matrix
2.1 complicated wording
In latex, we can use the array
parameters to input a matrix.
\begin{array}{ccc}
1 & 0 & 0\\\\
0 & 1 & 0\\\\
0 & 0 & 1\\\\
\end{array}
显示效果:
\begin{array}{ccc}
1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1\\
\end{array}
What can be found in the above matrix seems lacking? ? ? And a control book, does not seem to find the ()
or []
. In fact, in latex, if you want to add this form of a matrix ()
or []
, and not to add the code directly to one ()
or []
, after all, matrix too, these two little guys can not hold it .
Generally speaking, to be used as \left(
and \right)
to represent. Of course, ()
also it can be replaced []
, even ||
, but not the third representative of the matrix, but rather a determinant.
$$
\left[
\begin{array}{ccc}
1 & 0 & 0\\\\
0 & 1 & 0\\\\
0 & 0 & 1\\\\
\end{array}
\right]
$$
显示效果:
\[ \left[ \begin{array}{ccc} 1 & 0 & 0\\\\ 0 & 1 & 0\\\\ 0 & 0 & 1\\\\ \end{array} \right] \]
- Tip: {} refers to a method for aligning CCC element (centering), addition
l
andr
optional parameters respectively represent left and right
2.2 simplifies writing
If every input matrix when they are coupled with one \left(
and \right)
, indeed annoying . But in fact, latex, there are some specific parameters can be generated matrix, like pmatrix
(with ()
matrix), bmatrix
(with []
matrix), vmatrix
(determinant)
<!--带`()`的矩阵-->
\begin{pmatrix}
1 & 0 & 0\\\\
0 & 1 & 0\\\\
0 & 0 & 1\\\\
\end{pmatrix}
<!--带`[]`的矩阵-->
\begin{bmatrix}
1 & 0 & 0\\\\
0 & 1 & 0\\\\
0 & 0 & 1\\\\
\end{bmatrix}
<!--行列式-->
\begin{vmatrix}
1 & 0 & 0\\\\
0 & 1 & 0\\\\
0 & 0 & 1\\\\
\end{vmatrix}
Display: \ pmatrix the begin {} . 1 & 0 & 0 \\ 0 \\ & 0. 1 & 0. 1 & & \\ 0 \} End {pmatrix
\begin{bmatrix}
1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1\\
\end{bmatrix}
\begin{vmatrix}
1 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1\\
\end{vmatrix}
2.3 complex matrix
Sometimes we need to enter some of the more complex matrix or the matrix only letters
$$A =
\begin{pmatrix}
a_{11} & a_{12} & \cdots & a_{1n}\\
a_{21} & a_{22} & \cdots & a_{2n}\\
\vdots & \vdots & \ddots & \vdots\\
a_{n1} & a_{n2} & \cdots & a_{nn}\\
\end{pmatrix}$$
显示效果:
\[A = \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & \cdots & a_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ a_{n1} & a_{n2} & \cdots & a_{nn}\\ \end{pmatrix}\]
- tip: cross-point arrangement \ (\ cdots \) with
$\cdots$
said columns arranged point \ (\ vdots \) with$\vdots$
said oblique arrangement of dots \ (\ ddots \) by$\ddots$
showing
3. Form
As mentioned in the usage of array, it is a little introduction of some form of latex.
\begin{array}{|c|c|}
\hline
0 & 1 \\\\\hline
1 & 0 \\\\\hline
\end{array}
Display:
\ Array the begin {} {| C | C |}
\ hline
0 & \\\ hline. 1
. 1 & hline \\\ 0
\} End {Array
- tip:
\hline
represents the horizontal line, vertical line and can be used|
to represent
4. Align
In essence, array display are some of the things aligned array, so it can align other mathematical objects. For example, we can do this:
\begin{array}{cc}
(A)\quad 4 & \hspace{4cm}(B)\quad 3\\\\
(B)\quad 2 & \hspace{4cm}(D)\quad 1
\end{array}
显示效果:
\begin{array}{cc}
(A)\quad 4 & \hspace{4cm}(B)\quad 3\\
(B)\quad 2 & \hspace{4cm}(D)\quad 1
\end{array}
- tip:
\quad
and\hspace{}
all represents a space, but a different number of empty