Optimization: maximize a triangle surface

See if anyone can help me with this: Among all triangles of perimeter equal to P, find the one with the largest area. (Hint: use the formula where , is the perimeter).

So, I have , I think that must be solved using Lagrange multipliers, at least I don't see any other way.

I've proceeded this way: ,

Well, I have done so, but all derivatives did wrong (I did arising as if and then apply the multiplier to with the 4 conditions ), it became ugly, maybe it was because of that. Anyway, would you tell me if what I did until here is ok? Greetings.