Given lengths of two sides of triangles $a$ and $b$, I want to calculate the number of possible integral values of length of third side $c$.

I know that range should be : $a-b<c<a+b$, given $a>b$.

Now this is full range for that third side but it also side which will make degenerate triangle $(Area\le 0)$. How do I exclude those sides which make degenerate triangle ?

  • 2
    $\begingroup$ What you have suffices. All we need is for the triangle inequality to hold and your conditions guarantee that all three versions do in fact hold. $\endgroup$ – lulu Feb 7 '17 at 18:37
  • $\begingroup$ @lulu How does this excludes length of third side that will make degenerate triangles ? $\endgroup$ – sammy Feb 7 '17 at 18:40
  • $\begingroup$ In order for the triangle to degenerate, you'd need the three vertices to be co-linear. If you draw what that would mean, you'd see that it would require either $c=a+b$ or $c=a-b$ $\endgroup$ – lulu Feb 7 '17 at 18:42
  • 2
    $\begingroup$ Maybe it helps to see how to construct the triangle, given your $a,b,c$. To do it, take a segment of length $c$. draw a circle centered at one endpoint with radius $a$ and another circle centered on the other endpoint with radius $b$. If the circles intersect, we have our third vertex. how can they not intersect? Well, the two circles might be too small (i.e. $c>a+b$) or one circle might entirely contain the other (i.e. $c<a-b$). Both are excluded by your conditions. $\endgroup$ – lulu Feb 7 '17 at 18:45
  • $\begingroup$ @lulu Thanks for the explanation. I got it now. $\endgroup$ – sammy Feb 7 '17 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.