An equality on the sum, the intersection and the product of ideals We know that in the ring $\mathbb{Z}$, the following equality holds
$$
(I+J)(I \cap J) = (IJ)
$$
for any ideals $I$ and $J$ in $\mathbb{Z}$. It can interpreted as the fact that for any two integers $a$ and $b$,
$$
\mathrm{lcm}(a,b) \times \gcd (a,b) = ab.
$$
My question is this : Can we generalize this equality to some broader contexts? For example, does this equality holds in an arbitary PID (principal ideal domain) or UFD (unique factorization domain)? Does this equality holds in an arbitary Dedekind domain, etc..
My Ideas and Attempts:

*

*It remains to be true in any PID, as we can directly use the same proof as in proving the fact on the lcm and gcd of two integers.


*I do not think that the statement holds in any UFD. But I am not able to provide any counterexample on this and I'm hoping to get one in this question.


*Yet does it ture that for any principal ideals in an UFD, the equality remains to be true? (I haven't proved the above claim.)


*Since the ring of integers in algebraic number theory is a generalization of the ring $\mathbb{Z}$ in number fields (finite extension of $\mathbb{Q}$), does such equality holds in Dedekind domains (or at least the ring of integers $\mathcal{O}_K$ for any number field $\mathbb{K}$ over $\mathbb{Q}$)?
I have calculated for some rings, for example the ring of integers $R = \mathbb{Z}[\sqrt{-5}]$. In the ring $R$,
$$(2) = (2, 1+\sqrt{-5})^2 =: \mathfrak{p}_1^2, $$
$$(3) = (3, 1+\sqrt{-5})(3, 2+\sqrt{-5}) =: \mathfrak{p}_2 \mathfrak{p}_2^\prime, $$
$$(5) = (5, \sqrt{-5}) =: \mathfrak{p}_3^2.$$
Then consider the ideals
$$ I = (3) \mathfrak{p}_1 = \mathfrak{p}_2 \mathfrak{p}_2^\prime \mathfrak{p}_1 $$
and
$$ I = (5) \mathfrak{p}_1 = \mathfrak{p}_3^2 \mathfrak{p}_1 . $$
Hence,
$$
I + J = \mathfrak{p}_1 \mathfrak{p}_2 \mathfrak{p}_2^\prime \mathfrak{p}_3,
$$
$$
I \cap J = \mathfrak{p}_1 \mathfrak{p}_2 \mathfrak{p}_2^\prime \mathfrak{p}_3^2.
$$
Thus,
$$
(I+J)(I \cap J) = \mathfrak{p}_1^2 (\mathfrak{p}_2 \mathfrak{p}_2^\prime)^2 \mathfrak{p}_3^3 = (450, 90 \sqrt{-5}),
$$
which is not a principal ideal. (I am not sure on this.) Yet
$$
IJ = \mathfrak{p}_1^2 \mathfrak{p}_2 \mathfrak{p}_2^\prime \mathfrak{p}_3^2 = (30),
$$
which is a principal ideal. Hence such equality does not hold in $R$. This is very strange to me, since the ring of integer is a generalization of $\mathbb{Z}$.
Thank you in advance for your answers and sorry for the possible mistakes in this question.
Correction:
In my example, the second ideal should be denoted by $J$ instead of $I$, i.e.
$$ J = (5) \mathfrak{p}_1 = \mathfrak{p}_3^2 \mathfrak{p}_1 . $$
And I make a mistake in calculating $I+J$. $I+J$ should be $\mathfrak{p}_1$, and then the equality does hold in this case. Thanks @GreginGre for pointing this out!
 A: You have some mistakes in your computation. It is $I+J=\mathfrak{p}_1$  and then$(I+J)I\cap J=(30)=IJ$.
Anyway, in a Dedekind domain, your equality is indeed true, since $v_\mathfrak{p}(I+J)=\min(v_\mathfrak{p}(I),v_\mathfrak{p}(J))$ and $v_\mathfrak{p}(I\cap J)=\max(v_\mathfrak{p}(I),v_\mathfrak{p}(J))$.
To see it: $I+J$ is the smallest ideal $K$ (for the inclusion) containing both $I$ and $J$. But containing is dividing in a Dedekind domain, so $I+J$ is the smallest ideal $K$ dividing $I$ and $J$, meaning $v_\mathfrak{p}(I)\geq v_\mathfrak{p}(K)$ and  $v_\mathfrak{p}(J)\geq v_\mathfrak{p}(K)$ for all $\mathfrak{p}$, that is the smallest ideal $K$ such that $v_\mathfrak{p}(K)\leq\min(v_\mathfrak{p}(I),v_\mathfrak{p}(J))$. Since the bigger power of $\mathfrak{p}$, the smaller $K$ is, you get the first equality. The second one can be proven the same way.
A: The property you're asking about basically says that locally the ring has totally ordered ideals, modulo some appropriate zero divisors.  When we restrict attention to domains, we recover the familiar notion of a Prüfer domain, i.e. a domain which is locally a valuation ring.  Your observation that Dedekind domains have this property is a special case of this fact. Following is a precise characterization.

Let $(*)$ denote the property that $(I + J)(I \cap J) = IJ$ for every pair of ideals $I,J$.

First check that $(*)$ is equivalent to the property that for every pair of elements $a,b$, $(aR + bR)(aR \cap bR) = abR$.  This element-wise formulation will be easier to work with.
Note also that $(I + J)(I \cap J) \subseteq IJ$ for any pair of ideals $I,J$ and any ring $R$.  Since being a surjection is a local property, and since localization distributes over ideal intersection, multiplication, and addition, we see that

$R$ has $(*)$ iff $R_\mathfrak{p}$ has $(*)$ for every maximal ideal $\mathfrak{p}$ of $R$.

We can thus restrict attention to local rings.  We prove the following:

Lemma: A local ring $R$ has $(*)$ if for every pair of elements $a,b$, one of the following holds:
$(1) \ \ a \mid b$
$(2) \ \ b \mid a$
$(3) \ \ ab = 0$.

Proof:
Verifying the identity in $(*)$ is trivial under the assumptions (1)-(3).  Conversely, let $a, b \in R$ and suppose that $(aR \cap bR)(aR + bR) = abR$.  Thus we can write $ab = c (ad + be)$ with $c = a'a = b'b$.  So $ab = b'bad + a'abe$ and  rearranging we get $ab(1 - b'd - a'e) = 0$.  If $1 - b'd - a'e$ is not a unit, then $b'd + a'e$ is a unit, hence one of $b'$ or $a'$ is a unit and accordingly either $a \mid b$ or $b \mid a$.  Otherwise, $1- b'd - a'e$ is a unit, and $ab = 0$.
To elaborate on my initial remarks and connect this with more well-known terminology:  the domains with $(*)$ are precisely the Prüfer domains.  Within the class of rings which are locally domains (equivalently, have flat principal ideals), $(*)$ characterizes the rings with weak global dimension $1$ (equivalently, which have all ideals flat).  More generally, any arithmetical ring has $(*)$, but the converse absolutely need not hold.  For example, the ring $k[x,y]/(x², xy, y²)$ is a local $0$-dimensional ring with $(*)$ that is very much not arithmetical.
