We consider a real massless scalar field inside a cavity with two moving mirrors in a twodimensional spacetime, satisfying Dirichlet boundary condition at the instantaneous position of the boundaries, for arbitrary and relativistic laws of motion. Considering vacuum as the initial field state, we obtain formulas for the exact value of the energy density of the field and the quantum force acting on the boundaries, which extend results found in previous papers [1][2][3][4]. For the particular cases of a cavity with just one moving boundary, non-relativistic velocities, or in the limit of infinity length of the cavity (a single mirror), our results coincide with those found in the literature.PACS numbers: 03.70.+k, 11.10.Wx, 42.50.Lc The Dynamical Casimir effect has been investigated since the 1970s [5][6][7], and has attracted growing attention. It is related to problems like particle creation in cosmological models and radiation emitted by collapsing black holes [6,8] [12]). In contrast, the problem of a cavity with two moving boundaries has been investigated recently and relatively few papers on this subject are found in the literature (for instance, Refs. [13][14][15][16][17]). A cavity with two oscillating mirrors can exhibit situations of constructive and destructive interference in the number of created particles, depending on the relation among the phase difference of each boundary, the amplitudes and frequencies of oscillation [13][14][15]. Ji, Jung and Soh [14], considering the expansion of the quantizing field over a instantaneous basis and a perturbative approach, investigated the problem of interference in the particle creation for a one-dimensional cavity with two boundaries moving according to prescribed, non-relativistic and oscillatory (small amplitudes) laws of motion. Dalvit and Mazzitelli [15] extended the field solution obtained by Moore [5] for the case of a one-dimensional cavity with two moving boundaries, deriving a set of generalized Moore´s equations, also obtaining the expected energy-momentum tensor for this model, generalizing the corresponding formula obtained by Fulling and Davies [6]. In Ref.[15] the set of generalized Moore´s equations was solved for the case of a resonant oscillatory movement with small amplitude, via renormalization-group procedure. Li and Li [2] applied the geometrical method, proposed by Cole and Schieve [18], to solve exactly the generalized Moore equations obtained by Dalvit and Mazzitelli [15], and also used numerical methods to obtain the behavior of the energy density in a cavity for particular sinusoidal laws of motion, with small amplitude [3]. On the other hand, as far as we know, there is no paper in literature devoted to obtain formulas which enable us to get directly exact values for the quantum force and energy density in a nonstatic cavity for arbitrary laws of motion for the moving boundaries, including non-oscillating movements with large amplitudes, which are out of reach of the perturbative approaches found in the literature.In the prese...