I'm developing a web application that consists of a calculator triangles. Although I am not a mathematician, with paper, derive and Geogebra I managed to get a lot of formulas to calculate a triangle with the minimum number of data possible. Maybe some is unpublished, and limits to be introduced only correct data.

I do not get the following formulas :

  • The minimum perimeter of any triangle (abc) once known the heights corresponding to the $a$ and $b$-sides.

  • The maximum height corresponding to the side $b$ of any triangle (abc) once known the value of its perimeter and height corresponding to the $a$-side.

I am looking for an answer in a way that could be implemented in php (programming language).

  • $\begingroup$ This may not be the right place to get help implementing something in PHP... I'd try to help with the formulas, but I don't think I understand the question. $\endgroup$
    – TravisJ
    May 12, 2015 at 18:54
  • 2
    $\begingroup$ (This question was originally Google-translated from Spanish; I edited to clarify the language in some places, but not in the bullet points.) $\endgroup$
    – user147263
    May 12, 2015 at 19:07
  • $\begingroup$ I do not need help in php, I just wanted to say that I can only use simple mathematical functions such as sin, arctan, pow ... standars in all basic languages like java c ..... $\endgroup$
    – Jesús
    May 12, 2015 at 19:18
  • $\begingroup$ Let $a,b,c=a-b$ the vectors of the triangle sides. The first then is $\min |a|+|b|+|a-b|$ when $b^2-((a\cdot b)/|a|)^2=h_1^2, a^2-((a\cdot b)/|b|)^2=h_2^2$ given. Wolfram Alpha could not. $\endgroup$ May 12, 2015 at 19:30

1 Answer 1


In the first case, we may assume that the angle between the $a$ and $b$ sides is $\theta$. Then: $$ h_a = b\sin\theta,\qquad h_b = a\sin\theta \tag{1}$$ and by the law of cosines: $$ c^2 = a^2+b^2-2ab\cos\theta = \frac{h_a^2+h_b^2-2h_a h_b\cos\theta}{\sin^2\theta}\tag{2}$$ so we just have to find the stationary points of the function: $$ p(\theta) = \frac{h_a+h_b+\sqrt{h_a^2+h_b^2-2h_a h_b\cos\theta}}{\sin\theta}\tag{3}$$ over the interval $(0,\pi)$ by solving $p'(\theta)=0$ or $\frac{d}{d\theta}\frac{1}{p(\theta)}=0$. This leads to a cubic equation in $\cos\theta$, hence the problem, in general, is not solvable with straightedge and compass. When the perimeter reaches it minimum we have that $\cos\theta$ is the only root in $(-1,1)$ of:

$$ q(z) = 1 - \left(2 \frac{h_a}{h_b} + 1 + 2 \frac{h_b}{h_a}\right) z + 3 z^2 + z^3. \tag{4}$$

The second problem is just the dual problem of the first one.

  • $\begingroup$ In the first case i need maximun value of p but only i have ha and hb values no an angle. $\endgroup$
    – Jesús
    May 12, 2015 at 20:19
  • $\begingroup$ the value is a; "The maximum height corresponding to the side b of any triangle (abc) known the value of its perimeter and height corresponding to the side a." $\endgroup$
    – Jesús
    May 12, 2015 at 20:20
  • $\begingroup$ @Jesús: it is obvious that you have no angle, but $(3)$ just shows that the perimeter depends on the angle between $a$ and $b$. So by differentiating $p(\theta)$ and solving $p'(\theta)=0$ you can find the optimal angle. $\endgroup$ May 12, 2015 at 20:24
  • $\begingroup$ You can use triancal.esy.es to try and draw values, $\endgroup$
    – Jesús
    May 12, 2015 at 20:25
  • 1
    $\begingroup$ @Jesús, I gave you the polynomial is needed to solve the problem. You just have to find its real root. I do not think I will spend more time on this. $\endgroup$ May 12, 2015 at 23:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .