最常用的矩阵及markdown语法如下。
矩阵呈现效果
A = [ a 11 a 12 ⋯ a 13 a 21 a 22 ⋯ a 23 ⋮ ⋮ ⋱ ⋮ a 31 a 32 ⋯ a 33 ] A=\begin{bmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{13}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{23}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{31}}&{a_{32}}&{\cdots}&{a_{33}} \end{bmatrix} A= a11a21⋮a31a12a22⋮a32⋯⋯⋱⋯a13a23⋮a33
markdown语法
$$A=
\begin{bmatrix}
{a_{11}}&{a_{12}}&{\cdots}&{a_{13}}\\
{a_{21}}&{a_{22}}&{\cdots}&{a_{23}}\\
{\vdots}&{\vdots}&{\ddots}&{\vdots}\\
{a_{31}}&{a_{32}}&{\cdots}&{a_{33}}
\end{bmatrix}$$
矩阵的边框有小括号、大括号以及竖线等,可以通过改变\begin及\end后的matrix参数来调整。
小括号边框
参数:pmatrix
呈现效果
( a 11 a 12 ⋯ a 13 a 21 a 22 ⋯ a 23 ⋮ ⋮ ⋱ ⋮ a 31 a 32 ⋯ a 33 ) \begin{pmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{13}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{23}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{31}}&{a_{32}}&{\cdots}&{a_{33}} \end{pmatrix} a11a21⋮a31a12a22⋮a32⋯⋯⋱⋯a13a23⋮a33
语法
$$\begin{pmatrix}
{a_{11}}&{a_{12}}&{\cdots}&{a_{13}}\\
{a_{21}}&{a_{22}}&{\cdots}&{a_{23}}\\
{\vdots}&{\vdots}&{\ddots}&{\vdots}\\
{a_{31}}&{a_{32}}&{\cdots}&{a_{33}}
\end{pmatrix}$$
中括号边框
参数:bmatrix
呈现效果
[ a 11 a 12 ⋯ a 13 a 21 a 22 ⋯ a 23 ⋮ ⋮ ⋱ ⋮ a 31 a 32 ⋯ a 33 ] \begin{bmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{13}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{23}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{31}}&{a_{32}}&{\cdots}&{a_{33}} \end{bmatrix} a11a21⋮a31a12a22⋮a32⋯⋯⋱⋯a13a23⋮a33
大括号边框
参数:Bmatrix
呈现效果
{ a 11 a 12 ⋯ a 13 a 21 a 22 ⋯ a 23 ⋮ ⋮ ⋱ ⋮ a 31 a 32 ⋯ a 33 } \begin{Bmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{13}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{23}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{31}}&{a_{32}}&{\cdots}&{a_{33}} \end{Bmatrix} ⎩ ⎨ ⎧a11a21⋮a31a12a22⋮a32⋯⋯⋱⋯a13a23⋮a33⎭ ⎬ ⎫
单竖线边框
参数:vmatrix
呈现效果
∣ a 11 a 12 ⋯ a 13 a 21 a 22 ⋯ a 23 ⋮ ⋮ ⋱ ⋮ a 31 a 32 ⋯ a 33 ∣ \begin{vmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{13}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{23}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{31}}&{a_{32}}&{\cdots}&{a_{33}} \end{vmatrix} a11a21⋮a31a12a22⋮a32⋯⋯⋱⋯a13a23⋮a33
双竖线边框
参数:Vmatrix
呈现效果
∥ a 11 a 12 ⋯ a 13 a 21 a 22 ⋯ a 23 ⋮ ⋮ ⋱ ⋮ a 31 a 32 ⋯ a 33 ∥ \begin{Vmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{13}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{23}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{31}}&{a_{32}}&{\cdots}&{a_{33}} \end{Vmatrix} a11a21⋮a31a12a22⋮a32⋯⋯⋱⋯a13a23⋮a33
增广矩阵实际上是一个阵列,在\begin及\end后面用{array}声明。
呈现效果
∣ a 11 a 12 ⋯ a 13 b 1 a 21 a 22 ⋯ a 23 b 2 ⋮ ⋮ ⋱ ⋮ b 3 a 31 a 32 ⋯ a 33 b 4 ∣ \left| \begin{array}{lccr|c} {a_{11}}&{a_{12}}&{\cdots}&{a_{13}}&{b_1}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{23}}&{b_2}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}&{b_3}\\ {a_{31}}&{a_{32}}&{\cdots}&{a_{33}}&{b_4} \end{array} \right| a11a21⋮a31a12a22⋮a32⋯⋯⋱⋯a13a23⋮a33b1b2b3b4
语法
$$\left|
\begin{array}{lccr|c}
{a_{11}}&{a_{12}}&{\cdots}&{a_{13}}&{b_1}\\
{a_{21}}&{a_{22}}&{\cdots}&{a_{23}}&{b_2}\\
{\vdots}&{\vdots}&{\ddots}&{\vdots}&{b_3}\\
{a_{31}}&{a_{32}}&{\cdots}&{a_{33}}&{b_4}
\end{array}
\right|$$
语法说明
与矩阵和阵列不同,方程组的\begin及\end后使用{cases}声明。
方程组呈现
{ a 11 x + a 12 y + a 13 z = b 1 a 21 x + a 22 y + a 23 z = b 2 a 31 x + a 32 y + a 33 z = b 3 } \left. \begin{cases} a_{11}x+a_{12}y+a_{13}z=b_1\\ a_{21}x+a_{22}y+a_{23}z=b_2\\ a_{31}x+a_{32}y+a_{33}z=b_3\\ \end{cases} \right\} ⎩ ⎨ ⎧a11x+a12y+a13z=b1a21x+a22y+a23z=b2a31x+a32y+a33z=b3⎭ ⎬ ⎫
语法
$$
\left.
\begin{cases}
a_{11}x+a_{12}y+a_{13}z=b_1\\
a_{21}x+a_{22}y+a_{23}z=b_2\\
a_{31}x+a_{32}y+a_{33}z=b_3\\
\end{cases}
\right\}
$$
如果只想要左括号,只需要去掉\left.和\right},保留中间部分即可,可参考下面分段方程的语法。
至于分段方程,可在每行元素之间用空格和&号连接。
分段方程呈现效果
y = { 0 x ≤ 0 x + 1 x > 0 y= \begin{cases} 0 & x\leq 0\\ x + 1 & x> 0 \end{cases} y={0x+1x≤0x>0
语法
$$y=
\begin{cases}
0 & x\leq 0\\
x + 1 & x> 0
\end{cases}
$$