A compound optical system becomes much easier to understand when it is treated as a sequence of individual elements, each of which forms an image that becomes the object for the next stage. This is the core idea behind a compound ray tracer.
Instead of trying to solve a complicated multi-element system in one step, we solve it successively.
For each thin lens or spherical mirror in the paraxial approximation, the same Gaussian imaging equation is used:
\[
\frac{1}{f}=\frac{1}{d_o}+\frac{1}{d_i}.
\]
Here \(f\) is the signed focal length, \(d_o\) is the signed object distance for that stage, and \(d_i\) is the signed image distance produced by that element.
In this calculator, the sign of the focal length is set automatically from the element type:
\[
\text{converging lens: } f>0,\qquad
\text{diverging lens: } f<0,
\]
\[
\text{concave mirror: } f>0,\qquad
\text{convex mirror: } f<0.
\]
Once the image from one stage is found, its position becomes the object position for the next element. This makes the system naturally recursive.
Lenses preserve the direction of propagation, while mirrors reverse it. That is why a sequence containing a mirror can make the optical path fold back along the bench.
Magnification is also computed stage by stage. For a single lens or mirror, the transverse magnification is
\[
m=-\frac{d_i}{d_o}.
\]
The total magnification of the whole system is therefore the product of the stage magnifications:
\[
m_{\text{total}}=m_1m_2m_3\cdots.
\]
The sign of the total magnification tells you whether the final image is upright or inverted relative to the original object, while the magnitude tells you whether the image is enlarged or reduced.
The ray diagram in this calculator uses three standard “principal-style” seed rays from the top of the initial object:
1. A ray initially parallel to the axis.
2. A ray initially aimed toward the focal reference of the first element.
3. A center or vertex ray aimed at the central point of the first element.
These three rays are then propagated successively through every element in the sequence. At each lens or mirror, the ray slope is updated using a first-order paraxial rule rather than exact surface refraction geometry.
This keeps the diagram fast, stable, and educationally clear, while remaining consistent with the same first-order imaging equations used for the stage calculations.
A useful point to remember is that the phrase “principal rays” is most exact for single-lens or single-mirror textbook diagrams. In a multi-element system, those same initial rays are no longer literally “the” principal rays of the entire compound system.
Still, they remain very useful as seed rays because they help visualize how a bundle evolves through multiple optical components.
For example, consider a two-lens sequence. Lens 1 forms an image of the object. That image may be real or virtual depending on the object distance and focal length.
Then Lens 2 sees that image as its new object. If the image from Lens 1 lies on the incoming side of Lens 2, Lens 2 has a real object. If it lies on the opposite side, Lens 2 has a virtual object.
The same logic extends naturally to three or more elements.
When a mirror appears in the sequence, the direction of light propagation flips. The next element in the chain is therefore placed in the reflected direction.
This allows the calculator to preview folded optical benches in a simple schematic way, which is useful for thinking about relay systems, folded paths, and mirror-assisted imaging arrangements.
This calculator is intentionally a thin-element paraxial preview. It does not attempt thick-lens modeling, exact Snell-law surface tracing, or matrix optics with principal planes.
Those topics become important at more advanced university level, especially for zoom systems, thick compound objectives, and aberration analysis.
But the present tool still captures the central idea:
\[
\text{image formation in a compound system is built one stage at a time.}
\]
That is why a compound ray tracer is so useful educationally. It connects the familiar one-element formulas from geometric optics to the richer behavior of real optical benches, where light passes through more than one lens or mirror before the final image is formed.