1 Introduction

Casimir-Lifshitz forces are a directly observable manifestation of quantum field theory [1,2,3]. These arise from the quantum fluctuations of the electromagnetic field in the presence of material boundaries. In the past few decades, the measurement of such forces has become increasingly precise, proving the good agreement between theory and experiment for simple geometries [4,5,6,7]. One of the most significant achievements has been the experimental confirmation of the Dzyaloshinskii–Lifshitz–Pitaevskii (DLP) formula [8,9,10]. In this case, the Casimir-Lifshitz force between two homogeneous slabs separated by a medium with nontrivial electromagnetic response satisfies

$$\begin{aligned} \text {sgn}\, F_\text {int}= -\text {sgn}[(\varepsilon _1-\varepsilon _{M})(\varepsilon _2-\varepsilon _{M})]. \end{aligned}$$
(1)

This behaviour, hereinafter referred to as the DLP result, leads to repulsion if the permittivities of the objects \(\varepsilon _{i}\) and the medium \(\varepsilon _{M}\) satisfy \(\varepsilon _{i}<\varepsilon _{M}<\varepsilon _{j}\), \(i,j\in \{1,2\}\). It took almost fifty years to experimentally confirm this prediction for material bodies [6]. This was accomplished with a gold-covered sphere and a large silica plate immersed in bromobenzene since, over a wide frequency range,

$$\begin{aligned} \varepsilon _\text {silica}<\varepsilon _\text {bromobenzene}<\varepsilon _\text {gold}. \end{aligned}$$

With this, an attractive interaction was also found replacing the silica plate with a gold plate. The experiments on Casimir force measurements have traditionally been restricted to objects like spheres and plates. Nonetheless, it is known that nontrivial geometries modify the strength and the sign of the force [3, 7, 11], raising the possibility for specific applications in nanomechanics and nanotechnology. However, there is a lack of general theorems regarding this dependence on geometry and boundaries. For instance, one of the few general results on the sign of the force is for a mirror symmetric arrangement of objects [12, 13]. In this case, the attractive character of the force can be proved from the representation of the energy in terms of transition operators. As a result, the interaction force is also attractive between a single object and a plane when both share boundary conditions. This attraction may lead to the permanent adhesion of the moving parts in nanoscale machines [14, 15]. In this context, the stability of the configuration should also be considered, especially when looking for ultra-low stiction and levitating devices [6, 16]. Within an approach similar to the one in [12], an extension of Earnshaw’s theorem was stated in [17]. This result sets restrictive constraints on the stability of arbitrarily shaped objects held in equilibrium by Casimir-Lifshitz forces. Nevertheless, a possible way to avoid the assumptions of the previous no-go theorems [12, 17] has recently been proposed [18]. This is based on the introduction of a chiral medium, where the strength of the resulting forces can be tailored in response to an external magnetic field.

In this paper, we investigate the Casimir effect in configurations in which one object lies inside the other [19,20,21,22,23,24,25,26,27,28]. We extend our previous work on the pressure acting on spherical surfaces [29]. Instead of a dielectric sphere enclosed within an arbitrarily shaped magnetodielectric body, we now consider two arbitrarily shaped objects: a dielectric with a spherical cavity in which a magnetodielectric is enclosed. Indeed, this study is also related to [30], where we study the sign of the interaction energy for scalar fields in the presence of spherical \(\delta \)-\(\delta '\) contact interactions. In all of these cases, we have written the energy in terms of the transition operators in a similar manner as in the two above-mentioned theorems [31, 32]. Within this framework, it is worth mentioning the original multiple scattering approach to the Casimir energy developed by Balian and Duplantier [33, 34]. With this, in this paper, we show that the signs of the interaction energy and pressure are essentially determined as in the DLP result (1). Furthermore, the same condition appears in [17], excluding stable equilibrium for two nonmagnetic bodies immersed in vacuum.

The paper is organized as follows. In Sect. 2, we rewrite the interaction energy formula in terms of transition operators. This representation of the energy is proposed to facilitate the computation of the pressure. In Sect. 3, we study the variation of these transition operators with respect to the radius of the cavity wall. We employ the invariant imbedding procedure for the transition matrix, which was originally developed to solve quantum mechanical scattering problems for atomic and molecular collisions. Indeed, we only need to study certain components of these operators, which are related to the inside scattering amplitudes properly defined in this section. We also include an appendix devoted to adapt this technique for other unusual scattering setups in which the source and the detector of the scattering experiment can be inside or outside the target. In Sect. 4, we prove that the sign of the interaction pressure acting on the cavity wall equals the sign of the interaction energy and that both can be written as in Eq. (1). As a consistency test, we also compare with previous results for cavity configurations. In particular, we extend the DLP result to inhomogeneous slabs, showing the relation between the interaction pressure on the wall and the force between the slabs. We end in Sect. 5 with some remarks on the main result and the conclusions in Sect. 6.

Throughout this paper, we will use the natural units \(\hslash =c=\varepsilon _0=\mu _0=1\), neglecting fluctuations due to nonelectromagnetic oscillations when the medium is different from vacuum, which are usually small [10].

2 Interaction energy

This section is devoted to study the interaction energy between two material bodies, one inside the other, due to the quantum fluctuations of the electromagnetic field. In particular, we consider the appropriate representation for determining the sign of the pressure acting on the spherical cavity wall shown in Fig. 1. For these bodies and the homogeneous medium filling the cavity, we assume that the coupling of the electromagnetic field to matter can be described by continuous permittivity \(\varepsilon \) and permeability \({\mu }\) functions. With this, Maxwell curl equations,

Fig. 1
figure 1

Cross-section view of the system under study. The pressure on the spherical cavity wall due to the interaction with the magnetodielectric object is considered. Between both objects there is a homogeneous dielectric. Each body is characterized by its corresponding permittivity \(\varepsilon _{i}\) (and permeability \(\mu _1\) for the inner object) being \(i\in \{1,2,M\}\)

$$\begin{aligned} \varvec{\nabla } \times \mathbf{E }(t,{\mathbf {x}})= & {} -\partial _t\mathbf{B }(t,{\mathbf {x}}),\\ \varvec{\nabla } \times \left[ {\mu }^{-1}(t,{\mathbf {x}})\mathbf{B }(t,{\mathbf {x}})\right]= & {} -\partial _t\left[ \varepsilon (t,{\mathbf {x}})\mathbf{E }(t,{\mathbf {x}})\right] , \end{aligned}$$

after Fourier transform in time, can be rearranged to give [35]

$$\begin{aligned}&\left[ \varvec{\nabla } \times \varvec{\nabla }\times + {\mathbb {V}}(\omega ,{\mathbf {x}})\right] \mathbf{E }(\omega ,{\mathbf {x}}) ={\varepsilon _{M}}\omega ^2 \mathbf{E }(\omega ,{\mathbf {x}}), \end{aligned}$$
(2)

where the potential operator is

$$\begin{aligned}&{\mathbb {V}}(\omega ,{\mathbf {x}})\equiv {\mathbb {I}} {\omega ^2} \left[ \varepsilon _{M}(\omega )-\varepsilon (\omega , \mathbf{x })\right] +\varvec{\nabla } \times \left[ \frac{1}{\mu (\omega ,\mathbf{x })}-\frac{1}{\mu _{M}(\omega )}\right] \varvec{\nabla } \times . \end{aligned}$$

Since the magnetic response of ordinary materials is typically close to one, we will focus on nonmagnetic bodies. However, we shall see that in some cases, the introduction of nontrivial permeabilities poses no additional difficulties, especially for the inner object. Hence, the potential operator reduces to

$$\begin{aligned} {\mathbb {V}}_{i}(\omega , \mathbf{x }) = {\mathbb {I}} {V}_{i}(\omega , \mathbf{x }) ={\mathbb {I}} \omega ^2 \left[ \varepsilon _{M}(\omega )-\varepsilon _{i}(\omega , \mathbf{x })\right] . \end{aligned}$$
(3)

Since \(\varepsilon _{i}(\omega , \mathbf{x })\) is equal to the permittivity of the medium outside each body, the spatial support of each potential satisfies \(\text {supp}\,V_1\cap \,\text {supp}\,V_2=\emptyset \). Consequently, the Casimir-Lifshitz interaction energy between the two objects is given by the so-called TGTG formula [31, 32]

$$\begin{aligned} E_\text {int}=\frac{1}{2\pi }\int _0^\infty \mathrm {d} \omega \,\text {Tr} \log ({\mathbb {I}}- {{\mathbb {T}}_1}{\mathbb {G}}^{M}_{12}\mathbb {{T}}_2{\mathbb {G}}^{M}_{21}). \end{aligned}$$
(4)

The properties of each body are encoded in its Lippmann-Schwinger \({\mathbb {T}}\) operator \({\mathbb {T}}_{i}:{\mathscr {H}}_{i}\rightarrow {\mathscr {H}}_{i}\), being \({\mathscr {H}}_{i}\equiv L^2(\text {supp}\,{\mathbb {V}}_{i})^3\) [36]. Furthermore, the relative position between both objects enters through \( {\mathbb {G}}^{M}_{ij}\equiv {\mathbb {P}}_{i}{\mathbb {G}}^{M} {\mathbb {P}}_{j}:{\mathscr {H}}_{j}\rightarrow {\mathscr {H}}_{i}, \) being \({\mathbb {G}}^{M}\) the propagator across the medium and \({\mathbb {P}}_{i}\) the projection operator onto the Hilbert space \({\mathscr {H}}_{i}\). These electric Green’s dyadics fulfill

$$\begin{aligned} \left[ \varvec{\nabla }\times \varvec{\nabla }\times +\varepsilon _{M}(i k){k^2} \right] {\mathbb {G}}^{M}(ik,{\mathbf {x}},{\mathbf {x}}') =~ {\mathbb {I}}\delta ({\mathbf {x}}~ -~ {\mathbf {x}}'), \end{aligned}$$
(5)

being related to the \({\mathbb {T}}_{i}\) operators of the Lippmann–Schwinger equation

$$\begin{aligned} \mathbf{E } = \mathbf{E }_\text {in}- {\mathbb {G}}^{M} {\mathbb {T}}_i \mathbf{E }_\text {in},\quad {\mathbb {T}}_{i} = {{\mathbb {V}}_{i}}\left( {{\mathbb {I}} + {\mathbb {G}}^{M} {\mathbb {V}}_{i}}\right) ^{-1}. \end{aligned}$$
(6)

Since the integral in Eq. (4) will be carried out over imaginary frequencies \(\omega = i k\), we have written the analytic continuation to the imaginary frequency axis of functions such as \(\varepsilon _{M}\). The two bodies are separated from each other so we can expand the Green’s functions in terms of free solutions of Eq. (2). In spherical coordinates, there is a complete set of regular solutions at the origin \(\{\mathbf{E }_{a}^\text {reg}\}\), whose radial part is determined by the spherical Bessel function, and a complete set of outgoing solutions \(\{\mathbf{E }_{a}^\text {out}\}\), whose radial part is determined by the spherical Hankel function of the first kind [37]. The subscript of these transverse solutions stands for the angular momentum values and polarizations \(\{\ell , {m}, P\}\). Note that we have to choose the appropriate representation of \({\mathbb {G}}^{M}_{ij}\) depending on the relative position between both objects [32]. When the two bodies lie outside each other, the suitable expansion leads to the usual components of \({\mathbb {T}}_{i=1,2}\) in Eq. (4), i.e. the scattering amplitude related to a process in which a regular wave interacts with the target and scatters outwards [35]. However, when one body is inside the other different components of \({\mathbb {T}}_2\) are needed. Specifically, with the appropriate normalization, \({{\mathbb {T}}_1}{\mathbb {G}}^{M}_{12}\mathbb {{T}}_2{\mathbb {G}}^{M}_{21}\) can be expanded as

$$\begin{aligned} \sum _{a,\, b,\,c}\langle \mathbf{E }_{j}^\text {reg}, {{\mathbb {T}}_1} \mathbf{E }_{a}^\text {reg} \rangle \langle \mathbf{E }_{a}^\text {reg}, {\mathbb {G}}^{M}_{12} \mathbf{E }_{b}^\text {out} \rangle \langle \mathbf{E }_{b}^\text {out}, \mathbb {{T}}_2 \mathbf{E }_{c}^\text {out} \rangle \langle \mathbf{E }_{c}^\text {out} , {\mathbb {G}}^{M}_{21} \mathbf{E }_k^\text {reg} \rangle . \end{aligned}$$
(7)

As shown in Sect. 3, \(\langle \mathbf{E }_{b}^\text {out}, \mathbb {{T}}_2 \mathbf{E }_{c}^\text {out} \rangle \) is related to the scattering amplitude when both the source and detector are inside the target.

Now, in order to determine the conditions leading to positive or negative values of the Casimir-Lifshitz energy, we assume that the sign of the potential \(V_{i}\) in Eq. (3) is constant over the whole body, being

$$\begin{aligned} s_{i}\equiv \text {sgn}\, V_i =\pm 1 \ \text {if} \ \varepsilon _{i}(ik, \mathbf{x }) \gtrless \varepsilon _{M}(i k)\ \forall \mathbf{x }\in \text {supp}\,V_{i}. \end{aligned}$$
(8)

We shall see that our analysis applies to each fixed frequency so Eq. (8) should hold for all of them. However, we can simply assume constant sign over the frequencies contributing most to the energy [6, 10]. Note that from Kramers–Kronig causality conditions the permittivity satisfies \(\varepsilon (ik)\ge 1\), where the equality holds for vacuum [3]. Indeed, the vacuum Green’s functions are related to the medium ones by \( {\mathbb {G}}^0(i \sqrt{\varepsilon _{M}}k,{\mathbf {x}},{\mathbf {x}}') = {\mathbb {G}}^{M}(i k,{\mathbf {x}},{\mathbf {x}}'), \) being \( {\mathbb {G}}^{M} \) a nonnegative operator \({\mathbb {G}}^{M}\ge ~0\) so we have \({\mathbb {G}}^{M \dagger }_{21}={\mathbb {G}}^{M}_{12}\). In addition, \({\mathbb {T}}_{i}(ik)\) is real and symmetric, and in this case, it can be written in the form \( {\mathbb {T}}_{i}=s_{i} \sqrt{s_{i}{\mathbb {T}}_{i}} \sqrt{s_{i}{\mathbb {T}}_{i}}, \) where \(\sqrt{s_{i}{\mathbb {T}}_{i}}\) is the square root of the positive operator \(s_{i} {\mathbb {T}}_{i}\). We will not analyse convergence issues or the self-adjointness of the presented operators (for those see [36]), assuming that the appropriate conditions are fulfilled in realistic systems [17].

As a result of the above, the interaction energy can be rewritten as [29]

$$\begin{aligned} E_\text {int}=\frac{1}{2\pi }\int _0^\infty \mathrm {d} k\,\text {Tr} \log ({\mathbb {I}}-s\, {\mathbb {M}}), \end{aligned}$$
(9)

where we have defined \(s\equiv s_1 s_2\) and the nonnegative operator

$$\begin{aligned} {\mathbb {M}}\equiv \left( \sqrt{s_2{\mathbb {T}}_2}{\mathbb {G}}^{M}_{21} \sqrt{s_1{\mathbb {T}}_1}\right) ^\dagger \sqrt{s_2{\mathbb {T}}_2}{\mathbb {G}}^{M}_{21} \sqrt{s_1{\mathbb {T}}_1}. \end{aligned}$$
(10)

In [29], we proved that the eigenvalues of \({\mathbb {M}}\) belong to [0, 1) and that the sign of the interaction energy, including when both objects lie outside each other, is determined by

$$\begin{aligned} \text {sgn}\,E_\text {int}=-s=-s_1 s_2=- \text {sgn}\left[ (\varepsilon _{1}-\varepsilon _{M}\right) (\varepsilon _{2}-\varepsilon _{M})]. \end{aligned}$$
(11)

In addition, for objects described by \(\varepsilon _{i}\) and \(\mu _{i}\), we showed that the relation \(\text {sgn}\, E_\text {int}=-s_1s_2\) remains valid as long as the sign of the differential operator \({\mathbb {V}}_{i}(ik,{\mathbf {x}})\) in Eq. (2) is well-defined. This is determined by Eq. (8) with an additional condition for the whole magnetodielectric [32]

$$\begin{aligned} s_{i}=\pm 1 \quad \text {if} \ \varepsilon _{i}(ik, \mathbf{x }) \gtrless \varepsilon _{M}(i k)\ \text {and}\ \mu _{i}(i k, \mathbf{x })\lesseqgtr \mu _{M}(i k). \end{aligned}$$

3 Inside scattering

In this section, we explore scattering processes within cavities. We are interested in how the probing wave can be scattered when it reaches the spherical cavity wall. This unusual scattering setup, in which source and detector are inside the target, will be useful in the following section. In particular, we will focus on the variation of the scattering amplitude with the radius \(r_0\) shown in Fig. 2. This will be determined employing the invariant imbedding technique [37, 38]. This method, related to the variable phase approach of electromagnetic scattering, is progressively reaching some importance in Casimir physics since it enables to compute efficiently \({\mathbb {T}}_i\) for arbitrarily shaped objects [39]. As we shall see, the derivation of this section holds for each fixed frequency. This will allow us to easily extend the result to systems at thermal equilibrium in Sect. 5. Therefore, we will omit this frequency dependence on the functions, except to indicate the analytic continuation to the imaginary frequency axis.

Fig. 2
figure 2

Cross-section view of the scattering object. The radii of the smallest circumscribed sphere of the object and the spherical cavity wall are R and \(r_0\), respectively, being \(r_n\) an intermediate radius

The starting point of the approach is the Lippmann–Schwinger Equation (6) in position space

$$\begin{aligned} \mathbf{E }({\mathbf {x}}) = \mathbf{E }_\text {in}({\mathbf {x}})- \int \mathrm {d}{\mathbf {x}}'{\mathbb {G}}^{M}( {\mathbf {x}},{\mathbf {x}}') {\mathbb {V}}_2(\omega , {\mathbf {x}}') \mathbf{E }({\mathbf {x}}'), \end{aligned}$$
(12)

where \(\mathbf{E }_\text {in}\) is the incident wave. The dyadic Green’s function defined in Eq. (5) can be written as the sum of a transverse and a local contribution [37]

$$\begin{aligned} {\mathbb {G}}^{M}({\mathbf {x}},{\mathbf {x}}')={\mathbb {G}}^{M}_0({\mathbf {x}},{\mathbf {x}}')+\dfrac{\delta ({\mathbf {x}}-{\mathbf {x}}')}{\kappa ^2}{\mathbf {u}}_{\mathbf {x}}\otimes {\mathbf {u}}_{\mathbf {x}}, \end{aligned}$$
(13)

where \({\mathbf {u}}_{\mathbf {x}}\) is the unit vector in the direction of \({\mathbf {x}}\) and \({\mathbb {G}}^{M}_0({\mathbf {x}},{\mathbf {x}}')\) can be expanded as

$$\begin{aligned} {\mathbb {G}}^{M}_0({\mathbf {x}},{\mathbf {x}}')=-\kappa \sum _{\ell m} \left\{ \begin{array}{cc} {\mathbb {Y}}_{\ell m}(\varOmega )\, {\mathbb {H}}^{\,}_\ell (i \kappa r) {\mathbb {J}}^\dagger _\ell (i \kappa r'){\mathbb {Y}}^\dagger _{\ell m}(\varOmega ') &{} \, \mathrm{if} \ \ r> r',\\ {\mathbb {Y}}_{\ell m}(\varOmega )\, {\mathbb {J}}^{\,}_\ell (i \kappa r) {\mathbb {H}}^\dagger _\ell (i \kappa r'){\mathbb {Y}}^\dagger _{\ell m}(\varOmega ') &{} \, \mathrm{if} \ \ r<r'. \end{array}\right. \end{aligned}$$

We have defined \(\omega = i k\), \(\kappa \equiv {k}{\sqrt{\varepsilon _{M}}}\) and

$$\begin{aligned} {\mathbb {J}}_\ell (i z) \equiv i^{\ell } \left( \begin{array}{cc} i_\ell (z) &{} 0 \\ 0 &{} \frac{i }{z } \frac{\mathrm {d}\, }{\mathrm {d}z } [z \, i_\ell (z )] \\ 0 &{} \frac{i \sqrt{\ell (\ell +1)} }{z} i_\ell (z) \\ \end{array} \right) \!,\quad {\mathbb {H}}_\ell (i z) \equiv i^{\ell } \left( \begin{array}{cc} - k_\ell (z) &{} 0 \\ 0 &{} \frac{i }{z } \frac{\mathrm {d}\, }{\mathrm {d} z }[z \, k_\ell (z )] \\ 0 &{} \frac{i \sqrt{\ell (\ell +1)} }{z} k_\ell (z)\\ \end{array} \right) , \end{aligned}$$
(14)

being \(i_\ell (z)\) and \(k_\ell (z)\) the modified spherical Bessel functions

$$\begin{aligned} i_\ell (z)\equiv \sqrt{\frac{\pi }{2 z}}\, I_{\ell +{1}/{2}}(z),\quad k_\ell (z)\equiv \sqrt{\frac{2 }{\pi z}}\, K_{\ell +{1}/{2}}(z). \end{aligned}$$
(15)

The angular part is encoded in the square matrix \({\mathbb {Y}}_{\ell m}\) composed of vector spherical harmonics [37]. In this case \({\mathbb {Y}}_{\ell m}(\varOmega )\, {\mathbb {H}}^{\,}_\ell (i \kappa r)\) corresponds to an outgoing mode of the wave, where the first and second columns are transverse electric (TE) and transverse magnetic (TM) modes, respectively. Similarly, the first and second columns of \({\mathbb {Y}}_{\ell m}(\varOmega )\, {\mathbb {J}}^{\,}_\ell (i \kappa r)\) represent regular TE and TM modes [38]. With these definitions we note that \({\mathbb {G}}^{M}_0({\mathbf {x}},{\mathbf {x}}')\) is subject to boundary conditions which correspond to outgoing waves [38], and it can be rewritten as

$$\begin{aligned} {\mathbb {G}}^{M}_0({\mathbf {x}},{\mathbf {x}}')= \sum _{\ell m} {\mathbb {Y}}_{\ell m}(\varOmega )\, {\mathbb {G}}^{\,}_\ell (r,r') {\mathbb {Y}}^\dagger _{\ell m}(\varOmega '), \end{aligned}$$

where

$$\begin{aligned} {\mathbb {G}}^{\,}_\ell (r,r')\equiv -\kappa \sum _{\ell m} \left\{ \begin{array}{cc} {\mathbb {H}}^{\,}_\ell (i \kappa r) {\mathbb {J}}^\dagger _\ell (i \kappa r') &{} \, \mathrm{if} \ \ r> r',\\ {\mathbb {J}}^{\,}_\ell (i \kappa r) {\mathbb {H}}^\dagger _\ell (i \kappa r')&{} \, \mathrm{if} \ \ r<r'. \end{array}\right. \end{aligned}$$

The dielectric body is described by the potential of Eq. (3)

$$\begin{aligned} {\mathbb {V}}_{2}(i k, \mathbf{x }) = {\mathbb {I}} {V}_{2}(i k, \mathbf{x }) ={\mathbb {I}} k^2 \left[ \varepsilon _{2}(i k, \mathbf{x })-\varepsilon _{M}(i k)\right] , \end{aligned}$$
(16)

which from eqs. (12) and (13) satisfies

$$\begin{aligned} \left( {\mathbb {I}}+\dfrac{V_2(i k, {\mathbf {x}})}{\kappa ^2}{\mathbf {u}}_{\mathbf {x}}\otimes {\mathbf {u}}_{\mathbf {x}}\right) \mathbf{E }({\mathbf {x}}) = \mathbf{E }_\text {in}({\mathbf {x}})- \int \mathrm {d}{\mathbf {x}}' {V}_2(i k,{\mathbf {x}}'){\mathbb {G}}^{M}_0({\mathbf {x}},{\mathbf {x}}') \mathbf{E }({\mathbf {x}}'). \end{aligned}$$
(17)

Note that the spatial integral is over the volume of the second object \(\text {supp}\,V_{2}\). We now define

$$\begin{aligned} \mathbf{E }^0({\mathbf {x}})\equiv \left( {\mathbb {I}}+\dfrac{V_2(i k, {\mathbf {x}})}{\kappa ^2}{\mathbf {u}}_{\mathbf {x}}\otimes {\mathbf {u}}_{\mathbf {x}}\right) \mathbf{E }({\mathbf {x}})={\mathbb {D}}^{-1}({\mathbf {x}})\mathbf{E }({\mathbf {x}}), \end{aligned}$$

being \({\mathbb {D}}({\mathbf {x}})=\text {diag}(\varepsilon _M(i k) /\varepsilon _2(i k, \mathbf{x }), 1,1)\) and \(\mathbf{E }^0({\mathbf {x}})=\mathbf{E }({\mathbf {x}})\) if \(r\notin [r_0, R]\). With this, we rewrite Eq. (17) as

$$\begin{aligned} \mathbf{E }^0({\mathbf {x}})=\mathbf{E }_\text {in}({\mathbf {x}})- \int \mathrm {d}{\mathbf {x}}' {V}_{2}(i k, \mathbf{x }') {\mathbb {G}}^{M}_0({\mathbf {x}},{\mathbf {x}}') {\mathbb {D}}({\mathbf {x}}')\mathbf{E }^0({\mathbf {x}}') . \end{aligned}$$
(18)

Since the source of the scattering experiment is inside the cavity, we assume an outgoing incident wave

$$\begin{aligned} \mathbf{E }^0_{\ell m}({\mathbf {x}})= & {} {\mathbb {Y}}_{\ell m}(\varOmega ){\mathbb {H}}^{\,}_{\ell }(i \kappa r)\nonumber \\&-\sum _{\ell ' m'} \int \mathrm {d}{\mathbf {x}}' {V}_{2}(i k, \mathbf{x }') {\mathbb {Y}}_{\ell ' m'}(\varOmega )\, {\mathbb {G}}^{\,}_{\ell '}(r,r') {\mathbb {Y}}^\dagger _{\ell ' m'}(\varOmega ') {\mathbb {D}}({\mathbf {x}}')\mathbf{E }^0_{\ell m}({\mathbf {x}}') . \end{aligned}$$
(19)

In addition, since the detector is also inside, we can write

$$\begin{aligned} \mathbf{E }^0_{\ell m}({\mathbf {x}})={\mathbb {Y}}_{\ell m}(\varOmega ){\mathbb {H}}^{\,}_{\ell }(i \kappa r)+ \sum _{\ell ' m'}{\mathbb {Y}}_{\ell ' m'}(\varOmega ){\mathbb {J}}^{\,}_{\ell '}(i \kappa r) {\mathbb {T}}^\text {int}_{\ell ' m'\ell m}(ik), \end{aligned}$$
(20)

being

$$\begin{aligned} {\mathbb {T}}^\text {int}_{\ell ' m'\ell m}(ik)\equiv \kappa \int _{r_0}^R \mathrm {d} r' r'^2 {\mathbb {H}}^\dagger _{\ell '}(i \kappa r') \int _{S^2} \mathrm {d}\varOmega ' {V}_{2}({ik}, \mathbf{x }') {\mathbb {Y}}^\dagger _{\ell ' m'}(\varOmega ') {\mathbb {D}}({\mathbf {x}}')\mathbf{E }^0_{\ell m}({\mathbf {x}}'). \end{aligned}$$

The physical interpretation of Eq. (20) is clear. The electric field detected is composed of the incident field and a combination of regular waves modulated by \({\mathbb {T}}^\text {int}(i k)\), where the four components of \({\mathbb {T}}^\text {int}_{\ell m\ell ' m'}(ik)\) are determined by \(\{\langle \mathbf{E }_{\ell m P}^\text {out}, \mathbb {{T}}\, \mathbf{E }_{\ell ' m' P'}^\text {out} \rangle \}_{P,\, P'\in \{\text {TE}, \text {TM}\}}\) [32, 37]. It is instructive to compare the previous result with the regular scattering setup, in which source and detector are outside the target. In the latter, we have a regular wave and a scattered field composed of a combination of outgoing waves modulated by the usual transition matrix

$$\begin{aligned} \mathbf{E }^0_{\ell m}({\mathbf {x}})={\mathbb {Y}}_{\ell m}(\varOmega ){\mathbb {J}}^{\,}_{\ell }(i \kappa r)+ \sum _{\ell ' m'}{\mathbb {Y}}_{\ell ' m'}(\varOmega ){\mathbb {H}}^{\,}_{\ell '}(i \kappa r) {\mathbb {T}}^\text {ext}_{\ell ' m'\ell m}(ik). \end{aligned}$$
(21)

In both cases, in order to study \({\mathbb {T}}(i k)\), it is useful to use Eq. (19) for defining \({\mathbb {F}}_{\ell ' m'\ell m}(r')\) by means of

$$\begin{aligned} {\mathbb {F}}_{\ell ' m'\ell m}(r)\equiv & {} r^2\int _{S^2} \mathrm {d}\varOmega {\mathbb {Y}}^\dagger _{\ell m}(\varOmega ){V}_{2}({ik}, \mathbf{x }) {\mathbb {D}}({\mathbf {x}})\mathbf{E }^0_{\ell ' m'}({\mathbf {x}})\\= & {} {\mathbb {U}}_{\ell ' m'\ell m}(r) {\mathbb {H}}_{\ell '}(i \kappa r)-\sum _{\ell '' m''} {\mathbb {U}}_{\ell ' m'\ell '' m''}(r)\int _{r_0}^R \mathrm {d} r' {\mathbb {G}}^{\,}_{\ell ''}(r,r'){\mathbb {F}}_{\ell '' m''\ell ' m'}(r'), \end{aligned}$$

being

$$\begin{aligned} {\mathbb {U}}_{\ell m\ell ' m'}(r)\equiv r^2\int _{S^2} \mathrm {d}\varOmega {V}_{2}({ik}, \mathbf{x }) {\mathbb {Y}}^\dagger _{\ell m}(\varOmega ) {\mathbb {D}}({\mathbf {x}}){\mathbb {Y}}_{\ell ' m'}(\varOmega ). \end{aligned}$$
(22)

Note that \({\mathbb {U}}_{\ell m\ell ' m'}(r)=0\) if \(r\notin [r_0, R]\) and from Eq. (20), we have

$$\begin{aligned} {\mathbb {T}}^\text {int}_{\ell ' m'\ell m}(ik) = \kappa \int _{r_0}^R \mathrm {d} r' {\mathbb {H}}^\dagger _{\ell '}(i \kappa r') {{\mathbb {F}}_{\ell ' m'\ell m}(r')}. \end{aligned}$$
(23)

In order to use a more compact notation we can establish a unique correspondence between \(\{\ell ,\,m\}\) and a single index, which goes from one to infinity, and write [37]

$$\begin{aligned} {\mathbb {F}}(r)= & {} {\mathbb {U}}(r) {\mathbb {H}}(i \kappa r)- {\mathbb {U}}(r)\int _{r_0}^R \mathrm {d} r' {\mathbb {G}}^{\,}(r,r'){\mathbb {F}}(r'), \end{aligned}$$
(24)
$$\begin{aligned} {\mathbb {T}}^\text {int}(ik)= & {} \kappa \int _{r_0}^R \mathrm {d} r' {\mathbb {H}}^\dagger (i \kappa r') {{\mathbb {F}}(r')}. \end{aligned}$$
(25)

Now we can evaluate \(\partial _{r_0}{\mathbb {T}}^\text {int}(i k)\) using the invariant imbedding technique [40]. This method is based on considering the scattering by a cavity whose largest inscribed sphere radius is \(r_n\) instead of \(r_0\), as shown in Fig. 2. This lower limit can vary from \(r_0\) to R and if we start with \(r_n\) close to R we can keep imbedding spherical shells until the whole object is included. In the regular case, this allows to transform a boundary condition problem into an initial condition one [37, 38]. Consequently, we define

$$\begin{aligned} {\mathbb {U}}(r_n;r)\equiv & {} {\mathbb {U}}(r) \theta (r-r_n),\\ {\mathbb {F}}(r_n;r)\equiv & {} {\mathbb {U}}(r_n;r) {\mathbb {H}}(i \kappa r) -{\mathbb {U}}(r_n;r)\int _{r_n}^{R} \mathrm {d} r' {\mathbb {G}}^{\,}(r,r'){\mathbb {F}}(r_n;r'), \\ {\mathbb {T}}^\text {int}(r_n; ik)\equiv & {} \kappa \int _{r_n}^R \mathrm {d} r' {\mathbb {H}}^\dagger (i \kappa r') {{\mathbb {F}}(r_n; r')}. \end{aligned}$$

From these definitions, we obtain

$$\begin{aligned} \frac{\partial {\mathbb {F}}(r_n;r)}{\partial {r_n}}= & {} -\kappa {\mathbb {U}}(r_n;r) {\mathbb {H}}(i \kappa r) {\mathbb {J}}^\dagger (i \kappa r_n){\mathbb {F}}(r_n;r_n)\\&-{\mathbb {U}}(r_n;r)\int _{r_n}^R \mathrm {d} r' {\mathbb {G}}(r,r') \frac{\partial {\mathbb {F}}(r_n;r')}{\partial {r_n}}, \end{aligned}$$

where the condition \(r>r_n\) has been used. The previous equation can be written as

$$\begin{aligned} \frac{\partial {\mathbb {F}}(r_n;r)}{\partial {r_n}}=-\kappa {\mathbb {F}}(r_n;r){\mathbb {J}}^\dagger (i \kappa r_n){\mathbb {F}}(r_n;r_n). \end{aligned}$$
(26)

Now, as shown in Eq. (26),

$$\begin{aligned} \frac{\partial {\mathbb {T}}^\text {int}(r_n; ik)}{\partial {r_n}}=-\kappa {\mathbb {H}}^\dagger (i \kappa r_n) {{\mathbb {F}}(r_n; r_n)}+\kappa \int _{r_n}^R \mathrm {d} r' {\mathbb {H}}^\dagger (i \kappa r') \frac{\partial {\mathbb {F}}(r_n;r')}{\partial {r_n}}. \end{aligned}$$

Noting that \({\mathbb {G}}(r_n,r')=-\kappa {\mathbb {J}}(i \kappa r_n){\mathbb {H}}^\dagger (i \kappa r)\), we have

$$\begin{aligned} {\mathbb {F}}(r_n;r_n)= {\mathbb {U}}(r_n;r_n) [{\mathbb {H}}(i \kappa r_n)+ {\mathbb {J}}(i \kappa r_n){\mathbb {T}}^\text {int}(r_n; ik)]. \end{aligned}$$
(27)

Using Eqs. (26), (27) and the fact that \({\mathbb {T}}_{i}(ik)\) is real and symmetric, we can finally write

$$\begin{aligned} \frac{\partial {\mathbb {T}}^\text {int}(r_n; ik)}{\partial {r_n}} =-\kappa {\mathbb {W}}^\dagger _\text {int}(r_n) {\mathbb {U}}(r_n;r_n) {\mathbb {W}}_\text {int}(r_n), \end{aligned}$$
(28)

where \({\mathbb {W}}_\text {int}(r_0)\equiv {\mathbb {H}}(i \kappa r_n)+{\mathbb {J}}(i \kappa r_n){\mathbb {T}}^\text {int}(r_n; ik)\). In particular, for \(r_n=r_0\), we have

$$\begin{aligned} \frac{\partial {\mathbb {T}}^\text {int}( ik)}{\partial {r_0}}= -\kappa {\mathbb {W}}^\dagger _\text {int}(r_0) {\mathbb {U}}(r_0) {\mathbb {W}}_\text {int}(r_0). \end{aligned}$$
(29)

This nonlinear first-order differential equation is the basis of the numerical computation of \({\mathbb {T}}\) within the invariant imbedding approach. Again, it can be compared with the one found in [38] for regular scattering. Adapted to imaginary frequencies with the definitions given in Eq. (14), the derivative with respect to R of \({\mathbb {T}}^\text {ext}( i k)\) in Eq. (21) is

$$\begin{aligned} \frac{\partial {\mathbb {T}}^\text {ext}( i k)}{\partial {R}}= \kappa {\mathbb {W}}_\text {ext}^\dagger (r_0) {\mathbb {U}}(R) {\mathbb {W}}_\text {ext}(r_0), \end{aligned}$$
(30)

where \({\mathbb {W}}_\text {ext}(r_0)\equiv {\mathbb {J}}(i \kappa R)+{\mathbb {H}}(i \kappa R){\mathbb {T}}^\text {ext}( ik)\). To our knowledge, the latter was first proved in [38], where the definition of \(V(\omega ,{\mathbf {x}})\) differs from our definition by a global minus sign. Since the source is outside, the derivative is performed with respect to the smallest circumscribed sphere of the target. This equation for the transition matrix is formally identical to the so-called Calogero equation of the quantum mechanical variable phase approach [41].

As given in Sect. 2, in order to compute the Casimir-Lifshitz energy, we only need on-shell matrix elements of \({\mathbb {T}}_i\). The latter are essentially the scattering amplitudes \({\mathbb {T}}^\text {int}( ik)\) and \({\mathbb {T}}^\text {ext}( ik)\) defined in Eqs. (20) and (21). Note that for each body, we employ a different complete set of free solutions of a given frequency. For instance, these components of \(\mathbb {{T}}\) for the second object are determined by \(\langle \mathbf{E }_{a}^\text {out}, \mathbb {{T}}_2 \mathbf{E }_{a}^\text {out} \rangle \), which can be written as

$$\begin{aligned} \langle \mathbf{E }_{a}^\text {out}, \mathbb {{T}}_2 \mathbf{E }_{a}^\text {out} \rangle =\int \mathrm {d}{\mathbf {x}}\mathrm {d}{\mathbf {x}}' \mathbf{E }_{a}^\text {out*}(i k, {\mathbf {x}}') \mathbb {{T}}_2(i k,{\mathbf {x}}',{\mathbf {x}}) \mathbf{E }_{a}^\text {out}(i k, {\mathbf {x}}). \end{aligned}$$

The singular behaviour of \(\mathbf{E }_{a}^\text {out*}(i k, {\mathbf {x}})\) and \(\mathbf{E }_{a}^\text {out*}(i k, {\mathbf {x}}')\) at the origin is avoided since \(\mathbb {{T}}_2(i k, {\mathbf {x}}',{\mathbf {x}})\) is nonzero only if both \(\Vert {\mathbf {x}}\Vert \) and \(\Vert {\mathbf {x}}'\Vert \in [r_0,R]\). In this sense, if we consider the required components of \({\mathbb {T}}\) appearing in Eq. (7), i.e. if we select the appropriate subspace determined by each complete set of solutions, and apply a Hellmann–Feynman argument [42] using Eqs. (29) and (30), we can write

$$\begin{aligned} s_1\partial _{R}{\mathbb {T}}_1>0, \quad s_2\partial _{r_{0}}{\mathbb {T}}_2<0. \end{aligned}$$
(31)

We have proved the first inequality explicitly for spherically symmetric bodies in [29]. In this case, the problem is completely decoupled for \(\{\ell , m, P\}\) so the square matrices \({\mathbb {T}}^\text {ext}_{\ell m\ell ' m'}(ik)\) are diagonal.

4 Interaction pressure

There are cavity configurations in which the sum of the Casimir-Lifshitz forces on each object equals zero. This is the case for systems invariant under mirror symmetry with respect to the three spatial planes, such as the spherical one shown in Fig. 3. However, the pressure acting on the surface of the bodies does not vanish. In this sense, we will study the above-mentioned Casimir-Lifshitz interaction pressure acting on the cavity wall. The key idea is to obtain this pressure from the interaction energy given in Eq. (9). This can be achieved introducing virtual variations of the radius \(r_0\) shown in Fig. 2 [43]. Specifically, the mean value of the pressure on the wall satisfies [44]

Fig. 3
figure 3

Cross-section view of a particular case of the system shown in Fig. 1. For this spherical configuration, the sum of the Casimir-Lifshitz forces on each object equals zero

$$\begin{aligned} \langle p_\text {int} \rangle \equiv \dfrac{1}{4\pi }\int _{S^2} \mathrm {d}\varOmega \, p_\text {int}(r_{0},\varOmega ) = -\dfrac{1}{4\pi r_{0}^{2}}\frac{\partial E_\text {int}}{\partial r_{0}}. \end{aligned}$$
(32)

In this way, we can straightforwardly find the sign of \(\langle p_\text {int}\rangle \). We simply note that only \({\mathbb {T}}_2\) depends on \(r_{0}\), i.e. using the second equation of (31), we can write

$$\begin{aligned} -\partial _{r_{0}} {\mathbb {M}}=-\left( {\mathbb {G}}^{M}_{21} \sqrt{s_1{\mathbb {T}}_1}\right) ^\dagger \partial _{r_{0}}({s_2{\mathbb {T}}_2}) \left( {\mathbb {G}}^{M}_{21} \sqrt{s_1{\mathbb {T}}_1}\right) >0. \end{aligned}$$

In consequence, the derivative of the eigenvalues of \({\mathbb {M}}\) satisfy \(\partial _{r_{0}} \lambda _\alpha ~<~0\) [42] so we have

$$\begin{aligned} \text {sgn}[\partial _{r_{0}} \log (1-s\lambda _\alpha )]=s. \end{aligned}$$
(33)

Finally, from Eq. (9) and Lidskii’s theorem, we obtain \(\text {sgn}\,\partial _{r_{0}} E_\text {int}=s\), which can be written in terms of the pressure with Eq. (32) as

$$\begin{aligned} \text {sgn}\langle p_\text {int}\rangle = -s =- \text {sgn}\left[ (\varepsilon _{1}-\varepsilon _{M}\right) (\varepsilon _{2}-\varepsilon _{M})]. \end{aligned}$$
(34)

As before, we have considered permittivity functions \(\varepsilon (ik, \mathbf{x })\) such that the sign of \(\varepsilon _{i}(ik, \mathbf{x })-\varepsilon _{M}(ik)\) is independent of k and \(\mathbf{x }\), so we can write

$$\begin{aligned} s_i=\text {sgn}(\varepsilon _{i}-\varepsilon _{M})=\text {sgn}[\varepsilon _{i}(ik, \mathbf{x })-\varepsilon _{M}(ik)]. \end{aligned}$$
(35)

4.1 Consistency tests and DLP configuration

The previous result can be compared with particular configurations studied in the literature. First, for two concentric spherical shells satisfying perfectly conducting boundary conditions, a negative pressure, which tends to push the outer shell towards the inner shell, is found in [26]. The latter is obtained using the zeta function regularization method and is consistent with Eq. (34) since these idealized conditions arise in the limit of large permittivities. For the same boundary conditions, this negative pressure is also obtained from Maxwell’s stress tensor in the experimental setup suggested in [22]. Furthermore, this pressure is computed within a quantum statistical approach for a system of two spherically shaped concentric dielectrics in [20]. From the latter, it can be proved [29] that for the configuration shown in Fig. 3 with homogeneous dielectrics, the sign of the pressure is

$$\begin{aligned} \text {sgn}\, \langle p_\text {int}\rangle =\text {sgn}\!\left\{ \!\frac{-\left[ \varepsilon _1(ik)-\varepsilon _{M}(ik)\right] \left[ \varepsilon _2(ik)-\varepsilon _{M}(ik)\right] \ell (\ell +1) }{\left[ \ell \varepsilon _1(ik) +\varepsilon _{M}(ik) (\ell +1) \right] \left[ \ell \varepsilon _{M}(ik)+ \varepsilon _2(ik)(\ell +1)\right] }\!\right\} , \end{aligned}$$

which is in agreement with Eq. (34).

We conclude this section verifying Eq. (34) against the DLP result. First of all, we assume the spherical configuration of Fig. 3, and we take the limits \(r_0, r_0'\rightarrow \infty \), where the difference between the radius of the sphere and the spherical shell \(d\equiv r_0-r_0'>0\) is kept constant. With this we achieve the planar geometry [30]. Now, the sign of the force per unit area \(\text {sgn}\,F_\text {int}\) can be found from Eq. (34). We first note that

$$\begin{aligned} \text {sgn}\,F_\text {int} =-\text {sgn}\,\partial _{d}E_\text {int}=-\text {sgn}\, \partial _{r_0}E_\text {int}. \end{aligned}$$
(36)

Bearing in mind Eqs. (32) and (34), we can finally write

$$\begin{aligned} \text {sgn}\,F_\text {int} =- \text {sgn}\left[ (\varepsilon _{1}-\varepsilon _{M}\right) (\varepsilon _{2}-\varepsilon _{M})]. \end{aligned}$$
(37)

This is the DLP result cited in Sect. 1. As we have mentioned, both the repulsive and the attractive interactions resulting from this configuration have been confirmed experimentally [6]. Furthermore, we have proved that the DLP result in [10] can be extended to inhomogeneous slabs as long as Eq. (8) holds. The latter is in agreement with the result we found in [29]. In the latter, the DLP result was recovered in a similar way but computing the pressure on a sphere enclosed within an arbitrarily shaped cavity. For this configuration, we obtained

$$\begin{aligned} \text {sgn}\,E_\text {int}=\text {sgn}\,F_\text {int}=-\text {sgn}\, \langle p_\text {int}\rangle , \end{aligned}$$
(38)

where \(\langle p_\text {int}\rangle \) here denotes the mean pressure on the inner sphere.

5 Extensions

In the previous sections, we have determined the signs of the interaction energy and pressure, finding that both depend on the difference between the permittivities of the bodies and the medium in the same way

$$\begin{aligned} \text {sgn}\,E_\text {int} = \text {sgn}\,\langle p_\text {int} \rangle = -\text {sgn}\left[ (\varepsilon _{1}-\varepsilon _{M}\right) (\varepsilon _{2}-\varepsilon _{M})]. \end{aligned}$$
(39)

In this final section, we study two generalizations of the system considered so far, showing that these results remain valid with some minor changes.

Firstly, we can consider a magnetodielectric inner object. The derivation of Sect. 3 holds for a homogeneous background and a nonmagnetic scattering object. However, in order to determine \(\text {sgn}\, \langle p_\text {int}\rangle \), we have only assumed a well-defined sign of \({\mathbb {T}}_1(ik)\). Therefore, if the whole body is described by permittivity and permeability functions such that

$$\begin{aligned} s_{1}=\pm 1 \quad \text {if} \ \varepsilon _{1}(ik, \mathbf{x }) \gtrless \varepsilon _{M}(i k)\ \text {and}\ \mu _{1}(i k, \mathbf{x })~\lesseqgtr ~\mu _{M}(i k) \end{aligned}$$

the relation \(\text {sgn}\,\langle p_\text {int} \rangle =-s_1 s_2\) remains valid.

We can also extend the aforementioned results to quantum systems at thermal equilibrium. In analogy to the interaction energy, the free energy \({\mathscr {F}}_\text {int}\) satisfies [45]

$$\begin{aligned} \langle p_\text {int} (T) \rangle =-\frac{1}{4\pi r_{0}^{2}}\,\frac{\partial {\mathscr {F}}_\text {int}(T)}{\partial r_{0}}. \end{aligned}$$
(40)

In this case, we can compute \({\mathscr {F}}_\text {int}(T)\) replacing the integral in \(E_\text {int}\) by a sum over the Matsubara frequencies \(k_{n}~=~2\pi k_\text {B} {n} T\), where the zero mode is weighted by 1/2 [3]

$$\begin{aligned} {\mathscr {F}}_\text {int}= k_B T \sum _{n=0}^{\infty }{}^\prime \ \text {Tr} \log \left[ {\mathbb {I}}-s\, {\mathbb {M}}(i k_{n})\right] . \end{aligned}$$
(41)

Since the proofs of (39) apply to each fixed frequency, they will also hold for systems at thermal equilibrium.

6 Conclusions

In this paper, we have extended previous work on the sign of the interaction pressure on spherical surfaces [29]. Although the geometry considered here is different, we also find that the sign of the interaction pressure and energy changes as follows:

$$\begin{aligned} \text {sgn}\,E_\text {int} = \text {sgn}\,\langle p_\text {int} \rangle =-s= -\text {sgn}\left[ (\varepsilon _{1}-\varepsilon _{M}\right) (\varepsilon _{2}-\varepsilon _{M})]. \end{aligned}$$

This behaviour was first found in 1961 when the Casimir’s formulation for ideal metal plates in vacuum was extended to dielectric materials [10]. Our result is independent of the geometry of the objects as long as the assumption (8) on the sign of the potentials holds. In addition, since the proof applies to each frequency independently, the extension to systems at thermal equilibrium is almost immediate. Expressing the energy in terms of transition operator also enables us to generalize the previous result to a magnetodielectric inner object and to recover the DLP result, generalized to inhomogeneous slabs, as a limiting case.

In order to determine the attractive or repulsive character of the fluctuation-induced pressure acting on the cavity wall, the self-energy contribution should also be considered, as we did in [29]. Nevertheless, the interaction term itself already leads to significant implications. We can illustrate some of them considering the spherical system of Fig. 3. From [29] and Eq. (39), we conclude that the interaction term always gives rise to opposite behaviours on both spherical surfaces, i.e. \(\text {sgn}\, \langle p_\text {int}\rangle = \pm s\) on the sphere and cavity wall, respectively. For instance, when the permittivities of the objects and medium satisfy \(\varepsilon _{i}<\varepsilon _{M}<\varepsilon _{j}\), \(i,j\in \{1,2\}\), we obtain a positive interaction energy and the pressure acting on these spherical surfaces tends to repel each other. That is to say, the interaction terms tends to contract the inner surface and expand the outer one. For values of the permittivities resulting in a negative interaction energy, the pressure tends to push the inner surface to the outer one, and vice versa. For instance, this attractive behaviour necessarily arises when the objects are immersed in vacuum. From the theorem on the stability by Casimir-Lifshitz forces [17], which is also governed by the sign of \((\varepsilon _{1}-\varepsilon _{M})(\varepsilon _{2}-\varepsilon _{M})\), we know that in the previous case any equilibrium position of the two objects subject to such forces is unstable.

To end with, we note that although the configurations considered in this paper and in [29] are different, in both cases the conclusions are based on the study of the scattering amplitudes of each body. The main difference is the scattering amplitudes needed: the ones associated with an unusual scattering setup in which source and detector are inside the target in this paper and the regular ones in [29], where source and detector are outside the target. Given that the former are barely studied in the literature, we have derived all the suitable expressions using the invariant imbedding technique in Sect. 3. Indeed, although it is not necessary for studying the interaction Casimir-Lifshitz pressure, the same derivation is presented in Appendix A for configurations in which the source and the detector are in different regions, one inside and the other outside the target.