How to multiply and reduce ideals in quadratic number ring. I am studying quadratic number rings and I have a problem with multiplying and reducing ideals, for example:

Let $w=\sqrt{-14}$. Let $a=(5+w,2+w)$, $b=(4+w,2-w)$ be ideals in $\mathbb Z[w]$. Now, allegedly, the product of ideals $a$ and $b$ in $\mathbb Z[w]$ is $(6,3w)$. Please explain clearly, how to get to $(6,3w)$.

 A: In general, if you multiply the ideals $\mathbf{a} = (a_1, a_2, \dots, a_n)$ and $\mathbf{b} = (b_1, b_2, \dots, b_m)$ then the result is
$$\mathbf{a} \cdot \mathbf{b} = (a_i b_j)_{1 \le i \le n, 1 \le j \le m}$$
Thus, in this special case we have
\begin{align*}
\mathbf{a} \cdot \mathbf{b} & = ((5 + w) (4 + w), (5 + w) (2 - w), (2 + w) (4 + w), (2 + w) (2 - w))\\
& = (6 + 9w, 24 - 3w, -6 + 6w, 18).
\end{align*}
It is not hard to reduce this further. First, we see that the difference of the second and fourth generator is $6 - 3w$. Adding this to the third generator gives $3w$. Now if we subtract $3 \cdot 3w$ from the first generator we get $6$. Hence
$$(6, 3w) \subset \mathbf{a} \cdot \mathbf{b}.$$
It is also easy to see that the four generators above are all generated by $6$ and $3w$, which gives equality.
A: You reduce an ideal by adding a multiple of one generator to another with the goal of simplifying things (making the numbers smaller and removing appearances of $w$)
First, reduce $a$ and $b$ :
$a = (5+w,2+w) = (3,2+w) \\ b = (4+w,2-w) = (6,2-w)$
Then, multiply every generator of $a$ with veery generator of $b$, and remove the $w^2$ terms :
$ab = (18, 6-3w,12+6w,4-w^2) = (18,6-3w,12+6w,18)$
Then reduce :
$ab = (18,6-3w,12+6w) = (18,6-3w,24) = (18,6-3w,6) = (6,3w)$
A: I have a script written with the GAP system that does things like this :    
product:=function ( I, J )
    local  car, pr;
    car := Cartesian( I, J );
    pr := List( car, Product );
    pr := List( pr, coeff );
    pr := BaseIntMat( pr );
    return Basis( Nf, List( pr, v->v * B));
end    
Here I and J are two bases for the ring of integers. The script makes all possible products and selects a minimum number of vectors as a basis for the vector space spanned by the products (and such that the coefficients of these product have integer coefficients in this basis). This is done by the built-in function BaseIntMat.
