1

In the general form of the stair climbing problem, you must find the number of ways to climb $n$ stairs in jumps taken from a fixed set of sizes.

In the answers I have seen, the solution is computed recursively. But it seems to me that this problem is similar to the classic balls and bins problem of computing the number of solutions to an equation of the form $x_1 + x_2 + \dots + x_m = n$, where each $x_i \ge 0$ and $n \ge 0$.

The solution to this balls and bins problem is ${n + m - 1}\choose{n}$.

Can this formulation be used to solve the stair-climbing problem? That is, is the number of solutions to the stair climbing problem equal to the number of solutions to $a_1x_1 + \dots + a_mx_m = n$ ?

And is that number of solutions equal to ${n + a_1 + \dots + a_m - 1}\choose{n}$ ?

Why or why not?

2 Answers2

0

There are several differences here.

Note that in the balls and bins problem the only input data are $m$ and $n$, whereas for each instance of the stair climbing problem we are given $m$, $n$, and in addition a data vector $(a_1,a_2,\ldots, a_m)\in{\mathbb N}_{\geq1}^m$. This complicates matters and necessitates a recursive or generating functions approach whose complexity increases with $m$.

But even if all $a_i$ were $=1$ (think of parallel stairs of different colors) there remains a difference: We are not only interested in how many jumps of which sizes, but in the full climbing history. This means that $5+6+1+3+6+2$ is not considered the same as $2+6+6+1+5+3$.

0

a) " ... same as number of solutions to $x_{1}+\cdots+x_{m}=n$ "
It is so, but provided that the step size be unlimited, or however $\ge n$.
If the step size range is limited below, e.g. to $a$, then the formula above can be rearranged as $\cdots = n-ma$.

b) "... can this formulation be used ..."
No. If the steps are to be taken from the range $\{0,\cdots,r\}$, i.e. if we are looking for the $$N_{\,b} (s,r,m) = \text{No}\text{. of solutions to}\;\left\{ \begin{gathered} 0 \leqslant \text{integer }x_{\,j} \leqslant r \hfill \\ x_{\,1} + x_{\,2} + \cdots + x_{\,m} = s \hfill \\ \end{gathered} \right.$$ then the solution is given in this other post

c) if the steps are taken not from a continuous range $0$ to $r$ but from a set $\{a_{1},\cdots,a_{m}\}$, i.e. if we are looking for $$ {\rm No}{\rm .}\,{\rm of}\,{\rm solutions}\,{\rm to}\;\left\{ \matrix{ {\rm 0} \le {\rm integers}\;a_{\,j} ,x_{\,j} \hfill \cr a_{\,1} x_{\,1} + a_{\,2} x_{\,2} + \; \cdots \; + a_{\,m} x_{\,m} = s \hfill \cr} \right. $$ which also means the number of non-negative integer points on the $m$-D plane individuated by the (fixed) coefficients $a_{j}$ and by $s$ (your $n$) then the solution is quite complicated, and cannot be expressed by a simple formula.
Its solution relies on Bezout's Identity and involves the multiple application of the Euclidean algorithm.
It is also known as "Representation Problem": see for example this paper

G Cab
  • 35,272