When the optimal design of the system that requires time integration is considered, the sensitivity analysis is most difficult part since the objective function cannot be derived explicitly in terms of design variables, but only can be done after numerical time integration is carried out. For the sensitivity analysis of such a system, the formulation of adjoint method is derived here which computes the sensitivity more efficiently than the direct method. The objective function is defined by a general form including the integration over the time and as function of the final state. The automatic differentiaton is employed to derive adjoint equations and sensitivity form. The capability of optimizing the system is demonstrated by several examples. It was shown that the sensitivity analysis using finite difference sometimes shows incorrect sensitivity, while the analytical ones by the prerent method can compute sensitivity accurately.