# How to find the number of turn from bottom left to top right of 8 by 8 grid

Suppose you want to go from bottom left to top right on an 8 by 8 rectangular grid. Which you were only allowed to move right or up direction. Let $P(X=k)$ where $k$ is the number of turns.

For example if the sequence is UUUUUUUURRRRRRRR there is only 1 turn

Question: given $k$, find $P(X=k)$ for any number of $k$

P.S. My friend told me to use stars and bars technique. But I did not get the reason behind that

• Um, are you aware you haven't actually asked a question? – fleablood Feb 26 '17 at 3:22
• So P (k) is the set of paths? The number of paths? Stars and bars makes sense. The last turn must be in the last row or column. The second to last anywhere between the last turn and the las. The third between those. The first turn i can be anywhere between row 1 and 8 -k, 2 can be anywhere tween I and 8-k, and so on. – fleablood Feb 26 '17 at 3:39
• P(X=k) is a number of path with k turns. And the last turn does not have to be in thelast row or column. – Wakeme UpNow Feb 26 '17 at 3:41
• My friend gave me that P(X=k) = 2*(7C((k-1)/2))^2 where k is odd number and k > 0, P(X=k) = 2*(7C(k/2))(7C(k/2 -1)) where k is even and k > 0, P(X=k) = 0 otherwise – Wakeme UpNow Feb 26 '17 at 4:21