Solution (source code)

= Solution

Let
$$
\Delta=A\cdot(B\times C).
$$
Linear independence implies that the <scalar triple product> $Delta$ is nonzero. Applying the vector triple-product formulas to $(A\times B)\times(C\times D)$ recovers the coefficients of $D$ in the basis $A,B,C$. Equivalently, the <reciprocal basis> to $A,B,C$ is
$$
\frac{B\times C}{\Delta},\qquad
\frac{C\times A}{\Delta},\qquad
\frac{A\times B}{\Delta}.
$$
Taking scalar products with $D$ therefore yields
$$
\boxed{
D=
\frac{D\cdot(B\times C)}{\Delta}A
+\frac{D\cdot(C\times A)}{\Delta}B
+\frac{D\cdot(A\times B)}{\Delta}C}.
$$