The KDV Hierarchy and Associated Trace Formulas