# multi line equation with cases

I want to write the above equation I tried

\begin{align}
d(0,0) &= e(0,0) \\
d(0,j) &= e(0,j) + d(0,j-1)        \text{$j = 1,2,..., N_\tau -1$}\\
d(i,0) &= e(i,0)               \text{$i = 1,2,..., N_t -1$}\\
d(1,j) &= e(1,j) +  \begin{cases}
d(0,j)      \\
d(0,j-1)    & \text{$j = 1,2,..., N_\tau -1$}\\
d(1,j-1))
\end{cases} \\

d(i,1) &= e(i,1) + \begin{cases}
d(i,0)\\
d(i-1,0)  & \text{$i = 1,2,..., N_t -1$}\\
d(i-1,1))
\end{cases}        \\

d(i,j) &= e(i,j) + \begin{cases}
d(i-1,j-1)\\
d(i-1,j-2) + e(i,j-1)   &  \text{$i > 1$ and $j > 1$}\\
d(i-2, j-1) + e(i-1,j)

\end{cases}
\end{align}


but I didn't work ... I want a multi line equation with labeling

THank you

• Welcome. Apart from the fact that you are using blank lines, which are not allowed ... I don't understand the problem. Commented Jun 12, 2016 at 14:42

See, if the following result ids what you looking for:

\documentclass{article}
\usepackage{mathtools}
\usepackage{geometry}

\begin{document}
\begin{align}
d(0,0) & = e(0,0)                                           \\
d(0,j) & = e(0,j) + d(0,j-1);\quad  j = 1,2,\dots, N_\tau -1  \\
d(i,0) & = e(i,0)           ;\quad  i = 1,2,\dots, N_t -1     \\
%
d(1,j) & = e(1,j) + \begin{cases}
d(0,j)      &                           \\
d(0,j-1)    & j = 1,2,\dots, N_\tau -1    \\
d(1,j-1))   &
\end{cases}                             \\
d(i,1) & = e(i,1) + \begin{cases}
d(i,0)      &                       \\
d(i-1,0)    & i = 1,2,\dots, N_t -1   \\
d(i-1,1))   &
\end{cases}                             \\
d(i,j) & = e(i,j) + \begin{cases}
d(i-1,j-1)              &                           \\
d(i-1,j-2) + e(i,j-1)   & i > 1 \text{ and } j > 1  \\
d(i-2, j-1) + e(i-1,j)  &
\end{cases}
\end{align}
\end{document}


Your MWE is unnecessary complicated, but in the same time there are missing ampersands and as say johannes-b in his comments, not allowed empty lines ...

• Would you mind changing the dots to \dots? Commented Jun 12, 2016 at 14:50

Usage of \nonumber before \\ produce the output what you are seeking:

\documentclass{article}
\usepackage{mathtools}
\usepackage{geometry}

\begin{document}
\begin{align}
d(0,0) & = e(0,0)                                           \nonumber\\
d(0,j) & = e(0,j) + d(0,j-1);\quad  j = 1,2,\dots, N_\tau -1  \nonumber\\
d(i,0) & = e(i,0)           ;\quad  i = 1,2,\dots, N_t -1     \nonumber\\
%
d(1,j) & = e(1,j) + \begin{cases}
d(0,j)      &                           \\
d(0,j-1)    & j = 1,2,\dots, N_\tau -1    \\
d(1,j-1))   &
\end{cases}                             \nonumber\\
d(i,1) & = e(i,1) + \begin{cases}
d(i,0)      &                       \\
d(i-1,0)    & i = 1,2,\dots, N_t -1   \\
d(i-1,1))   &
\end{cases}                             \nonumber\\
d(i,j) & = e(i,j) + \begin{cases}
d(i-1,j-1)              &                           \\
d(i-1,j-2) + e(i,j-1)   & i > 1 \text{ and } j > 1  \\
d(i-2, j-1) + e(i-1,j)  &
\end{cases}
\end{align}
\end{document}

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{align}
\begin{aligned}
d(0,0) & = e(0,0)                                           \\
d(0,j) & = e(0,j) + d(0,j-1);\quad  j = 1,2,\dots, N_\tau -1\\
d(i,0) & = e(i,0)           ;\quad  i = 1,2,\dots, N_t -1   \\
%
d(1,j) & = e(1,j) + \begin{cases}
d(0,j)      &                           \\
d(0,j-1)    & j = 1,2,\dots, N_\tau -1    \\
d(1,j-1))   &
\end{cases}                             \\
d(i,1) & = e(i,1) + \begin{cases}
d(i,0)      &                       \\
d(i-1,0)    & i = 1,2,\dots, N_t -1   \\
d(i-1,1))   &
\end{cases}                             \\
d(i,j) & = e(i,j) + \begin{cases}
d(i-1,j-1)              &                           \\
d(i-1,j-2) + e(i,j-1)   & i > 1 \text{ and } j > 1  \\
d(i-2, j-1) + e(i-1,j)  &
\end{cases}
\end{aligned}
\end{align}
\end{document}


For every line where you do not want a number add a \nonumber before the \\. It should remove the numbers.