This article addresses the optimal formation control for unmanned aerial vehicles (UAVs) and unmanned ground vehicles (UGVs) system via a distributed optimal control approach. A user-friendly global cost function is well designed in a linear quadratic regulator (LQR) form. The proper choice of the weighting matrices for optimizing the cost function are given. To deal with the graph coupling of optimal control and distributed control, we propose a distributed optimal formation control protocol, and the protocol is independent of the communication graph. The proposed protocol can guarantee the optimization of the cost function and the achievement of the formation control. Three simulation examples are provided to demonstrate the results.