Solution (source code)

= Solution

Use $R=\mathcal O_k$, $S=\mathcal O_L$, $T=\mathcal O_K$, and denote their relative <codifferents> by $C_{L/k}$, $C_{K/L}$ and $C_{K/k}$. Transitivity of the <field trace> gives
$$
x\in C_{K/k}\quad\Longleftrightarrow\quad\operatorname{Tr}_{K/L}(xT)\subseteq C_{L/k}.
$$
For the forward direction, testing an element $t\in T$ against every $s\in S$ is legitimate because $st\in T$. For the reverse direction, take $s=1$ and use trace transitivity.

Localize at a nonzero base <prime ideal>. The intermediate ring is semilocal <Dedekind domain>, so its invertible <fractional ideal> $C_{L/k}$ is principal there, say $C_{L/k}=d^{-1}S$ locally. This principality follows by choosing, with the <Chinese remainder theorem for ideals>, a generator at each of its finitely many maximal ideals. The displayed criterion now becomes
$$
x\in C_{K/k}\quad\Longleftrightarrow\quad dx\in C_{K/L},\qquad C_{K/k}=d^{-1}C_{K/L}=C_{K/L}C_{L/k}T.
$$
Invert these <fractional ideals> using Solution 1. Equality at every base localization gives the global <different in a tower> formula
$$
\boxed{\mathfrak D_{K/k}=\mathfrak D_{K/L}\bigl(\mathfrak D_{L/k}\mathcal O_K\bigr).}
$$
The second factor is extended to the upper <ring of integers>; that extension is implicit in the printed formula. At a local prime the exponents consequently satisfy $d(K/k)=d(K/L)+e(K/L)d(L/k)$.