Prerequisites
- Lagrange Multipliers
- Derivatives: Specifically, product rule and derivative of xlogx.
- dxd(xlogx)=1⋅logx+x⋅x1=logx+1.
Solution
We maximize the objective function:
f({πj})=∑j=1Kπj(Nj−logπj)=∑j=1K(πjNj−πjlogπj)
Subject to:
∑j=1Kπj=1
L({πj},λ)=∑j=1K(πjNj−πjlogπj)+λ(∑j=1Kπj−1)
Step 2: Take derivatives and set to zero
Take the partial derivative with respect to a specific πj:
∂πj∂L=∂πj∂(πjNj)−∂πj∂(πjlogπj)+∂πj∂(λπj)
Using the product rule for πjlogπj:
∂πj∂(πjlogπj)=1⋅logπj+πj⋅πj1=logπj+1
Substituting back:
∂πj∂L=Nj−(logπj+1)+λ
Set to zero:
Nj−logπj−1+λ=0
Step 3: Solve for πj in terms of λ
Rearrange the equation to isolate logπj:
logπj=Nj−1+λ
Exponentiate both sides:
πj=exp(Nj−1+λ)
πj=exp(Nj)⋅exp(λ−1)
Step 4: Solve for the Lagrange multiplier term
Use the constraint ∑πj=1:
∑j=1K[exp(Nj)⋅exp(λ−1)]=1
Since exp(λ−1) does not depend on j, we can factor it out:
exp(λ−1)∑j=1Kexp(Nj)=1
Thus:
exp(λ−1)=∑k=1Kexp(Nk)1
Step 5: Substitute back to find πj
Multiply exp(Nj) by the factor we just found:
πj=exp(Nj)⋅∑k=1Kexp(Nk)1
πj=∑k=1KexpNkexpNj