a combinatorial exercise The problem asks us to calculate:
$$ \sum_{i = 0}^{n}(-1)^i \binom{n}{i} \binom{n}{n-i}$$
The way I tried solving is:  
The given sum is the coefficient of $x^n$ in $ (1+x)^n(1-x)^n $, which is $ (1 - x^2)^n $.
The coefficient of $x^n$ in $(1 -x^2)^n$ is $$ (-1)^{n/2} \binom{n}{n/2}. $$
Am I doing it right?
 A: Your solution is correct for even $n$.
If $n$ is odd then your last sentence should read "The coefficient of $x^n$ in $(1-x^2)^n$ is $0$." This is because only even powers of $x$ occur when expanding $(1-x^2)^n$.
A: $\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\iff}{\Leftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\, #2 \,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$
\begin{align}
&\color{#f00}{\sum_{k = 0}^{n}\pars{-1}^{k}{n \choose k}{n \choose n - k}} =
\sum_{k = 0}^{n}\pars{-1}^{k}{n \choose k}\ \overbrace{%
\oint_{\verts{z} = 1^{-}}{\pars{1 + z}^{n} \over z^{n - k + 1}}
\,{\dd z \over 2\pi\ic}}^{\ds{=\ {n \choose n - k}}} 
\\[3mm] = &\
\oint_{\verts{z} = 1^{-}}{\pars{1 + z}^{n} \over z^{n + 1}}\
\overbrace{\sum_{k = 0}^{n}{n \choose k}\pars{-z}^{k}}
^{\ds{=\ \pars{1 - z}^{n}}}\
\,{\dd z \over 2\pi\ic} =
\oint_{\verts{z} = 1^{-}}{\pars{1 - z^{2}}^{n} \over z^{n + 1}}
\,{\dd z \over 2\pi\ic}
\\[3mm] = &\
\sum_{k = 0}^{n}{n \choose k}\pars{-1}^{k}\ \underbrace{%
\oint_{\verts{z} = 1^{-}}{1 \over z^{n - 2k + 1}}}_{\ds{=\ \delta_{n,2k}}}
\,{\dd z \over 2\pi\ic} =
\color{#f00}{\left\lbrace\begin{array}{lcl}
\ds{\pars{-1}^{n/2}{n \choose n/2}} & \mbox{if} & \ds{n}\ \mbox{is}\ even
\\[2mm]
\ds{0} && \mbox{otherwise}
\end{array}\right.}
\end{align}
