Ta có:
\(D=a^2+b^2+c^2+ab+bc-ca\)
\(\Leftrightarrow D=\left(\frac{a}{\sqrt{2}}+\frac{b}{\sqrt{2}}\right)^2+\left(\frac{b}{\sqrt{2}}+\frac{c}{\sqrt{2}}\right)^2+\left(\frac{a}{\sqrt{2}}-\frac{c}{\sqrt{2}}\right)^2\)
Mà \(\left\{{}\begin{matrix}a+b=5\\b+c=-7\\a-c=12\end{matrix}\right.\)\(\Leftrightarrow\left\{{}\begin{matrix}\left(a+b\right)^2=25\\\left(b+c\right)^2=49\\\left(a-c\right)^2=144\end{matrix}\right.\)
\(\Rightarrow D=\frac{25}{2}+\frac{49}{2}+\frac{144}{2}=109\)