Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In Geometry 3D, How can I find the vertices with integer coordinates of a triangle whose perimeter and area are positive integers with Mathematica? Suppose its vertices $(x,y,z)$ has coordinates belong to interval $[-50,50]$

If the triangle with three sides 9, 10, 17, I choose a vertex is $(1,2,3)$ and tried

a = {x, y, z};
b = {x1, y1, z1};
c = {1, 2, 3};
{a, b, c} /. 
 Solve[{SquaredEuclideanDistance[a, b] == 9^2, 
   SquaredEuclideanDistance[a, c] == 10^2, 
   SquaredEuclideanDistance[c, b] == 17^2, -50 <= x <= 50, -50 <= y <=
     50, -50 <= x1 <= 50, -50 <= y1 <= 50}, {x, y, z, x1, y1, z1}, 
  Integers]

I tried with perimeter. Time is too long.

a = {x1, y1, z1};
b = {x2, y2, z2};
p = Norm[a] + Norm[b] + Norm[a - b];
Solve[{p == k, 
  12 <= k <= 50, -5 <= x <= 5, -5 <= y <= 5, -5 <= z <= 5, 
  5 <= x1 <= 5, -5 <= y1 <= 5, -5 <= z1 <= 5}, {x, y, z, x1, y1, 
  z1, k}, Integers]

I used Maple and found some triangles. For example $A(-6,1,2)$, $B(-9,1,2)$, $C(-9,1,6)$ or $A(1, 2, 3)$, $B(13, 21, 51)$, $C(49, 18, 15)$;

The answer of Maple http://www.mapleprimes.com/questions/200319-Perimeter-And-Area-Of-A-Triangle-Are

I love this answer.


share|improve this question
1  
Perhaps, a right triangle whose side lengths form a Pythagorean triple? Now, what that has to do with Mathematica or Geometry 3D (whatever that is), I don't know. Do you want to plot such a thing? –  Mark McClure Sep 15 '12 at 3:00
2  
So, a Heronian triangle? –  J. M. Sep 15 '12 at 3:02
4  
Dear minthao_2011: You already asked five question here, and those received good answers. But you accepted none, and never voted a question nor an answer. Please read the FAQs. Voting and accepting are important. If you don't do that. your questions will probably receive less attention and answers in the future –  belisarius Sep 15 '12 at 4:23
2  
Clearly minthao here has a different concept of "positive" from the rest of us... –  J. M. Sep 15 '12 at 10:24
    
I want to find the coordinates of the vertices $A$, $B$ and $C$. –  minthao_2011 Sep 15 '12 at 14:37
add comment

1 Answer 1

If we interpret the question to be a search for triangles with integer-valued perimeter and integer-valued area, then we can approach the problem by asking that a,b,c be the lengths of the sides with a+b+c=integer. The area needs to be calculated in terms of a,b,c. This can be done by solving the three equations:

c^2 = h^2 + b1^2;
a^2 = h^2 + b2^2;
b= b1 + b2;

Here h is the height of the triangle and the top two equations come from the pythagorean theorem. In Mathematica, we solve

Solve[{c^2 == h^2 + b1^2, a^2 == h^2 + b2^2, b == b1 + b2}, 
      {h, b1, b2}]

which gives two answers. One of the answers has h negative and one has h positive, so we can throw away the negative answer and find:

 h -> Sqrt[-a^4 + 2 a^2 b^2 - b^4 + 2 a^2 c^2 + 2 b^2 c^2 - c^4]/(2 b),
 b1 -> (-a^2 + b^2 + c^2)/(2 b), 
 b2 -> (a^2 + b^2 - c^2)/(2 b)}

The area is now 1/2 (b1+b2) h. Substituting these values in and simplifying gives

 area = 1/4 Sqrt[-(a - b - c) (a + b - c) (a - b + c) (a + b + c)]

We can now check to verify that the area is integer. Take for instance a right (3,4,5) triangle:

 area //. {a -> 3, b -> 4, c -> 5}

which has area 6.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.