How can a matrix be written in LaTeX? I have tried to use \begin{matrix}
but I need to write the matrix below and I cannot understand how to fill it up exactly as this.
1 Answer
MWE:
\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
Q =
\begin{pmatrix}
-(\lambda_1 + \mu_1) & \lambda_1 & 0 & \ldots & 0 & 0 \\
0 & -(\lambda_2 + \mu_2) & \lambda_2 & \ldots & 0 & 0 \\
\vdots & \vdots & \vdots & \ldots & 0 & 0 \\
0 & 0 & 0 & -(\lambda_{n-1} + \mu_{n-1}) & \lambda_{n-1} & \\
0 & 0 & 0 & \ldots & 0 & -\mu_n
\end{pmatrix}
\end{equation*}
\end{document}
-
Thanks! can you label such equation? since I did \label{2} before \end{equation} but nothing is showing Commented May 22, 2015 at 18:11
-
@user1930901 use the unstarred version:
\begin{equation}
, not\begin{equation*}
.– NullCommented May 22, 2015 at 18:13
\begin{matrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{matrix}
should work\begin{matrix}...\end{matrix}
, say $...$ or\(...\)
of course