[Math] Number of paths in a rectangle from top left corner to bottom right corner

combinatorics

Given a rectangle of heigh $H$ and width $W$, a smaller rectangle of height $A$ and width $B$ is cut out from the top-right corner of the rectangle.
$H,W,A,B \subset I$. $I$ denotes the set of integers.

Assume this figure to be tiled evenly with squares of dimension $1X1$.

We are supposed to find the number of ways of going from the top-left corner of the figure to the right-bottom corner of the figure.

Some steps of my approach:

First I found the total number of ways to reach the bottom-right corner for the original rectangle, which is $C(H+W,H)$.

Now, I am unable to figure how exactly I must subtract the number of ways for the cut-out area from the number of ways for the original rectangle.

How do I find the total no. of required ways here?

Image is just for illustration

The image is just for a fair idea about how the figure looks like after cutting out the smaller rectangle.

Best Answer

I am assuming that you can only move down and right.

So label the inner corner, say $A_1 = (W-B,H-A)$, and count off $A_2 = (W-B-1,H-A-1)$, $A_3 = (W-B-2,H-A-2)$, until $A_k = (W-B-k, H-A-k)$, where $k = \min\{W-B,H-A\}$. Then, all your desired paths from top left corner $(0,H)$ to bottom right corner $(W,0)$ must pass through exactly one $A_i$ for some $i$. So, we want to count the number of paths from top left corner to $A_i$ and from $A_i$ to bottom right corner, multiply the two numbers (the product signifies the number of paths through $A_i$), and sum over $i$ to get the desired answer.