If you count the ways of climbing 3 steps you will find that there are 4 ways of climbing 3 steps.Imagine that the person's legs are so long that they have capacity of climbing 11 steps at a time.Also the person is allowed only to climb upwards.
Then find the number of ways in which you can climb 11 steps?
Bonus : Generalize this for n steps.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Nice and easy solution! Should be obvious, and yet, I couldn't think of that...
In case someone didn't fully understand: for each step on the stairs, either you step on it or you don't (2 possibilites). Except for the last step (since you want to get there, you don't have the choice not to step on it).
I don't understand, why use 2?
Because there are two possibilities for each step: you either step on it or you don't i.e. do/don't, 2 options for each step except for the last one which, as the original poster stated, must be stepped on. Hope this helped :D
why can't we use 2^n - 1?
Another way of solving this is recursively. Let's call W ( x ) the number of ways of climbing x steps. There is only one way of climbing zero steps and one way of climbing one step. So, W ( 0 ) = W ( 1 ) = 1 .
Now, notice that if want to climb x steps, we can:
1) Move 1 step up. We now have to climb ( x − 1 ) steps. The number of ways is W ( x − 1 ) .
2) Move 2 steps up. We now have to climb ( x − 2 ) steps. The number of ways is W ( x − 2 ) .
...
x) Move x steps up, and we now have no steps left to climb. The number of ways is W ( 0 ) = 1
So, for x steps ( 2 < = x ) , we have:
W ( x ) = W ( x − 1 ) + W ( x − 2 ) + . . . + W ( 0 )
W ( x ) = ∑ k = 0 x − 1 W ( k )
Let's try to get rid of the sum:
W ( x ) = W ( x − 1 ) + ∑ k = 0 x − 2 W ( k )
W ( x ) = W ( x − 1 ) + W ( x − 1 )
W ( x ) = 2 ∗ W ( x − 1 )
Notice we keep multiplying by 2 until we get to W ( 1 ) = 1 . So, we multiply ( x − 1 ) times.
W ( x ) = 2 x − 1
W ( 1 1 ) = 2 1 0 = 1 0 2 4
May I know how you transform the sum in red into W( x - 1)??
Log in to reply
It's an application of the orange formula (which is justified in the text above it), but this time summing up to W ( x − 2 ) instead of W ( x − 1 ) .
Well, Nihar gave you the formula, But I would like to Explain How it works.
Here, There are 11 steps.
Now, Stepping on any of the first 10 steps is not compulsory, But it is compulsory for the 11th Step, Because it is where we have to climb to.So, There are 2 choices for the first 10 steps, But only 1 for the 11th.
Hence, By the rule of product, The number of ways to climb to the 11th Stair are:-
2 ∗ 2 ∗ 2 ∗ 2 ∗ 2 ∗ 2 ∗ 2 ∗ 2 ∗ 2 ∗ 2 ∗ 1 = 2 1 0 = 1 0 2 4 .
Generalization:- For n s t e p s Number of ways to climb to the n t h s t e p a r e 2 n − 1
Challenge student note: There is no point in posting the same solution as a separate solution . If you want to "Explain How the solution works" you could have just added it as a comment to my solution.Thanks!
Well there is another way to think about this problem. Since for climbing 1 1 steps he has to choose 1 0 steps. He can therefore choose 0 or 1 or 2 or 3 .... and so so on till 10 or (n-1). So the sum is ( 0 n − 1 ) + ( 1 n − 1 ) + ( 2 n − 1 ) ... ( n − 1 n − 1 ) . This sums up to 2 n − 1 . This is a much more difficult solution though.
Problem Loading...
Note Loading...
Set Loading...
A person has to climb the n t h step compulsory.But the person on first n − 1 steps steps on it or does not step on it.Hence there are 2 possibilities for every step of the n − 1 steps.
So by product rule, total ways = 2 n − 1 .
Here n = 1 1 , hence total ways = 2 1 1 − 1 = 2 1 0 = 1 0 2 4