latex matrix code example
Example 1: matrix latex
\begin{bmatrix}
1 & 2 & 3 \\
a & b & c \\
a & b & c \\
\end{bmatrix}
Example 2: matrix latex
\begin{equation*}
A_{m,n} =
\begin{pmatrix}
a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\
a_{2,1} & a_{2,2} & \cdots & a_{2,n} \\
\vdots & \vdots & \ddots & \vdots \\
a_{m,1} & a_{m,2} & \cdots & a_{m,n}
\end{pmatrix}
\end{equation*}
Example 3: latex pmatrix
Trying to typeset an inline matrix here
$\begin{pmatrix}
a & b\\
c & d
\end{pmatrix}$
but it looks too big, so let's try
$\big(\begin{smallmatrix}
a & b\\
c & d
\end{smallmatrix}\big)$
instead.
Example 4: how to make matrix latex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
$$
\begin{bmatrix}
a & b & c \\
c & d & d\\
e & f & g \\
\end{bmatrix}
\quad
$$
\end{document}
Example 5: how to write a matrix latex
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
M=
\begin{bmatrix}
1 & 2 & 3 & 4 & 5 \\
3 & 4 & 5 & 6 & 7
\end{bmatrix}
\]
\end{document}
Example 6: latex matrix
% Plain matrix
\begin{matrix}
1 & 2 & 3\\
a & b & c
\end{matrix}
% Parantheses matrix
\begin{pmatrix}
1 & 2 & 3\\
a & b & c
\end{pmatrix}
% Square bracket matrix
\begin{bmatrix}
1 & 2 & 3\\
a & b & c
\end{bmatrix}
% Braces matrix (curly brackets matrix)
\begin{Bmatrix}
1 & 2 & 3\\
a & b & c
\end{Bmatrix}
% Pipes
\begin{vmatrix}
1 & 2 & 3\\
a & b & c
\end{vmatrix}
% Double pipes
\begin{Vmatrix}
1 & 2 & 3\\
a & b & c
\end{Vmatrix}