# Optimisation Problem over binomial coefficients

I have 4 variables.

$$A= l{nq\choose l} {n(1-q)\choose n(1-q)-np+l}$$

$$B=(np-l){nq\choose l} {n(1-q)\choose n(1-q)-np+l}$$

$$C=(nq-l){nq\choose l} {n(1-q)\choose n(1-q)-np+l}$$

$$D=(n(1-q)-np+l){nq\choose l} {n(1-q)\choose n(1-q)-np+l}$$

$$l$$ goes from $$0$$ to $$np$$, $$p$$ and $$q$$ are probabilities. So for example, $$p=0.2, q=0.6, n=15$$, we have $$np=3, nq=9,n(1-q)=6,n(1-p)=12$$.Also $$np. When $$np,nq,n(1-p), n(1-q)$$ are fractions they are rounded off to their nearest whole number.

How can we optimise $$A,B,C,D$$ with respect to $$l$$ such that they try to attain their maximum value?

• Please show us what code you have tried. Commented Jun 16, 2020 at 14:48
• Is there some reason to believe they all simultaneously can be maximized? Or is the goal to find values for l that maximize any one of them? Commented Jun 16, 2020 at 15:10
• We need to optimise ABCD. Doesnt mean they have to be all be maximised. They should try to be "maximum" if that makes any sense. Commented Jun 16, 2020 at 15:31

## 1 Answer

p = 0.2; q = 0.6; n = 15;
a = l*Binomial[n q, l] Binomial[n (1 - q), n (1 - q) - n p + l];
b = (n p - l) Binomial[n q, l] Binomial[n (1 - q), n (1 - q) - n p + l];
c = (n q - l) Binomial[n q, l] Binomial[n (1 - q), n (1 - q) - n p + l];
d = (n (1 - q) - n p + l) Binomial[n q, l] Binomial[n (1 - q), n (1 - q) - n p + l];

(* maximize for each individually *)
NMaximize[{a, 0 < l <= n*p}, l]
NMaximize[{b, 0 < l <= n*p}, l]
NMaximize[{c, 0 < l <= n*p}, l]
NMaximize[{d, 0 < l <= n*p}, l]

(* maximize the product abcd *)
NMaximize[{a*b*c*d, 0 < l <= n*p}, l]
(* maximize the sum a+b+c+d *)
NMaximize[{a + b + c + d, 0 < l <= n*p}, l]
(* maximize the minimum *)
NMaximize[{Min[a, b, c, d], 0 < l <= n*p}, l]

• I did something similar to this except that I took only the product and optimised it. I have two questions here though. Taking the sum and the product is that enough? Also, I wanted a general result. Not for a specific p, q and n. How do I do this? Commented Jun 16, 2020 at 15:07
• You could maximize the minimum instead of the sum or product. A general result is not possible. Commented Jun 16, 2020 at 15:18