Finding the third side of a triangle given the area

I know the area and the lengths of two sides (a and b) of a non-right triangle. I also know P1 (vertex between a and c) and P2 (vertex between a and b).

Perimeter = $\frac{(a+b+c)}{2}$

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

How do I simplify the above two equations to solve for c? (Obviously, this is just algebra, but it's long enough that it is prone to error; I've tried this by hand now and gotten a different set of solutions each time.)

• The angle $\theta$ between $a$ and $b$ is not fixed, hence neither it is the area $$\Delta = \frac{1}{2}ab\sin(\theta).$$ – Jack D'Aurizio Jun 27 '16 at 17:42
• Given two sides and area, most of the time when there is a triangle with these properties, there are exactly two. – André Nicolas Jun 27 '16 at 17:43
• It is not very clear what is given and what is not. We have to find $c$ given $a,b,p$, or $a,b,\Delta$, or something else? – Jack D'Aurizio Jun 27 '16 at 17:49

Suppose we know $$K = |\triangle ABC|, \quad a, b,$$ and we wish to determine $c$. Then \begin{align*} 16K^2 &= (a+b+c)(-a+b+c)(a-b+c)(a+b-c) \\ &= \left((a+b)^2 - c^2 \right)\left(c^2 - (a-b)^2 \right) \\ &= -c^4 + \left( (a-b)^2 + (a+b)^2 \right) c^2 - (a+b)^2 (a-b)^2 \\ &= -c^4 + 2(a^2 + b^2) c^2 - (a^2 - b^2)^2. \end{align*} This of course is a quadratic in $c^2$. We can complete the square to get \begin{align*} 0 &= (c^2 - (a^2+b^2))^2 + (a^2-b^2)^2 - (a^2+b^2)^2 + 16K^2 \\ &= (c^2 - (a^2+b^2))^2 - 4a^2 b^2 + 16K^2, \end{align*} from which we obtain $$c^2 = a^2 + b^2 \pm 2\sqrt{a^2 b^2 - 4K^2}.$$ Note that we must always have $ab \ge 2K$, as the area of the triangle is maximized when the angle between sides of fixed length $a$ and $b$ is right; thus the square root is always well-defined. Furthermore, the AM-GM inequality guarantees that when $a, b > 0$, $a^2 + b^2 \ge 2 \sqrt{a^2 b^2}$, hence $c^2$ admits exactly two positive solutions whenever the strict inequality $ab > 2K$ is satisfied, and one unique solution when $ab = 2K$ and the triangle is right.

$$s\;$$ is the conventional way of representing the semiperimeter $$\frac{a+b+c}2$$ of the triangle with sides $$a\,,b\,,c$$.

$$\sqrt{s(s-a)(s-b)(s-c)}= \frac{\sqrt{-a^4-b^4-c^4+2b^2c^2+2c^2a^2+2a^2b^2}}4=\Delta$$

Solving for $$c$$, $$c=\sqrt{a^2+b^2\pm 2\sqrt{a^2b^2-4\Delta^2}}$$

where area $$=\Delta$$

By cosine rule, \begin{align} c^2&=a^2+b^2-2ab\cos\gamma \tag{1}\label{1} , \end{align}
And from the formula for the area \begin{align} 2S&=ab\sin\gamma ,\\ \sin\gamma&=\frac {2S}{ab} , \end{align}

so, with \begin{align} \cos\gamma&=\pm\sqrt{1-\sin^2\gamma} = \pm\sqrt{1-\frac {4S^2}{a^2b^2}} =\pm\frac{\sqrt{a^2b^2-4S^2}}{ab} \end{align}

\eqref{1} becomes

\begin{align} c^2&=a^2+b^2\pm2\sqrt{a^2b^2-4S^2} . \end{align}