### 6.1 Perturbation equations

We start with a general perturbed metric about the flat FLRW background [57, 352, 231, 232, 437]
where , , , are scalar perturbations, , are vector perturbations, and is the
tensor perturbations, respectively. In this review we focus on scalar and tensor perturbations, because
vector perturbations are generally unimportant in cosmology [71].
For generality we consider the following action

where is a function of the Ricci scalar and the scalar field , and are
functions of , and is a matter action. We do not take into account an explicit coupling between
the field and matter. The action (6.2) covers not only f (R) gravity but also other modified gravity
theories such as Brans–Dicke theory, scalar-tensor theories, and dilaton gravity. We define the quantity
. Varying the action (6.2) with respect to and , we obtain the following field
equations
where is the energy-momentum tensor of matter.
We decompose and into homogeneous and perturbed parts, and ,
respectively. In the following we omit the bar for simplicity. The energy-momentum tensor of an ideal fluid
with perturbations is

where characterizes the velocity potential of the fluid. The conservation of the energy-momentum tensor
() holds for the theories with the action (6.2) [357].
For the action (6.2) the background equations (without metric perturbations) are given by

where is given in Eq. (2.13).
For later convenience, we define the following perturbed quantities

Perturbing Einstein equations at linear order, we obtain the following equations [316, 317] (see
also [436, 566, 355, 438, 312, 313, 314, 492, 138, 33, 441, 328])
where is given by
We shall solve the above equations in two different contexts: (i) inflation (Section 7), and (ii) the matter
dominated epoch followed by the late-time cosmic acceleration (Section 8).