2

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. enter image description here

5
  • \begin{matrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{matrix} should work
    – user31729
    May 22, 2015 at 17:57
  • Basic guidelines are at the LaTeX wiki.
    – DJP
    May 22, 2015 at 18:02
  • I have already seen those but I am getting a lot of missing $ etc May 22, 2015 at 18:03
  • @user1930901: You have to wrap a math environment around \begin{matrix}...\end{matrix}, say $...$ or \(...\) of course
    – user31729
    May 22, 2015 at 18:07
  • You can also use the pmatrix environment. May 22, 2015 at 18:10

1 Answer 1

5

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}

enter image description here

2
  • Thanks! can you label such equation? since I did \label{2} before \end{equation} but nothing is showing May 22, 2015 at 18:11
  • @user1930901 use the unstarred version: \begin{equation}, not \begin{equation*}.
    – Null
    May 22, 2015 at 18:13

This site is temporarily in read-only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .