# How to delete duplicate solutions of this system of equations?

I want to find vertices (has integer coordinates) of the triangle $ABC$ with the centorid is $G(1,1)$ and orthocenter is $H(3,3)$. I tried

a = {x1, y1};
g = {1, 1};
h = {3, 3};
b = {x2, y2};
c = {x3, y3};
Solve[{x1 + x2 + x3 == 3 g[],
y1 + y2 + y3 == 3 g[], (h - a).(c - b) == 0, (h - b).(c - a) ==
0, -20 < x1 < 20, -20 < y1 < 20, -20 < x2 < 20, -20 < y2 < 20,
x2*y3 - x1*y3 + x1*y2 - y2*x3 + y1*x3 - y1*x2 != 0}, {x1, y1, x2,
y2, x3, y3}, Integers] There are some duplicate triangles. How to delete this duplicate triangles?

• You can Thread[a + b + c == 3 g] to relate the components of two separate lists more elegantly, not that this answer your question. Also Thread[-20 < a < 20], and Flatten[{a, b, c}]. – BoLe Apr 23 '13 at 9:03

I am not certain I understand, but starting with sols = Solve[ . . . ] does this help?:

{{x1, y1}, {x2, y2}, {x3, y3}} /. sols;

Union[Sort /@ %]

{{{-17, 7}, {7, -17}, {13, 13}},
{{-11, 3}, {7, -9}, {7, 9}},
{{-9, -3}, {3, 9}, {9, -3}},
{{-9, 7}, {3, -11}, {9, 7}},
{{-5, -5}, {1, 7}, {7, 1}},
{{-3, -9}, {-3, 9}, {9, 3}},
{{-3, 3}, {3, -3}, {3, 3}}}

• This is a great little solution! And calls attention to a useful case I'd never thought of, that Union[myList] returns myList as a "set". – billc Aug 1 '15 at 4:58
• @billc I am glad you found it of value. :-) – Mr.Wizard Aug 1 '15 at 5:36
• I was looking for away to improve the output of sols = Solve[Sin[x] == Cos[2 x] && 0 < x < 2 \[Pi], x]. You can simple add // Union !! – billc Aug 1 '15 at 5:38