  In this paper, we study the optimal investment problem considering the herd
behaviour between two agents, including one leading expert and one following
agent whose decisions are influenced by those of the leading expert. In the
objective functional of the optimal investment problem, we introduce the
average deviation term to measure the distance between the two agents'
decisions and use the variational method to find its analytical solution. To
theoretically analyze the impact of the following agent's herd behaviour on
his/her decision, we decompose his/her optimal decision into a convex linear
combination of the two agents' rational decisions, which we call the rational
decision decomposition. Furthermore, we define the weight function in the
rational decision decomposition as the following agent's investment opinion to
measure the preference of his/her own rational decision over that of the
leading expert. We use the investment opinion to quantitatively analyze the
impact of the herd behaviour, the following agent's initial wealth, the excess
return, and the volatility of the risky asset on the optimal decision. We
validate our analyses through numerical experiments on real stock data. This
study is crucial to understanding investors' herd behaviour in decision-making
and designing effective mechanisms to guide their decisions.
