# simplify Heron's formula with Semiperimeter

Heron's formula states that the area of a triangle whose sides have lengths a, b, and c $A=\frac{1}{4} \sqrt{(-a+b+c) (a+b-c) (a-b+c) (a+b+c)}$

if p is the semiperimeter of the triangle, that is $2 p=a+b+c$

it can be written

$A=\sqrt{p (p-a) (p-b) (p-c)}$

I want to use FullSimplify deal with this

FullSimplify[
1/4 Sqrt[-a^4 + 2 a^2 b^2 - b^4 + 2 a^2 c^2 + 2 b^2 c^2 - c^4],
2 p == a + b + c]


returns

Sqrt[-(b - p) (b + c - p) p (-c + p)]

How can I get Sqrt[p (p - a) (p - b) (p - c)] ?

Maybe with this?:

Simplify@(1/4 Sqrt[(-a + b + c) (a + b - c) (a - b + c) (a + b + c)] /.
(#[[2]] -> 2 p - #[[1]] & /@ Transpose@{{c, b, a},
DeleteDuplicates@(Plus @@@ Permutations[{a, b, c}, {2}])}))


$$\sqrt{p (-a + p) (-b + p) (-c + p)}$$

I have created different combination patterns with p, a, b and, c for substitution rules.

Obviously, this would also work in a simpler way:

FullSimplify[1/4 Sqrt[-a^4 + 2 a^2 b^2 - b^4 + 2 a^2 c^2 + 2 b^2 c^2 - c^4],
2 p == a + b + c] /. b + c -> 2 p - a


$$\sqrt{p (p-a) (-(b-p)) (p-c)}$$