Adding a second or third layer turns the quarter-wave algebra into a book-keeping exercise. The transfer-matrix method automates the book-keeping and extends cleanly to arbitrary stacks.
Characteristic matrix per layer
Each layer j has a 2×2 matrix Mj that maps the tangential field components from its top to its bottom surface:
Mj = [[ cos δj, (i / ηj) sin δj ], [ i · ηj · sin δj, cos δj ]]
(3.3.1)
with the phase thickness δj = (2π/λ)·nj·dj·cos θj and the admittance ηj = nj·cos θj for s-polarisation, ηj = nj/cos θj for p-polarisation.
From matrix product to reflectance
Multiply the layer matrices in order from top to bottom and apply the substrate admittance:
[B; C] = ( ∏j Mj ) · [1; ηs], Y = C/B
(3.3.2)
r = (η0 − Y) / (η0 + Y), R = |r|2
(3.3.3)
The TMM Simulator implements exactly this, averaging s and p for unpolarised results and applying the substrate’s complex index when the back medium is absorbing.