Combinatorial Proof for $\sum_{k=0}^n \binom{2n}{2k}^2 = \frac{1}{2}\left( \binom{4n}{2n}+(-1)^n \binom{2n}{n} \right)$

For context I am trying to prove the four identities:

$$\sum_{k\,\mathrm{even}} \binom{n}{k}^2 = \begin{cases} \frac{1}{2}\left( \binom{2n}{n}+(-1)^{n/2} \binom{n}{n/2} \right)\quad\mathrm{for}\,n\,\mathrm{even} \\ \frac{1}{2}\binom{2n}{n}\quad\mathrm{for}\,n\,\mathrm{odd}\end{cases}$$ $$\sum_{k\,\mathrm{odd}} \binom{n}{k}^2 = \begin{cases} \frac{1}{2}\left( \binom{2n}{n}-(-1)^{n/2} \binom{n}{n/2} \right)\quad\mathrm{for}\,n\,\mathrm{even} \\ \frac{1}{2}\binom{2n}{n}\quad\mathrm{for}\,n\,\mathrm{odd}\end{cases}$$

The cases for $n$ odd are easy, since it can be interpreted as choosing a subset of $n$ coins from a bag of $n$ gold and $n$ silver coins, and demanding a fixed parity of the gold (and hence) silver coins, and observing that each possible choice of $n$ coins maps onto the choice of the complementary set of $n$ coins when the parity is fixed to be the other choice.

No such simple bijection exists for the case where $n$ is even, so I am not sure how to modify the scenario to yield a double counting solution to the problem.

I am open to a solution that involves counting paths on a square lattice of size $n$.


Choose a subset of $n$ coins from a bag of $n$ gold coins $g_1, \dotsc, g_n$ and $n$ silver coins $s_1, \dotsc, s_n$. Of the $\binom{2n}{n}$ ways to do this, there are $\binom nk^2$ ways such that you got $k$ gold coins and $n - k$ silver coins.

$$\sum_{\text{$k$ even}} \binom nk^2 + \sum_{\text{$k$ odd}} \binom nk^2 = \binom{2n}{n}.$$

Try to transform your choice as follows: let $i$ be the smallest index such that you chose exactly one of $g_i$ or $s_i$, and swap it for the other one instead. This transformation is self-inverse, and toggles the parity of $k$. The only exception is if there is no such index, because your gold choices were identical to your silver choices—which requires $n = 2k$, and can then happen in $\binom{n}{n/2}$ ways.

$$\sum_{\text{$k$ even}} \binom nk^2 - \sum_{\text{$k$ odd}} \binom nk^2 = \begin{cases}(-1)^{n/2}\binom{n}{n/2} & \text{for $n$ even} \\ 0 & \text{for $n$ odd}.\end{cases}$$

The identities follow.