Can you help me to find the first order condition of the following problem with respect to $w_i$? $$\max [U(C_0) + \beta E(U(C_1))]$$ s.t. $$1) C_1 = y_1+(W_0+y_0-C_0)\sum_{i=1}^{n}w_iR_i$$ $$2) \sum_{i=1}^{n}w_i=1$$ Btw, I have the solution, but want to see the steps of derivation. The answer is $\beta E(U^\prime(C_1)R_i)-\Omega=0, i=1,\ldots,n$ , where $\Omega$ is defined as $\dfrac{\Omega^\prime}{W_0+y_0-C_0}$ and $\Omega^\prime$ is the lagrange multiplier for the constraint $\displaystyle\sum_{i=1}^{n}w_i=1$.
Thank you so much, in advance.
The Lagrange function is
$$L=U(C_0)+\beta \cdot \mathbb E[U(C_1)]+\Omega^{'}\cdot \left(1-\sum_{i=1}^n w_i \cdot R_i\right)$$
The derivative can be calculated by calculating the derivative for each summand. The derivative of $U(C_0)$ w.r.t $w_i$ is $0$ since it does not depend on $w_i$.
For the next summand we use the chain rule. $\frac{\partial U(C_1)}{\partial w_i}=U^{'}(C_1)\cdot (W_0+y_0-C_0)\cdot R_i$. Thus
$$\frac{\partial \beta \cdot \mathbb E[U(C_1)]}{\partial w_i}=\beta\cdot \mathbb E[U^{'}(C_1)\cdot (W_0+y_0-C_0)\cdot R_i]=\beta\cdot \mathbb E[U^{'}(C_1)\cdot R_i]\cdot (W_0+y_0-C_0)$$
And $$\frac{\partial \Omega^{'}\cdot \left(-\sum_{i=1}^n w_i \cdot R_i\right)}{\partial w_i}=-\Omega^{'}\cdot R_i$$
Therefore in total the derivative is
$$=\beta\cdot \mathbb E[U^{'}(C_1)\cdot R_i]\cdot (W_0+y_0-C_0)-\Omega^{'}\cdot R_i=0$$
I have set the derivative equal to 0.
Dividing the equation by $(W_0+y_0-C_0)$
$$=\beta\cdot \mathbb E[U^{'}(C_1)\cdot R_i]-\frac{\Omega^{'}\cdot R_i}{W_0+y_0-C_0}=0$$
My result is slightly different from yours. I have an extra $R_i$ in the numerator of the second summand.