I have $N$ bank account and $B$ USD savings. For $i$ in $1, 2, 3, ..., N$, the balance of bank account $i$, denoted as $b_i$, is subject to the constraint of $l_i\leq b_i \leq u_i$. The 1-year interest rate of account $i$ is $r_i$.


  • $N$, $B$, $l_i$, $u_i$ and $r_i$ are known constants.
  • The minimum incremental unit of $b_i$ is 1 cent.
  • The balance can be either credit or debit, i.e., $b_i$ can be either negative or positive as long as it satisfies the constraint.
  • $r_i$ is the interest rate for both borrowing and lending.
  • $\sum_{i=1}^N b_i = B$.
  • $\sum_{i=1}^N l_i <= B$.
  • $\sum_{i=1}^N u_i >= B$.


  1. How many possible ways are there to allocate my savings into the $N$ accounts? Or equivalently, how many different possible combinations of $b_i$ are there?
  2. Suppose the distribution of different possible combinations of $b_i$ is a uniform distribution. Define a random variable $R = \sum_{i=1}^N r_i\frac{b_i}{B}$. So $R$ is the 1-year return of my savings. What does the distribution of $R$ look like? What is the mean and variance of $R$?
  • $\begingroup$ What has been tried ? $\endgroup$
    – user645636
    Commented Mar 14, 2019 at 15:50
  • $\begingroup$ I think my problem is a derivation of the "put balls in box" problem: math.stackexchange.com/questions/1441170/…. I am trying to solve a more complicated version of the "put balls in box" problem, which puts constraints on the number of balls a box can hold. I have not got any clues so far. $\endgroup$
    – GoCurry
    Commented Mar 15, 2019 at 15:36


You must log in to answer this question.

Browse other questions tagged .