Number of ternary sequences of length $n$ with same number of $1$'s and $0$'s My attempt is considering the number of $1$'s to be $k$ then for each $k$ we choose choose the inner order of the $1$'s and $0$'s which has ${2k \choose k }$ options then choosing the indices of the $2$'s which has ${ n \choose n -2k } = { n \choose 2k }$. So if we sum for each $k$ we get:
$\sum_{k=0}^{\left \lfloor \frac{n}{2} \right \rfloor} {2k \choose k }{ n \choose 2k } = \sum_{k=0}^{\left \lfloor \frac{n}{2} \right \rfloor} \frac{(2k)!}{k!k!} \frac{n!}{(2k)!(n-2k)!} = \sum_{k=0}^{\left \lfloor \frac{n}{2} \right \rfloor} \frac{n!}{k!k!(n-2k)!} $
The problem is that this doesn't add up to a nice closed form, any idea how to get a nice closed form from here or by any other method?

We find using OPs approach
\begin{align*}
\color{blue}{\sum_{k=0}^{\left\lfloor\frac{n}{2}\right\rfloor}\binom{2k}{k}\binom{n}{2k}}
&=\sum_{k=0}^{\left\lfloor\frac{n}{2}\right\rfloor}\frac{n!}{k!k!(n-2k)!}=\sum_{k=0}^{\left\lfloor\frac{n}{2}\right\rfloor}\frac{n!}{k!(n-k)!}\,\frac{(n-k)!}{k!(n-2k)!}\\
&\color{blue}{=\sum_{k=0}^{\left\lfloor\frac{n}{2}\right\rfloor}\binom{n}{k}\binom{n-k}{k}}\tag{1}
\end{align*}

In the following we use the coefficient of operator $[z^n]$ to denote the coefficient of $z^n$ of a series. We obtain from (1)
\begin{align*}
\color{blue}{\sum_{k=0}^{\left\lfloor\frac{n}{2}\right\rfloor}\binom{n}{k}\binom{n-k}{k}}
&=\sum_{k=0}^n\binom{n}{k}[z^k](1+z)^{n-k}\tag{2}\\
&=[z^0](1+z)^n\sum_{k=0}^n\binom{n}{k}\left(\frac{1}{z(1+z)}\right)^k\tag{3}\\
&=[z^0](1+z)^n\left(1+\frac{1}{z(1+z)}\right)^n\tag{4}\\
&\,\,\color{blue}{=[z^n]\left(1+z+z^2\right)^n}\tag{5}
\end{align*}
and observe (1) is a representation of the central trinomial coefficients (5).

Comment:

*

*In (2) we use the coefficient of operator $[z^k](1+z)^{n-k}=[z^k]\sum_{j=0}^{n-k}\binom{n-k}{j}z^j=\binom{n-k}{k}$.


*In (3) we factor out terms independent from $k$ and use the rule $[z^{p-q}]A(z)=[z^p]z^qA(z)$.


*In (4) we apply the binomial theorem.


*In (5) we simplify and  apply the rule stated in (3) again.
The following notes from the experts show there is  no closed form available for the  central trinomial coefficients:

D.E. Knuth gives in Concrete Mathematics, Appendix A 7.56 the following representation of a more general expression
\begin{align*}
[z^n](a+bz+cz^2)^n=[z^n]\frac{1}{\sqrt{1-2bz+(b^2-4ac)z^2}}\tag{6}
\end{align*}
He states that according to the paper Hypergeometric Solutions of Linear Recurrences with Polynomial Coeffcients by Marko Petkovšek there exists a closed form (more precisely: a closed form solution as a finite sum of hypergeometric terms) if and only if
$$\color{blue}{abc(b^2-4ac)=0}$$
In case of central trinomial coefficients we have $a=b=c=1$. Since then the expression $abc(b^2-4ac)=-3\ne 0$
there is no such closed form in particular for the central trinomial coefficients.

Note: Some might be interested how to obtain the right-hand side expression of (6). This can be done e.g. by a clever change of variables stated as rule 5 in section 1.2 of Integral Representation and the Computation of Combinatorial Sums by G. P. Egorychev. Rule 5 adapted for this special case is:
\begin{align*}
[z^n]f^{n}(z)
&=[y^n]\left.\frac{f(z)}{f(z)-zf^{\prime}(z)}\right|_{z=g(y)}\tag{7}
\end{align*}
Here we have $f(z)=1+z+z^2$ and $g=g(y)$ is the inverse function of
\begin{align*}
\frac{z}{f(z)}=\frac{z}{1+z+z^2}=y
\end{align*}
We obtain
\begin{align*}
yz^2&+(y-1)z+y=0\\
z&=\frac{1}{2y}\left(1-y\pm\sqrt{1-2y-3y^2}\right)\tag{8}
\end{align*}
We take from (8) the root $z$ with the minus sign, since this one represents a power series.

We obtain from (5), (7) and (8)
\begin{align*}
\color{blue}{[z^n]}&\color{blue}{\left(1+z+z^2\right)^n}\\
&=[y^n]\left.\frac{1+z+z^2}{1+z+z^2-z(1+2z)}\right|_{z=\frac{1}{2y}\left(1-y-\sqrt{1-2y-3y^2}\right)}\\
&=[y^n]\left.\frac{1+z+z^2}{1-z^2}\right|_{z=\frac{1}{2y}\left(1-y-\sqrt{1-2y-3y^2}\right)}\\
&\,\,\color{blue}{=[y^n]\frac{1}{\sqrt{1-2y-3y^2}}}
\end{align*}
corresponding to the right-hand side of (6).

