Ways to go from A to B(advanced) We know that the ways to go from A to B in a $m×n$ rectangle is $\frac{(m+n)!}{m!n!}$.
then find ways to go from $A$ to $B$ just by using this formula.(shortest way)
 
My Attempt:I calculated the $4*4$ square ways there are 70 ways now we should reduce the ways that should'nt calculated.Can you help me please??
 A: I don't think it pays to set up complicated combinatorial processes to solve this. Doing it by hand I found $N=26$ in less than a minute.
Write a $1$ next to $A$. Now successively find the numbers for the other vertices according to the following rule: The number at $x$ is the sum of the numbers at the vertex immediately to the left of $x$ (if there is such a vertex) and at the vertex immediately below $x$ (if there is such a vertex).
A: Four edges are missing, so we have four restrictions for the path not to use one of them, and we want to count the paths that violate no restriction. There are $\binom{4+4}4=70$ ways to violate $0$ particular restrictions. There are $\binom{3+2}2+\binom{3+2}2+\binom{3+3}3+\binom{2+1}1\binom{2+2}2=10+10+20+18=58$ ways to violate $1$ particular restriction. Of the six pairs of restrictions, two can't be violated simultaneously, and the remaining four can be violated in $\binom{1+1}1+\binom{2+1}1+\binom{2+1}1+\binom{2+1}1\binom{1+1}1=14$ ways. There's no way to use three or four of the edges in one path, so that's it, and by inclusion-exclusion there are $70-58+14=26$ paths that use none of the missing edges.
A: You can decompose your rectangle. I note the point with coordinates, $A=(0,0)$ and $B=(4,4)$, first coordinate is horizontal. I note $N(x_1,..,x_n,\neg y_1, .., \neg y_m)$ the number of paths that go through all the $x_i$ but don't go through the $y_i$.
Since any shortest path going through $(2,0)$ or $(2,1)$ will go through $(3,1)$ or $(4,1)$, we have
$N=N((4,1)) + N((3,1),\neg (4,1)) + N(\neg (2,0),\neg (2,1))$
$N((4,1))=\frac{5!}{4!1!}=5$ according to your formula, since once we are in $(4,1)$, there is only one way to go to $B$
Since $(3,2)$ is the only one node after $(3,1)$ that is not $(4,1)$, and there are only two distinct path from $(3,2)$, we have
$N((3,1),\neg (3,1)) = N((3,2),\neg (2,2)) = N((3,2),(3,4))+N((3,2),(4,2))=2 \times \frac{4!}{3!1!}=8$.
Now, note that $N(\neg (2,0), \neg (2,1)) = N((1,1),\neg (2,1)) + N((0,2))$...
I'm a rather lazy guy, so I won't finish this, it is quit exhaustive.
I think, (by calculating the rest mentally) it is $N=25$, but you need to do the complete thing in order to be sure.
Rq : I think you can do a similar reasoning with edges instead of point, it may be faster.
