Does (the ideal class of) the different of a number field have a canonical square root? A theorem of Hecke (discussed in this question)
shows that if $L$ is a number field, then the image of the
different $\mathcal D_L$ in the ideal class group of $L$ is a square.
Hecke's proof, and all other proofs that I know, establish this essentially by
evaluating all quadratic ideal class characters on $\mathcal D_L$ and showing
that the result is trivial; thus they show that the image of $\mathcal D_L$
is trivial in the ideal class group mod squares, but don't actually exhibit a square root
of $\mathcal D_L$ in the ideal class group.
Is there any known construction (in general, or in some interesting cases) of an ideal
whose square can be shown to be equivalent (in the ideal class group) to $\mathcal D_L$.
Note: One can ask an analogous question when one replaces the rings of integers by
Hecke algebras acting on spaces of modular forms, and then in some situations I know
that the answer is yes.  (See this paper.)  This gives me some hope that there might be a construction in
this arithmetic context too.  (The parallel between Hecke's context (i.e. the number
field setting) and the Hecke algebra setting is something I learnt from Dick Gross.)
Added: Unknown's very interesting comment below seems to show that the answer is "no",
if one interprets "canonical" in a reasonable way.   In light of this,  I am going to ask another question which is a tightening of this one. 
On second thought: Perhaps I will ask a follow-up question at some point, but I think I need more time to reflect on it.  In the meantime, I wonder if there is more that one can say about this question, if not in general, then in some interesting cases.
 A: Let me point out that I would like to interpret "canonical" in a less strict sense. In order to explain what I mean, consider the following question:
Does there exist a canonical square root of $-1$ modulo primes $p = 4n+1$?
If canonical means that the result should be independent of any automorphism of the residue class group modulo $p$, then the answer is no: of $i$ is one answer, then the automorphism sending every residue class to its inverse will send $i$ to the other root $-i$. 
Yet I would accept $i \equiv (\frac{p-1}2)! \bmod p$ as an answer to the question.
Edit 2 (28.07.10) I'm still thinking about what canonical should mean in this context. The ideal class of the square root is defined up to classes of order $2$; doesn't this mean that a "canonical" choice of this ideal class should be an element in the group $Cl(K)/Cl(K)[2]$? 
Edit. Trying to generalize frictionless jellyfish's example I ended up with the following results (which so far I have only partially proved).
Let $p$ and $q$ be two prime numbers with $p \equiv q \equiv 1 \bmod 4$. There is a unique cyclic quartic extension $K/\mathbb Q$ with conductor $pq$ and discriminant $p^3q^3$.  Let $\mathfrak p$ and $\mathfrak q$ denote the prime ideals in $K$ above $p$ and $q$. Then $diff(K/\mathbb Q) = {\mathfrak p}^3 {\mathfrak q}^3$. Moreover, ${\mathfrak p}^2 {\mathfrak q}^2 = (\sqrt{pq}\,)$ is principal, so the ideal class of the different is either trivial or has order $2$.
Theorem If $(p/q) = -1$, then $  Cl_2(K) \simeq [2]$ if $p \equiv q \equiv 5 \bmod 8, $ and  $Cl_2(K) \simeq [4]$   otherwise. In both cases, the $2$-class field of $K$ is abelian over $\mathbb Q$, hence is equal to its genus class field.
The ideal classes of each of the prime ideals above $\mathfrak p$ and $\mathfrak q$ generates the $2$-class group.
Taking $p=5$ and $q = 17$ gives an example of a "non-canonical" square root. I have not yet found a criterion that would tell me when the different is principal and when its class has order $2$. Both cases do occur.
The case where $p$ and $q$ are quadratic residues of each other is more involved, more interesting (and more conjectural):
Theorem Assume that $(p/q) = +1$, and that $p \equiv q \equiv 5 \bmod 8$. Then
$Cl_2(K) \simeq [2,2]$ if  $(p/q)_4 (q/p)_4 = -1$, $Cl_2(K) \simeq [4] $  if  $(p/q)_4 = (q/p)_4 = -1$, and $Cl_2(K) \simeq [2^n], \ n \ge 3$ if $(p/q)_4 = (q/p)_4 = +1$.
If $(p/q)_4 = (q/p)_4 = -1$, then the ideal classes $[\mathfrak p]$ and $[\mathfrak q]$ are squares, but not fourth powers; in particular, the different is principal.
If $(p/q)_4 = (q/p)_4 = +1$, there are two cases:


*

*$h_2(K) = h_2(k)= 2^n$; then $[\mathfrak p]$ and $[\mathfrak q]$ both have order $2$, and the different is principal.

*$h_2(K) = 2h_2(k)= 2^n$; then either $\mathfrak p$ or $\mathfrak q$ is principal, whereas the other ideal generates a class of  order $2$. In particular, the ideal class of the different has order $2$.

A: Recently the following was explained to me by Melanie Wood.  (What follows is a summary of some results from her preprint here; see in particular the discussion at the top of page 3.)
If $f$ is a primitive irreducible binary $n$-ic form with coefficients in $\mathbb Z$, then we can consider the locus $S_f$ in $\mathbb P^1_{\mathbb Z}$ that $f$ cuts out.  This will be finite over $\mathbb Z$, and hence is equal to Spec $R$, where $R = H^0(S_f, \mathcal O)$.  The finite $\mathbb Z$-algebra $R$ will be an order in a number field of degree $n$. Not all orders in all number fields arise this way (if $n >3$), but certainly some do!
Now it turns out that restriction of $\mathcal O(n-2)$ to $S_f$ (which is an invertible sheaf on $S_f$, and hence gives an ideal class of $R$) is canonically isomorphic to the inverse different of $R$, and hence if $n$ is even then we can consider the restriction to $S_f$ of $\mathcal O((n-2)/2)$, and so obtain a square root of the inverse different of $R$.
As is explained in the above linked preprint, $R$ alone does not suffice to determine $f$; rather $f$ is determined by $R$ together with some extra ideal-theoretic strucure. So (as far as I know) this construction of the square root does not depend on $R$ alone, but on extra data.
Nevertheless, it gives a very interesting answer to my question in those cases where it applies.
A: Since you asked for special cases where something was known, I'd like to mention this paper which I happened to come across :
MR2019023 (2004j:11135)
Vinatier (Stéphane),
Sur la racine carrée de la codifférente. 
Les XXIIèmes Journées Arithmetiques (Lille, 2001).
J. Théor. Nombres Bordeaux 15 (2003), no. 1, 393--410
which begins by stating that the codifferent of an odd-degree galoisian extension $N|{\bf Q}$ has a canonical square root.
A: ADDED: As pointed out in the exchange of comments by unknown and KConrad, unknown's example
doesn't work as stated.  Nevertheless, it suggests a concrete test for one interpretation of
the question, which might be interesting to investigate.

In light of unknown's very interesting comment above, it seems that the question asked has the answer "no" in general, at least under one very reasonable interpretation of "canonical".

A: The following example shows that, in its strongest form, the answer to Professor Emerton's question is no. This answer is essentially an elaboration on what is already in the comments.
Let $p \equiv q \equiv 5 \pmod 8$. Let $K/\mathbb{Q}$ be a cyclic
extension of degree four totally ramified at $p$ and $q$ and unramified
everywhere else (it exists). To make life easier, suppose that the $2$-part of the class
group of $K$ is cyclic.
The Galois group of $K$ is
$G = \mathbb{Z}/4 \mathbb{Z}$.
Let $C$ denote the class group of $K$. I claim that $C^G$ is cyclic
of order two. Since the $2$-part of $C$ is cyclic, 
this is equivalent to showing that $C_G$ is cyclic of order two.
By class field theory, $C_G$ corresponds to a Galois extension
$L/\mathbb{Q}$ unramified everywhere over $K$ such that there is an exact sequence
$$1 \rightarrow C_G \rightarrow \mathrm{Gal}(L/\mathbb{Q})
\rightarrow \mathbb{Z}/4 \mathbb{Z} \rightarrow 1.$$
If $\Gamma$ is any finite group with center $Z(\Gamma)$, then an easy
exercise shows that $\Gamma/Z(\Gamma)$ is cyclic only if it is trivial.
We deduce that $L$ is the genus field of $K$. 
There is a degree four extension $M/L$ contained inside the cyclotomic field
$\mathbb{Q}(\zeta_p,\zeta_q)$ that is unramified over $K$ at all finite
primes. However, the congruence conditions on $p$ and $q$ force $K$ to be
(totally) real and $M$ (totally) complex. Thus $M/K$ is ramified at
the infinite primes, and $C_G = \mathbb{Z}/2\mathbb{Z}$, and the claim is established.
We note, in passing, that $L = K(\sqrt{p}) = K(\sqrt{q})$.
Suppose there
exists a canonical element $\theta \in C$ such that $\theta^2 = \delta_K$,
where $\delta_K$ is the different of $K$.
The different $\delta_K$ is invariant under $G$. If $\theta$ is
canonical in the strongest sense then it must also be invariant under $G$. In particular,
the element $\theta \in C^G$ must have order dividing two, and hence $\theta^2 = \delta_K$
must be trivial in $C$. We conclude that if $\delta_K$ is not principal,
no such $\theta$ exists.
It remains to show that there exists primes $p$ and $q$ such that
$\delta_K$ is not principal and the $2$-part of $C$ is cyclic. A computation shows this is so for
$p = 13$ and $q = 53$. For those playing at home, $K$ can be taken to be
the splitting field
of 
$$x^4 + 66 x^3 + 600 x^2 + 1088 x - 1024,$$
where $C = \mathbb{Z}/8 \mathbb{Z}$ and $\delta_K = [4]$. $C$ is generated by (any) prime
$\mathfrak{p}$ dividing $2$, and $G$ acts on $C$ via the quotient $\mathbb{Z}/2\mathbb{Z}$, sending $\mathfrak{p}$ to $\mathfrak{p}^3$.
A: Let $N/K$ be a finite Galois extension of number fields, with Galois group $G$, then Hilbert's formula for the valuation of the different at a prime ideal $P$ of $N$ states that:
$$v_P(D)=\sum_{i\geq 0}(|G_i(P)|-1)$$
where $G_i(P)$ is the $i$-th ramification group (in lower notation) at $P$ in $N/K$, and $|G_i(P)|$ is its order. The sum is finite since $G_i(P)=\{1\}$ for large $i$; it is an even integer if $G$ is of odd order, since this forces its subgroups $G_i(P)$ to be of odd order as well for any $i$, any $P$.
It follows that, in any odd degree Galois extension of number fields, there exists a fractional ideal whose square equals the inverse different. This fractional ideal, known as the "square root of the inverse different", has rich properties as a Galois module and as an hermitian module, which were first revealed and studied by Boas Erez, see e.g.
MR1128708 (92g:11108) Erez, B. The Galois structure of the square root of the inverse different. Math. Z. 208 (1991), no. 2, 239–255.
In conclusion we get a bit more than what was asked in the odd degree Galois extension case (an ideal whose square equals the inverse different, not only with the same class). But this does not say anything in the even degree or non-Galois case. 
