$C^s$ is consumption (or wealth) of an investor, $R_s$ (or $R$) is the return rates of risky assets while $R_f$ is the return rate of a risk-free asset(say government bond), $\Phi$ is the quantities of risky assets, $\phi_f$ is the quantity of the risk-free asset, $\omega$ is the quantity of all the assets(so $\phi_f+\Phi' \cdot 1=\omega$), and $u(\cdot)$ is the investor's utility function.
The solution to this problem gives the following first order condition(FOC) i.e. taking derivative w.r.t. $\Phi$ (assuming integration and differentiation can be exchanged):
But there's actually a constraint: $\phi_f+\Phi' \cdot 1=\omega$, so I tried Lagrange but couldn't get the same result: $$L(\Phi, \lambda)=E[u(c)]+\lambda(\omega-\phi_f-\Phi' \cdot 1 )$$ with FOCs: $$\partial L/\partial \Phi =E[u'(c)(R-1\cdot R_f)]-\lambda \cdot 1=0$$ $$\partial L/\partial \lambda =\omega-\phi_f-\Phi' \cdot 1 =0$$ I couldn't get the same result from above. To have the result in the solution I must have $\lambda=0$ but I'm not sure in what cases it can hold. Please let me know which parts I did wrong.