Block walking and counting subsets A Delanoy path in the fir
(Block walking and counting subsets) A Delanoy path in the first quadrant is a walk that uses any of 3 kinds of steps: Up (0,1), Right (1,0), and Diagonal (1,1) . Let D(x,y) be the number of Delanoy paths from (0,0) to (x,y)
a) Find a recurrence relations that give D(x,y) in terms of a smaller values.
b) Find the number of Delannoy paths from (0,0) to (7,3).
c) Find a formula for D(n,1), where n is any whole number.
Solution
a) When at point (x,y) we can reach it from (x-1,y) by going to the right
from (x,y-1) by going up
from (x-1,y-1) by going diagonally
Assuming, x>=1,y>=1
So,
D(x,y)=D(x-1,y)+D(x,y-1)+D(x-1,y-1) ,x>=1,y>=1
If x=0,y>=1 ie we are on the y axis so there is only one way to get there just going up and up from origin
D(0,y)=1
If y=0,x>=1 we are on x axis so there is only one way to get there by going only right
D(x,0)=1
b)
D(7,3)
=D(6,3)+D(7,2)+D(6,2)
=D(6,2)+D(5,3)+D(5,2)+D(6,2)+D(6,1)+D(7,1)+D(5,1)+D(5,2)+D(6,1)
=D(7,1)+2D(6,2)+2D(6,1)+D(5,3)+2D(5,2)+D(5,1)
=D(7,0)+D(6,0)+2D(6,2)+3D(6,1)+D(5,3)+2D(5,2)+D(5,1)
=2+5D(6,1)+D(5,3)+4D(5,2)+3D(5,1)
=2+5D(6,0)+5D(5,0)+D(5,3)+4D(5,2)+8D(5,1)
=12+D(4,2)+D(4,3)+5D(5,2)+8D(5,1)
=12+8D(5,0)+8D(4,0)+8D(4,1)+D(4,2)+D(4,3)+5D(5,2)
=28+5D(5,1)+13D(4,1)+6D(4,2)+D(4,3)
=28+5D(4,0)+5D(5,0)+18D(4,1)+6D(4,2)+D(4,3)
=38+18D(3,0)+18D(4,0)+18D(3,1)+7D(4,2)+D(3,3)+D(3,2)
=74+18D(3,0)+18D(2,0)+18D(2,1)+7D(4,2)+D(3,3)+D(3,2)
=110+18D(1,0)+18D(2,0)+18D(1,1)+7D(4,2)+D(3,3)+D(3,2)
=110+18+18+18*3+7D(4,2)+D(3,3)+D(3,2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