Whats the sum of the length of all the sides of a triangle?

You are given triangles with integer sides and one angle fixed at 120 degrees. If the length of the longest side is 28 and product of the remaining to sides is 240, what is the sum of all sides of the triangle?

I have tried to solve it using the formula given in the following link about integer triangle with 120 link

Integer triangles with a 120° angle can be generated by   Since the longest side must be opposite the largest angle in the triangle, the side which is 28 units is opposite the angle of degree measure of 120. Let us name the remaining sides $a$ and $b$. Using the cosine rule we get: $$28^2=a^2+b^2-2ab\cos(120)$$ $$784=a^2+b^2-2ab\left(\frac{-1}{2}\right)$$ $$784=a^2+b^2+ab$$ Since $ab=240$ $$a^2+b^2=544$$ We thus have the following system of equations to solve: \begin{align*}a^2+b^2&=544 \\ ab&=240\end{align*} Solving for $b$ in the latter equation $$b=\frac{240}{a}$$ Plugging into the first one gives: $$a^2+\left(\frac{240}{a}\right)^2=544$$ Multiplying both sides by $a^2$ and letting $u=a^2$ $$u^2-544u+240^2=0$$ Using the quadratic equation \begin{align*}u&=\frac{544\pm\sqrt{(-544)^2-4\cdot240^2}}{2} \\ u&=\frac{544\pm256}{2} \\ u&=144 \text{ or }400\end{align*} But since $u=a^2$, $$a^2=144 \text{ or } a^2=400$$ $$a=12 \text{ or } a=20$$ Using $b=\dfrac{240}{a}$ we thus get $a=12$ and $b=20$ or $a=20$ and $b=12$. In either case the sum of the sides is 60.
When we came to the following stage $$784=a^2+b^2+ab$$ Rather than solve for $a$ and $b$ etc. simply add $ab$ to both sides to get $$784+ab=a^2+b^2+2ab$$ Since $a^2+b^2+2ab$ is a perfect square and $ab=240$ $$1024=(a+b)^2$$ $$a+b=32$$ Therefore the sum of all the sides is $a+b+28=32+28=60$
• From $784=a^2+b^2+ab$ and $ab=240$ you get directly $(a+b)^2=784+240=1024$ and so $a+b=32$. No need to find $a$ and $b$. – lhf Jun 25 '12 at 11:14