Let ai,bi for i=1,…,n be nonnegative numbers, and let n≥4 such that ∑i=1nai=∑i=1nbi>0.
We aim to find the maximum value of the expression:
∑i=1nbi(ai+bi)∑i=1nai(ai+bi).
We will prove that for n≥4, the maximum value is n−1.
Without loss of generality, we can assume a1≥a2≥⋯≥an and ∑i=1nai=∑i=1nbi=1. Let A=∑i=1nai2, B=∑i=1nbi2, and X=∑i=1naibi.
We define the function:
f(X)=B+XA+X.
The derivative of f(X) is:
f′(X)=(B+X)2B−A.
Since f′(X)<0 when A>B, we want to minimize X to maximize the fraction. By the rearrangement inequality, X is minimized when b1≤b2≤⋯≤bn.
Next, we fix b1,…,bn and define:
F(a1,…,an)=B+XA+X.
We will show that:
F(a1,a2,…,an)≤F(a1+a2,0,…,an).
This is true because a12+a22≤(a1+a2)2 and a1b1+a2b2≥(a1+a2)b1. By repeating this step n−1 times, we conclude:
F(a1,…,an)≤F(1,0,…,0).
It remains to prove:
F(1,0,…,0)=∑i=1nbi2+b11+b1≤n−1.
Using the Cauchy-Schwarz inequality, we get:
∑i=1nbi2+b11+b1≤b12+n−1(1−b1)2+b11+b1.
Finally, we need to show:
b12+n−1(1−b1)2+b11+b1≤n−1⇔b1(nb1+n−4)≥0.
This inequality clearly holds for n≥4.
Equality holds when a1=1, a2=⋯=an=0, and b1=0, b2=⋯=bn=n−11.
Thus, the maximum value of the given expression is:
∑i=1nbi(ai+bi)∑i=1nai(ai+bi)=n−1.
The answer is: \boxed{n - 1}.