So I believe there should be a closed form solution for implied risk aversion for two assets but I'm not sure how to get there. Say you have Quadratic Utility $U$ on a fully invested portfolio of two assets ($w_1 + w_2 = 1$):
$$ U = r_p - \frac{\lambda}{2} \, \sigma^2_p $$
and given capital market returns ($r_i$) and vols ($\sigma_i$) for each asset and a correlation ($\rho_{12}$) between the two assets.
In a usual problem, you might be given the risk aversion ($\lambda$) and find the weights ($w_1$, $w_2$) that maximize the utility. What I'm looking for is a closed form solution for the opposite problem of implied risk aversion, in other words given an optimal portfolio ($w^*_1$, $w^*_2$) what is the implied risk aversion $\lambda$ for a client that would want that optimal portfolio.
$$ \lambda(w^*_1, w^*_2, r_1, r_2, \sigma_1,\sigma_2, \rho_{12}) =\, ... $$
Edit: @KermitFrog reminded me that solution must still be an optimal one and then $\lambda$ can be solved for. Giving the below:
$$ 0 = \frac{dU}{dw_1} $$
$$ 0 = \frac{d}{dw_1}[w_1r_1 + w_2r_2 - \frac{\lambda}{2}(w_1^2\sigma_1^2 + w_2^2\sigma_2^2 + 2\rho\sigma_1\sigma_2w_1w_2)] $$ $$ 0 = r_1 - r_2 - \frac{\lambda}{2} [2w_1\sigma_1^2 - 2w_2\sigma_2^2 - 2\rho\sigma_1\sigma_2(w_1-w_2)] $$
$$ \lambda = \frac{r_1-r_2}{w_1\sigma_1^2 - w_2\sigma_2^2 - \rho\sigma_1\sigma_2(w_1-w_2)} $$