This paper deals with the problem of observer-based fault detection for linear discrete time-varying (LDTV) systems. A problem formulation is first proposed to address the optimization of the fault detection filter (FDF) design, which is expressed in terms of maximizing a finite horizon H∞/H∞ or H−/H∞ performance index. This formulation can be applied to FDF design of LDTV systems subject to l2-norm bounded unknown inputs or stochastic noise sequences. It is shown that a unified optimal solution to the FDF can be obtained by solving the discrete time Riccati equation and the optimal FDF is not unique. A numerical example is given to illustrate the proposed method.