Prerequisites
- Lagrange Multipliers: A method for finding the local maxima and minima of a function subject to equality constraints. For maximizing f(x) subject to g(x)=0, we construct the Lagrangian L(x,λ)=f(x)+λg(x) and set ∇L=0.
- Derivatives: Specifically, the derivative of log(x).
Solution
We want to maximize the objective function:
f({πj})=∑j=1KNjlogπj
Subject to the constraint:
∑j=1Kπj=1
We can rewrite the equality constraint as g({πj})=∑j=1Kπj−1=0.
Construct the Lagrangian function L({πj},λ):
L({πj},λ)=∑j=1KNjlogπj+λ(∑j=1Kπj−1)
Step 2: Take derivatives and set to zero
Take the partial derivative with respect to πj for any specific j∈{1,…,K}:
∂πj∂L=∂πj∂(Njlogπj)+∂πj∂(λπj)
∂πj∂L=πjNj+λ
Set the derivative to zero to find the stationary point:
πjNj+λ=0⟹Nj=−λπj⟹πj=−λNj
Step 3: Solve for the Lagrange multiplier λ
Use the constraint ∑j=1Kπj=1 by substituting the expression for πj:
∑j=1K(−λNj)=1
−λ1∑j=1KNj=1
Solving for λ:
λ=−∑j=1KNj
Let N=∑k=1KNk denote the total count. Then λ=−N.
Step 4: Substitute λ back to find πj
Substitute λ=−∑k=1KNk back into the equation πj=−λNj:
πj=−−∑k=1KNkNj=∑k=1KNkNj
Thus, we have shown that the solution is:
πj=∑k=1KNkNj