This book provides a concise and in-depth exposition of distributed control and optimization problems of multi-agent systems. The book integrates various ideas and tools from dynamic systems, control theory, graph theory, and optimization to address the special challenges posed by such complexities in the environment as communication delay, topological dynamics, and environmental uncertainties. In order to deal with the mismatched uncertainties and time delay, observer-based controller and sliding mode control are developed to achieve consensus control. When there is a leader or multiple leaders in the communication topologies, containment control is required. The book studies both state and output containment for nonlinear multi-agent systems with undirected or directed networks. Furthermore, event-triggered schemes are proposed to reduce communication and computation costs. Distributed optimization for multi-agent systems is an interesting topic that has attracted more and more attention due to its wide range of applications such as smart grids, sensor networks, and mobile manipulators. In distributed optimization, the goal is to optimize the global cost function, which is the sum of all local cost functions, each of which is known only by its own local agent. Distributed nonsmooth convex optimization for multi-agent systems based on proximal operators is developed to achieve distributed optimal consensus.