Solution (source code)

= Solution

Use the <thin lens> sign convention in which a real object on the incident side has positive object distance, a real image on the outgoing side has positive image distance, and a converging <lens> has positive <focal length>. The first image distance is
$$
v_1=\frac{f_1d_1}{d_1-f_1}.
$$
For the <image distance for two separated thin lenses>, the second <lens> has object distance $u_2=L-v_1$, which can be negative when its intermediate object is virtual. Applying the <thin lens> equation again gives
$$
\boxed{d_2=\frac{f_2u_2}{u_2-f_2}
=\frac{f_2[(L-f_1)d_1-Lf_1]}{(L-f_1-f_2)d_1+f_1f_2-Lf_1}.}
$$
The image is $d_2$ beyond the second <lens> when $d_2>0$; $d_2<0$ denotes a virtual image on its incident side. A vanishing denominator with nonzero numerator denotes an image at infinity. The rational expression also supplies appropriate limits when the first image is at infinity; for example, $d_1=f_1$ gives $d_2=f_2$ for finite nonzero <focal lengths>.

As $L\to0$, the effective <focal length> is $F=f_1f_2/(f_1+f_2)$ and
$$
\boxed{d_2=\frac{Fd_1}{d_1-F}.}
$$
For a real incident object, $d_1>0$, and positive $F$, the real-image condition is exactly $d_1>F$, yielding the requested inequality. This includes two converging <optical lens>[lenses]. The positivity assumption matters: with $f_1=f_2=-1\,\mathrm m$ and $d_1=1\,\mathrm m$, one has $F=-0.5\,\mathrm m$ and $d_1>F$, but $d_2=-1/3\,\mathrm m$ is virtual. If $f_1+f_2=0$, the touching pair has zero net optical power and produces no real image of this real object in the ideal <thin lens> model.