TITLE: The number of closed paths in the square lattice $\mathbb{Z}^2$ with length $n$ and starting and ending points at $(0,0)$.
QUESTION [5 upvotes]: I'm thinking about this problem right now.
Problem:Consider a lattice point consisting of $\mathbb{Z}^2$ points.
If $n$ is even, i.e., $n=2p$, then
Show that the number of closed paths in the square lattice $\mathbb{Z}^2$ with length $n$ and starting and ending points at $(0,0)$ is $\binom{2p}{p}^2$.
I'm thinking about this problem right now.
The policy is consider four different ways of arranging the arrows: up, down, right, and left. In order to come back to the origin, the number of ups and downs must be the same, so if the number of ups and downs is $2s$ (but $s\in\mathbb{N}$, the number of ups and downs is $s$ each), then out of the total $2p$, we only need to choose $2s$, so $\binom{2p}{2s}$.
Furthermore, since there are $\binom{2s}{s}$ many ways to arrange up and down, and the same argument can be made for right and left, I thought the number of combinations in this case would be $\binom{2p}{2s}\binom{2s}{s}\binom{2p-2s}{p-s}$. (Note that the number of right and left can be expressed as $2p-2s$.)
I figured if I summed this over $s=0,1,\dots,p$, I would get the number of combinations I wanted.
Is this argument wrong?
Because no matter how I calculate this, the form I should be looking for is not $\binom{2p}{p}^2$.
I would like to know if this is the correct argument.

REPLY [4 votes]: For a closed path, let $A \subseteq [2p]$ be the set of steps at which we go either up or right and let $B \subseteq [2p]$ be the set of steps at which we go either down or right. The endpoint $(x,y)$ satisfies $x+y = |A| - (2p-|A|)$, so for a path that returns to $(0,0)$, we must have $|A|=p$; similarly, $|B|=p$.
Every closed path gives us a unique $A$ and $B$. Conversely, every $A$ and $B$ give us a unique closed path: on the $i^{\text{th}}$ step, the path goes up if $i \in A\setminus B$, down if $i \in B\setminus A$, right if $i \in A \cap B$, and left if $i \notin A \cup B$.
So the number of closed paths is equal to the number of ways to choose $A$ and $B$ independently: $\binom{2p}{p}^2$.

Another way to explain the same argument is to let $u=x+y$ and $v=x-y$, then think in $(u,v)$ coordinates rather than $(x,y)$ coordinates. Each step in the closed path changes $u$ by $\pm1$ and independently changes $v$ by $\pm1$.
In order to return from $u=v=0$ to $u=v=0$ after $2p$ steps, the $u$-steps and $v$-steps must be balanced ($p$ positive and $p$ negative steps for each). There are $\binom{2p}{p}$ ways to choose which steps increase $u$, and independently $\binom{2p}{p}$ ways to choose which steps increase $v$.