Recall that the norm of an element a of K is the product of all conjugates of a. We can similarly define the trace to be the sum of all conjugates. Clearly, tr(a + b) = tr(a) + tr(b). If we restrict ourselves to conjugates that fix some subfield F of K, then we also have tr(ka) = ktr(a) whenever k is in F; over Q this condition is unnecessary because the multiplicative structure of Q is completely determined by its additive structure. Since tr(a) is invariant under taking conjugates of a, it must be rational; further, if a is an algebraic integer, then tr(a) is the sum of algebraic integers, so that it’s an integer.
Now, we can define a function on pairs of elements in K by tr(ab). This is a bilinear form, i.e. a function such that for a fixed a, f(b) = tr(ab) is a linear transformation from K to Q, and similarly for a fixed b. We’re interested in what kinds of a‘s will give us integers.
The inverse different, I, is the set of all elements a in K such that tr(ab) is in Z whenever b is in O(K). I is closed under addition since tr((a + c)b) = tr(ab) + tr(cb), and under multiplication by elements of O(K) since tr(acb) = tr(a(cb)) and cb is in O(K).
Note that a is in I iff tr(ab(i)) is in Z where the elements b(i) are an integral basis of O(K), so that a is in I iff its b(i)-coefficients satisfy a list of linear equations with integer coefficients. This is enough to show that for some n, nI is contained in O(K), so that I is a fractional ideal.
Whenever a is in O(K), ab is in O(K) so tr(ab) is an integer, and I contained O(K). Since O(K) is a Dedekind domain, every fractional ideal of it is invertible, so we can let D be the inverse of I. Since I contains O(K), D is contained in O(K), i.e. it’s an integral ideal of O(K). We call that ideal the different.
The different is important because a) the norm of D is the absolute value of the discriminant of K and b) a prime ideal P is ramified in K iff it divides D; this immediately implies that the prime p ramifies in K iff it divides d(K). Both parts are proved by showing that the different and discriminant remain the same even after localizing and taking completion, and then showing that they hold for local fields, where tools like Hensel’s lemma make things easier.