I have a question on the following problem from chapter 9 of D. Luenberger, Investment Science, International Edition:
(Portfolio Optimization)
Suppose an investor has utility function $U$. There are $n$ risky assets with rates of return $r_i$, $i=1,2,...,n$, and one risk-free asset with rate of return $r_f$. The investor has initial wealth $W_o$. Suppose that the optimal portfolio for this investor has (random) payoff $x^*$. Show that $$E[U^{'}(x^*)(r_i-r_f)]=0$$ for $i=1,2,...,n.$
I'm finding this a very hard problem, as I don't see how I can prove this analytically using the formulas for $E[XY]$ or $Cov[X,Y]$ in some straightforward way.
It is not mentioned whether or not the risky assets are correlated or not which also raises my level of uncertainty about this problem.
One thought is that the optimal portfolio should be such that $U(x^*)$ is maximized, but this does not mean that $U^{'}(x^*)=0$ even then since $U$ is monotone increasing.
I've tried to look at some simple examples in Excel to see if this identity holds true in practice, but I'm finding it very difficult to show this even if I use some simple utility function like a linear utility function.
In fact, if I assume that $U(x)=x$ as a simple starting step, then $U^{'}(x)=1$ for all $x$, and then the equation would read $E[r_i-r_f]=0$, which isn't necessarilly true.
I've tried to think about it from a few different angles but I just can't process it. Is there anyone who would know how to show this lemma true or false?
Thanks in advance.