0
$\begingroup$

I'm trying to calculate the derivative with respect to $p1$, $p2$, ... $pk$ (each) of the following equation: $L = N_1 \log p_1 + N_2 \log p_2 + ... N_k \log p_k$

where $\Sigma_{i=1}^k p_i = 1$

i.e. I need to find $\partial L / \partial p_i$ for $i = 1, 2, ... k$

Since all the $p_i$'s are interdependent, how do I calculate the derivative? With k=2 it is possible to write $p_1 = p$ and $p_2 = 1 - p$, and differentiate with respect to $p$ but how do I do it for the general case?

Note: the $N_i$'s are constants

$\endgroup$
  • $\begingroup$ You could try Lagrange multipliers $\endgroup$ – Robin Nicole May 15 at 7:43
0
$\begingroup$

Write it as $$L=\sum _{j=1}^n N_j \log \left(\frac{p_j}{\sum _{i=1}^n p_i}\right)$$ and derive. Reusing later that $\sum _{i=1}^n p_i=1$, you should get for example $$\frac{\partial L}{\partial p_1}=-(N_2+N_3+\cdots+ N_n)+N_1\frac {1-p_1}{p_1}=\frac{N_1}{p_1}-\sum _{i=1}^n N_i$$ So $$\frac{\partial L}{\partial p_k}=\frac{N_k}{p_k}-\sum _{i=1}^n N_i$$

$\endgroup$
  • $\begingroup$ This really helps, thanks! $\endgroup$ – Shiv May 15 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.