I am going through the QAOA section in the Qiskit Textbook - QAOA and am stuck in one of the steps. In section 5.2, the method for getting the Optimal Trial State Parameters are discussed. I do not follow how does Eq 2 follow from Eq 1. I have done some digging and have read other useful posts like Quantum Approximate Optimization Algorithm explained and How to do the direct evaluation by hand in QAOA algorithm, and they have helped understand the problem better; but I am still unable to derive Equation 2 from 1. Any help or guidance would be appreciated. I am trying to find the optimal parameters of beta and gamma for different kind of graphs.