<s>[INST] How to simplify this formula I have this equation: $\frac{\sqrt{(a+b+\sqrt{a^2+b^2-2ab\cos\gamma})(-a+b+\sqrt{a^2+b^2-2ab\cos\gamma})(a-b+\sqrt{a^2+b^2-2ab\cos\gamma})(a+b-\sqrt{a^2+b^2-2ab\cos\gamma})}}{4}$
It calculates the area of a triangle using only 2 sides of a triangle $a, b$, and the angle of those sides, $\gamma$. It simply combines the law of cosines and Heron's Formula.
Is there any way to achieve the same function, and is it possible to simplify this equation?
 [/INST] Let $c = \sqrt{a^2+b^2-2ab\cos\gamma}$ and $P_1,P_2,P_3,P_4$ be the 4 factors inside the square root. Notice

*

*$P_1 P_4 = (a+b+c)(a+b-c) = (a+b)^2 - c^2 = 2ab(1+\cos\gamma)$,

*$P_2 P_3 = (-a+b+c)(a-b+c) = c^2-(a-b)^2 = 2ab(1-\cos\gamma)$
We have
$$\frac{\sqrt{P_1P_2P_3P_4}}{4}
= \frac{\sqrt{(2ab)^2(1-\cos^2\gamma)}}{4}
= \frac12 ab\sin\gamma$$
</s>