The Dolgov-Kawasaki instability discovered in the matter sector of the modified gravity scenario incorporating a −µ 4 /R correction to Einstein gravity is studied in general f (R) theories. A stability condition is found in the metric version of these theories to help ruling out models that are unviable from the theoretical point of view. For example, the theories f (R) = R + αµ 2(n+1) /R n , where α and n are real constants and n > 0, are ruled out for any negative value of α.PACS numbers: 98.80.-k, 04.90.+e, 04.50.+h Analyses of type Ia supernovae [1] and of the cosmic microwave background, including the 3-year WMAP results [2], confirm that the present expansion of the universe is accelerated. This is currently explained by invoking a form of dark energy comprising 70% of the total cosmic energy density ρ and with exotic properties (it does not cluster at small scales and has negative pressure P de ≃ −ρ de ). Recently, as an alternative to this exotic dark energy, it has been proposed to explain the cosmic acceleration with geometry by modifying Einstein gravity at the largest scales (or at low curvatures) by introducing corrections to the Einstein-Hilbert Lagrangian ("f (R)", or "fourth order", or "modified" gravity). The simplest form for the action of modified gravity iswhere κ ≡ 8πG, R is the Ricci curvature [3], and S (m) is the matter action. One can vary the action with respect to the metric ("metric formalism") or perform a Palatini variation in which the metric and the connection are treated as independent variables [5] ("Palatini formalism")-the resulting field equations, which coincide in general relativity, are different in higher order gravity. Furthermore, if the matter action S (m) also depends on the connection, one obtains a third possibility, metric-affine gravity theories [6]. Quadratic quantum corrections were originally introduced to improve the renormalizability of general relativity [7] and were used to achieve inflation in the early universe [8]. There is also motivation for modified gravity from string/M theory [9].The field equations obtained by varying the action (1) in the metric formalism arewhere a prime denotes differentiation with respect to R, g ab and R ab are the metric and Ricci tensors, and T ab is the stress-energy tensor of ordinary matter. The idea of modified gravity consists in introducing corrections to the Einstein-Hilbert action that are negligible in the early universe and only become effective at late times when the Ricci curvature R decreases (the radiation era with R = 0 deserves a special discussion -see below). The prototype is the theory f (R) = R − µ 4 /R [10, 11, 12] which, however, was found to be unstable [13,14]. Therefore, we parametrize the deviations from Einstein gravity aswhere ǫ is a small parameter with the dimensions of an inverse squared length and ϕ is arranged to be dimensionless (in the previous example with f = R − µ 4 /R it is ǫ = −µ 4 with µ ≃ H 0 ≈ 10 −33 eV, the present value of the Hubble parameter H). In order for the effects of th...