Number of distinct closed paths in six steps. 
A person X standing at a point P on a flat plane starts walking. At each step, he walks exactly 1 foot in one of the directions North, South, East, or West. Suppose that after $6$ steps X comes to the original position P. Then the number of distinct paths that X can take is?

I'm ending up getting confused whenever I think about this. Let X start from $(0,0)$. A step consists of any 1 of the following moves: $1. (0,1), 2.(1,0), 3.(-1,0), 4.(0,-1)$. Assume he takes move $1$ $a$  times, move $2$ $b$ times, move $3$ $c$ times and move $4$ $d$ times. Now we have the following equations: $b-c=0, a-d=0$. Therefore $b=c$ and $a=d$. I don't know how to proceed from here. Please help.
 A: You might find it easier to label the moves $N,E,S,W$, so a path might look like $NNESWS$. You're effectively counting the number of six-letter strings where the number of $N$s is the same as the number of $S$s, and same for $E/W$.
To do this systematically: what if the movement is only North/South? In other words, how many ways can we arrange the letters $NNNSSS$?
The next case would be four North/South moves and two East/West: $NNSSEW$.
The next cases will have the same counts as above, by symmetry. (Swap all $N/S$ with $E/W$.)
A: This is a minor refinement on @Theophile's answer.
Any closed path must have the same number of $N$s and $S$s, and the same number of $E$s and $W$s.  So we can consider them in unordered pairs $(NS)$ and $(EW)$.  Any closed path must have just three pairs.  Call $k$ the number of $(NS)$ pairs.
Thus $0\leq k \leq 3$.  For each of these cases the number of $(EW)$ pairs is determined and is $3-k$.
For each $k$, you can determine the number of steps having the specified $k$ $N$s by ${6 \choose k}$ for the $N$, and the specified $k$ $S$s by ${6-k \choose k}$, and ${6 - 2k \choose (6-2k)}$ for the $E$, and ${6 - 2k - (2k) \choose (6-2k)}$ for the $W$.  (Of course only non-negative terms should be included.  Multiply these for a given $k$.
Now sum over all possible values of $k$.
