is there a way to get binomial coefficients to appear inside a piecewise function? This is the code I am using right now:
$$ a(n,3)=%
\begin{cases}
$ 1 {{k+2}\choose{2}} + 4 {{k+1}\choose{2}} + 1 {{k}\choose{2}}$ &\text{if $n\equiv0$ $\mod d$} \\
$ 1 {{k+2}\choose{2}} + 5 {{k+1}\choose{2}} $ &\text{if $n\equiv1$ $\mod d$} \\
$ 2 {{k+2}\choose{2}} + 4 {{k+1}\choose{2}} $ &\text{if $n\equiv d-1$ $\mod d$} \\
$ 3 {{k+2}\choose{2}} + 3 {{k+1}\choose{2}} $ &\text{if $n\equiv d-1$ $\mod d$} \\
$ 4 {{k+2}\choose{2}} + 2 {{k+1}\choose{2}} $ &\text{if $n\equiv d-1$ $\mod d$} \\
$ 5 {{k+2}\choose{2}} + 1 {{k+1}\choose{2}} $ &\text{if $n\equiv d-1$ $\mod d$} \\
\end{cases} $$
And This is the way that it is showing up.
I need it to say
$1({k+2}\choose{2}) + 4 ({k+1}\choose{2})$,
and so on. I've tried putting extra brackets, but it still won't fix the formatting.