[Tex/LaTex] Begin Array in LaTex

equations

enter image description here

Tried the equation in the image below with the following codes, but was encountering errors. Please can anybody be kind enough to help. Thanks.

\begin{array}
{p^'}_0\left( t \right) =  - \lambda {p_0}\left( t \right) + \mu {p_1}\left( t \right),\\
{p^'}_j\left( t \right) = \lambda {p_{j - 1}}\left( t \right) - \left( {\lambda  + j\mu } \right){p_j}\left( t \right) + \mu \left( {j + 1} \right){p_{j + 1}}\left( t \right)
\end{array}

Best Answer

there are several problems with the code used:

  • array must be inside a math environment; this could be fixed by enclosing it in \[ ... \]

  • the alignment within the array must be specified; for this, \begin{array}{l} would work.

  • the primes (input as apostrophes) are defined to be superscripts, so the explicit ^ is unwanted.

  • the \left ... \right for the parentheses isn't needed anywhere, since everything within them is "normal" size

  • extra grouping with braces isn't needed except around the multi-element subscripts

it would be equally appropriate, and perhaps simpler, to use the align* environment from amsmath:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
p'_0 (t) &= -\lambda p_0 (t) + \mu p_1 (t),\\
p'_j (t) &=  \lambda p_{j-1} (t) - (\lambda + j\mu) p_j (t) + \mu (j+1) p_{j+1} (t)
\end{align*}
\end{document}

output of example code