These lecture notes cover the DC Optimal Power and AC Optimal Power Flow formulations, as well as the Economic Dispatch for Power Systems. Their aim is to supplement the study material for the course "31765: Optimization in modern power systems" at the Technical University of Denmark (DTU). The first edition of the present lecture notes was prepared for the academic year 2018-2019. Note that the material presented in these notes is a constant work in progress. Future editions will include OPF formulations based on semidefinite programming, detailed derivation of Locational Marginal Prices, and other topics. For any comments, errors, or omissions, you are welcome to contact me at "spchatz_at_elektro.dtu.dk". Special thanks to the students of the 31765 course for their remarks and suggestions to improve these lecture notes.