[Tex/LaTex] multi line equation with cases

equations

enter image description here

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

Best Answer

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

enter image description here

\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 ...