<s>[INST] Number of ways to get from $(0, 0)$ to $(2, 2)$ in coordinates system I'm in point $\left(0, 0\right)$ of coordinates system:


*

*I want to konw how many ways are there to the point $(2, 2)$ in at most 6 steps.

*One step is moving up, down, left or right by one cell, so from
$\left(0, 0\right)$ in one step I can get to
$\left(0, 1\right), \left(1, 0\right), \left(-1, 0\right), \left(0, -1\right)$. 

*Of course, the minimum number of steps is $4$ and there are $6$ ways of length $4$. You can't get there in $5$ steps.

*What about ways of length exactly $6$ ?. How can I count them ?.

 [/INST] 
We can do the job algebraically. We encode steps in direction $E$ and $W$ by $x^1$ and $x^{-1}$ and similarly we encode steps in direction $N$ and $S$ by $y^1$ and $y^{-1}$.
We obtain the expression
  \begin{align*}
x^1+x^{-1}+y^{1}+y^{-1}\tag{1}
\end{align*}
  with the $+$ sign indicating the alternatives we have for each step.

Let's denote with $[x^j]$ the coefficient of $x^j$ in an expression. This way we can write e.g.
\begin{align*}
[x^2](1+x)^6=\binom{6}{2}
\end{align*}

Since one step is encoded by (1) and we are looking for the number of possibilities to go from $(0,0)$ to $(2,2)$      in $6$ steps, we have to look for the coefficient of
  \begin{align*}
[x^2y^2](x^1+x^{-1}+y^{1}+y^{-1})^6
\end{align*}

For example one of the paths  of length  $6$  from $(0,0)$ to $(2,2)$ is 
\begin{align*}
E.N.S.N.N.E \qquad \longleftrightarrow\qquad x^1y^1y^{-1}y^{1}y^{1}x^{1}=x^2y^2
\end{align*}

We obtain 
  \begin{align*}
[x^2y^2]&(x^1+x^{-1}+y^{1}+y^{-1})^6\\
&=[x^2y^2]\sum_{j=0}^6\binom{6}{j}\left(x+\frac{1}{x}\right)^j\left(y+\frac{1}{y}\right)^{6-j}\tag{2}\\
&=[x^2y^2]\binom{6}{2}\left(x+\frac{1}{x}\right)^2\left(y+\frac{1}{y}\right)^4\\
&\qquad+[x^2y^2]\binom{6}{4}\left(x+\frac{1}{x}\right)^4\left(y+\frac{1}{y}\right)^2\tag{3}\\
&=[x^2y^2]\left(\binom{6}{2}\binom{2}{0}x^2\binom{4}{1}y^2+\binom{6}{4}\binom{4}{1}x^2\binom{2}{0}y^2\right)\tag{4}\\
&=\binom{6}{2}\cdot 4+\binom{6}{4}\cdot 4\\
&=120
\end{align*}
  and  conclude there are $120$ different paths to go from $(0,0)$ to $(2,2)$ in $6$ steps using steps $(1,0),(-1,0),(0,1)$ and $(0,-1)$.

Comment:


*

*In (2) we group the polynomial $(x^1+x^{-1}+y^{1}+y^{-1})^6=\left(\left(x+\frac{1}{x}\right)+\left(y+\frac{1}{y}\right)\right)^6$ and apply the binomial theorem.

*In (3) we observe only $j=2$ and $j=4$ provide a contribution to $[x^2y^2]$.

*In (4) we select the coefficients of $[x^2y^2]$.
</s>