3

Assume Dana has 0 lemons, so Lena must have 1 lemon. Now all i need to distribute is

$$x_1 + x_2 = 99 \text{ // because Lena already has 1 and Dana has 0}$$

The answer to above is 100.

Now assume Dana has 1 Lemon. So Lena must have 2 Lemons and now all I need to distribute is

$$x_1+x_2 = 97 \text{ // because Lena has 2 and Dana has 1.}$$

the answer again to above is 98.

and it goes so on until 2. so i think the answer is : $2 + 4 + 6 + ... + 98 + 100$ which is 2550.

that was the answer i wrote in my exam... so, am I right?

Thomas Andrews
  • 177,126
Ohad
  • 101

2 Answers2

2

Here is another aproach to the problem:

By stars and bars there are $\binom{102}{2}$ ways to distribute the lemons, There are $51$ ways in which Lena and Dana get the same number of lemons (The number of lemons they have in total can be any even number between 0 and 100).

Therefore half of the remaining $\binom{102}{2}-51$ satisfy Dana has more lemons than Lena.

We get $\frac{\binom{102}{2}-51}{2}=2550$

Asinomás
  • 105,651
1

Alternatively, let $D, S$ and $L$ be the values, and let $L=D+1+L_0$. Then you want non-negative integer solutions to $1+D+S+L_0=100$, or $2D+S+L_0=99$.

You are doing $$\sum_{D=0}^{49} \sum_{S=0}^{99-2D} 1=\sum_{D=0}^{49} (100-2D)$$ which is a correct way to count this value.

A generating function solution would be to write it as seeking the coefficient of $99$ in the power series:

$$(1+x+x^2\cdots)^2(1+x^2+x^4\cdots) = \frac{1}{(1-x)^3(1+x)}$$

Then using partial fractions:

$$\frac{1}{(1-x)^3(1+x)} = \frac{a}{(1-x)^3} +\frac{b}{(1-x)^2} + \frac{c}{1-x} + \frac{d}{1+x}$$

Then you can get an exact formula for any number of lemons. Wolfram Alpha gives the values:

$$a=\frac{1}{2}, b=\frac{1}{4},c=\frac{1}{8},d=\frac{1}{8}$$

Then the number of ways to distribute $N$ lemon is the coeficient of $x^{N-1}$ which is:

$$\frac{1}{2}\binom{N+1}{2} + \frac{1}{4}\binom{N}{1} + \frac{1}8\left(1+(-1)^{N-1}\right)=\left\lceil\frac{(N+2)N}{4}\right\rceil$$

When $N$ is even, it is exactly $$\frac{N(N+2)}{4}=2\frac{\frac N2\left(\frac N2+1\right)}{2} = 2+4+6+\cdots+ N.$$ When $N$ is odd, we get $$\left(\frac{N+1}2\right)^2 = 1+3+5+\cdots + N$$

Again we get $2550$ when $N=100$.

Thomas Andrews
  • 177,126